Skip to content

Fix scaffold Astro template for real authoring (adversarial review) - #16

Merged
nicholsn merged 1 commit into
mainfrom
fix/scaffold-astro-review
Jul 4, 2026
Merged

Fix scaffold Astro template for real authoring (adversarial review)#16
nicholsn merged 1 commit into
mainfrom
fix/scaffold-astro-review

Conversation

@nicholsn

@nicholsn nicholsn commented Jul 4, 2026

Copy link
Copy Markdown
Owner

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.

# Sev Defect Fix
1 high A nested knowledge/**/index.md (or log.md) crashed astro build — the glob excluded only the root reserved files, but the toolkit reserves them at any depth. '!**/index.md', '!**/log.md'
2 high In-body .md cross-links ([x](../y.md), /y.md) rendered verbatim → 404; the bundled author-concept skill even teaches root-absolute .md links. new base-aware remark-lokf-links plugin rewrites them to page routes under the site base
3 med Bundle-relative relation targets (references: [glossary/active-user], valid LOKF the toolkit resolves) silently dropped graph edges and rendered broken links. 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, so site IRIs diverged from the toolkit (and graph.json vs graph.jsonld disagreed). generateId preserves the literal path; iriOf honors an absolute id; graph.jsonld ordered so iriOf wins

Verified on an adversarial scaffold

A KB with a nested playbooks/index.md, a relative references, a root-absolute dependsOn, and both link forms in the body → astro build succeeds (5 pages), graph.json has 3 nodes / 3 edges (all relations resolved), in-body links become /adv-kb/glossary/active-user etc., and 0 stray .md hrefs in the whole dist. 134 tests (+ a regression guard).

Follow-up to the now-merged #14.

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.
@nicholsn
nicholsn merged commit 5cad149 into main Jul 4, 2026
2 checks passed
@nicholsn
nicholsn deleted the fix/scaffold-astro-review branch July 4, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant