okf: fix concept-graph link resolution, reserved filenames, and payload escaping - #262
Open
ishita199615 wants to merge 1 commit into
Open
Conversation
…ad escaping The bundle viewer dropped every bundle-absolute link, treated the reserved `log.md` as a concept, and embedded its JSON payload unescaped. Fixes: * `_extract_links` now resolves `/`-prefixed targets against the bundle root (SPEC §6.1) instead of skipping them as external. `viz.js` already treated this form as internal, so the Python and JS halves disagreed. On the shipped `acme_retail` bundle this restores 8 of 14 edges. * `index.md` and `log.md` are now a single shared `RESERVED_FILENAMES` set (SPEC §3.1), honoured by both the viewer and the index generator. Previously `log.md` rendered as a concept node and `regenerate_indexes` emitted a spurious "Log" section that drifted from the committed bundles. * The embedded payload is escaped so bundle content cannot terminate the inline `<script>` element. A concept title containing `</script>` left `window.BUNDLE` undefined (blank viewer) and executed injected markup. * `is_stale` normalizes a `datetime` to `date`. YAML parses an unquoted timestamp into `datetime`, which raised `TypeError` and aborted the whole `visualize` run. Adds five regression tests, each verified to fail without the change, and a non-normative SPEC §6.1 note reconciling the two link forms with the producer prompt's GitHub-rendering guidance.
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.
While using the OKF viewer I noticed it drops the spec-recommended
/-stylelinks — the shipped
acme_retailbundle renders only 6 of its 14 edges, withboth policy docs floating disconnected. Digging in turned up three more issues:
the reserved
log.mdgets drawn as a concept node, a</script>anywhere inbundle content blanks the whole viewer (and lets the content execute as
markup), and a timestamped
stale_aftercrashesvisualizewith aTypeError.This PR fixes all four, with six regression tests (suite goes 39 → 45, passing
on Python 3.11–3.13) and a small SPEC §6.1 note reconciling the two link forms
with the producer prompt — happy to split that spec edit out if you'd prefer.
No behaviour change for bundles that only use relative links. CLA signed.