okf: fix visualize edges for absolute and titled cross-links#184
Open
manumishra12 wants to merge 1 commit into
Open
okf: fix visualize edges for absolute and titled cross-links#184manumishra12 wants to merge 1 commit into
manumishra12 wants to merge 1 commit into
Conversation
The reference visualize tool extracted zero edges from spec-conformant bundles that use either absolute bundle-relative links (recommended by SPEC.md) or standard CommonMark link titles, so such bundles rendered as disconnected node clouds. - Resolve /-prefixed link targets against the bundle root instead of skipping them. - Allow an optional CommonMark link title in the link-extraction regex. Adds regression tests for both link forms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The reference
visualizetool extracts 0 edges from bundles whose cross-links use either form thatokf/SPEC.mdtreats as valid:/tables/users.md), which the SPEC's cross-linking guidance recommends, and[Users](users.md "the users table")).Only relative, untitled links produced edges, so otherwise spec-conformant bundles rendered as disconnected node clouds.
Why
In
okf/src/reference_agent/viewer/generator.py:_extract_linksskipped every/-prefixed target (if "://" in target or target.startswith("/")), dropping the recommended absolute form._LINK_REleft no room for a link title, so](path.md "title")— valid CommonMark — did not match at all.Fix
/-prefixed targets against the bundle root instead of skipping them."..."or'...') in the link-extraction regex.Both changes are confined to link extraction; node and edge building are unchanged. External (
://) links are still ignored, and dangling links still produce no edge.Tests
Adds two regression tests to
okf/tests/test_viewer.py:test_titled_links_become_edgestest_absolute_bundle_relative_links_become_edgesEach fails on the current code (0 edges) and passes with this change. Full viewer suite: 8 passed.
Notes
Addresses #48. This is a deliberately small, test-covered change scoped only to the visualizer's edge extraction, offered as a focused alternative to the broader #66 (which also reworks SPEC text across the codebase). Happy to adjust scope if maintainers prefer.