fix: make the astra_scope override work and warn on store-less pages with astra content#12
Merged
Merged
Conversation
…with astra content Fixes #10. MyST validates page frontmatter against its own schema and drops unknown keys before transforms run, so the documented astra_scope override never reached scopeForFile — pages outside the dotted-filename convention had no way into the scope map, and every astra element on them silently degraded to its neutral fallback in rich themes. - scopeForFile now falls back to reading astra_scope from the RAW source file's frontmatter block (parseYamlString), preferring the validated vfile frontmatter if a future MyST passes the key through. The dotted string ('' = root) and list forms both work, matching the docs. - An explicit astra_scope that fails to resolve is reported as an error through the diagnostics channel instead of silently yielding no store. - A page outside the scope map that still carries astra elements now gets a build warning naming the two fixes (scope-named file or astra_scope), instead of silently losing hover cards and rich panels. - Docs: multi-page.md documents the root override and the new diagnostics; 6 new tests pin all three behaviors (100/100 pass). Verified against the DESI DR1 BAO prototype: the warning fires for a store-less page with astra content, and 'astra_scope: ""' emits the root store on an arbitrarily-named page (MyST's own 'extra key ignored' advisory confirms the stripped-key root cause). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013EE6NiwH2UhVAUT6cdAQJ4
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.
Fixes #10.
MyST validates page frontmatter against its own schema and drops unknown keys before transforms run (
⚠️ 'frontmatter' extra key ignored: astra_scope), so the documentedastra_scopeoverride never reachedscopeForFile— a page outside the dotted-filename convention had no way into the scope map, and every astra element on it silently degraded to its neutral fallback in rich themes (no hover cards, no rich panels), even though the directive/role content itself resolves fine.Changes
astra_scopenow works.scopeForFilefalls back to reading the override from the raw source file's frontmatter block (via the SDK'sparseYamlString), preferring the validatedvfilefrontmatter if a future MyST passes the key through. Both documented forms work — dotted string (""selects the root analysis) and list.Explicit failures are loud. An
astra_scopethat names an unknown scope is reported as an error through the diagnostics channel (strict builds gate on it) instead of silently yielding no store.Silent fallback is no longer silent. A page that maps to no scope but still carries astra elements gets a build warning naming both fixes:
Pages with no astra content stay silent, and the filename-convention miss itself is not an error (that's how non-ASTRA pages are supposed to work).
Docs:
multi-page.mddocuments the root ("") override and the new diagnostics.Testing
npx vitest run100/100,npx tsc --noEmitclean.astra_scope: ""to an arbitrarily-named page emits the root store and clears the warning.Independent of #11 (touches
src/index.tsscope/transform code only; no overlap with the carrier rendering files).The remaining item from #10 — the produced-metric carrier type contract (v0.0.6
OutputType: metric) — is not addressed here; it's tied to the metric-materialization work and worth its own issue if it doesn't land with v0.0.6.🤖 Generated with Claude Code
https://claude.ai/code/session_013EE6NiwH2UhVAUT6cdAQJ4