Fix scaffold Astro template for real authoring (adversarial review) - #16
Merged
Conversation
An adversarial review of the scaffold surfaced four defects the example bundle dodged — all verified by scaffolding a KB and running `astro build`: 1. (high) Nested index.md/log.md crashed the build: the glob excluded only the root-level reserved files, but the toolkit reserves them at any depth. Use '!**/index.md' / '!**/log.md'. 2. (high) In-body `.md` cross-links rendered verbatim -> 404 (and the bundled author-concept skill teaches root-absolute `.md` links). Add a base-aware remark-lokf-links plugin that rewrites relative/root-absolute `.md` links to their page routes under the site base. 3. (med) Bundle-relative relation targets (valid LOKF, resolved by the toolkit) dropped graph edges and rendered broken links. Add resolveRef() mirroring Bundle.resolve, applied in relationsOf() and graph.jsonld. 4. (low) IRI drift: the glob loader slugified ids and ignored an explicit frontmatter `id`. Preserve the literal path via generateId; honor an absolute `id` in iriOf; order graph.jsonld so iriOf wins. Verified end-to-end on an adversarial scaffold (nested index + relative & root-absolute relations + in-body `.md` links): build succeeds, all 3 edges resolve, links are base-aware, 0 stray `.md` hrefs. 133 tests + a new regression guard.
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.
An adversarial review of the Astro scaffold (merged in #14) surfaced four defects the example bundle dodged — all reproduced with
lokf new+astro build, all fixed and re-verified end-to-end.knowledge/**/index.md(orlog.md) crashedastro build— the glob excluded only the root reserved files, but the toolkit reserves them at any depth.'!**/index.md','!**/log.md'.mdcross-links ([x](../y.md),/y.md) rendered verbatim → 404; the bundledauthor-conceptskill even teaches root-absolute.mdlinks.remark-lokf-linksplugin rewrites them to page routes under the site basereferences: [glossary/active-user], valid LOKF the toolkit resolves) silently dropped graph edges and rendered broken links.resolveRef()mirroringBundle.resolve, applied inrelationsOf()andgraph.jsonldid, so site IRIs diverged from the toolkit (andgraph.jsonvsgraph.jsonlddisagreed).generateIdpreserves the literal path;iriOfhonors an absoluteid;graph.jsonldordered soiriOfwinsVerified on an adversarial scaffold
A KB with a nested
playbooks/index.md, a relativereferences, a root-absolutedependsOn, and both link forms in the body →astro buildsucceeds (5 pages),graph.jsonhas 3 nodes / 3 edges (all relations resolved), in-body links become/adv-kb/glossary/active-useretc., and 0 stray.mdhrefs in the wholedist. 134 tests (+ a regression guard).Follow-up to the now-merged #14.