Repository navigation
Description
Follow-up to the fold epic #1019. A fundamental capability changed — chant build --fold reduces TypeScript-as-Data statically instead of running it — and the docs largely predate it. This is an adversarial audit: assume every relevant page is stale until verified against shipped behavior.
This issue body was re-verified against the tree at 9b1beaf. Two claims in the original filing were wrong and are corrected below.
Ground truth to audit against
chant buildruns the module by default (imports + executes); EVL keeps that run deterministic.chant build --fold(feat(core): fold — opt-in build path with run-fallback for composites #1022, opt-in; alsobuild.fold: trueinchant.config.ts, flag wins) folds the AST instead, per file, with run-fallback for anything outside the subset. Logs[fold:fold]/[fold:run] <reason>per file.- Folds leaf
new Type()resources (feat(core): fold — AST value reducer for the supported subset (leaf, single-file) #1026/feat(core): fold — symbolic cross-resource refs + intrinsic tagged templates #1021) and composite factory calls (feat(core): fold — composite factory interpretation (removes the last run) #1023). - Cross-resource refs use the real
__attrRefshape. Registered intrinsic tagged templates fold; unregistered fall back. - EVL is a diagnostic over one shared subset definition (refactor(core): demote EVL to a diagnostic over one shared subset definition #1024), with documented fold/EVL divergences.
- test(core): differential conformance corpus — fold-output === run-output #1025 differential proves folded output is byte-identical to run output. Run it:
just fold-differential. - Not yet shipped: cross-file identifier/attribute resolution (feat(core): fold — resolve identifiers across the module graph #1020) — the biggest remaining fallback cause.
Code of record: packages/core/src/fold/{fold,subset}.ts, packages/core/src/discovery/fold-import.ts, packages/core/src/lint/rules/evl*, CLI flag at packages/core/src/cli/main.ts:219 and help text at :410.
Correction 1 — there IS a central section, and it is stale
The original filing said a grep for --fold returns essentially nothing. Wrong. docs/src/content/docs/concepts/typescript-as-data.mdx has a ## Folded vs Run section (~lines 197–210). It is the only page in the entire doc base that mentions fold (verified: 1 file matches --fold|run-fallback across docs/ and all lexicons/*/docs/).
It is also factually stale. Line ~201 reads:
Only the leaf pattern folds today:
export const x = new Type({...}). Anything outside that subset — most notably a composite factory call (export const stack = MyStack({...})) ... makes the whole file fall back
#1023 shipped composite factory folding. That sentence is now false, and its example is exactly the case that now folds. Line ~210 ("As more of it is covered statically (cross-file resolution, composite interpretation), more files fold") is likewise half-stale — composite interpretation landed; cross-file (#1020) has not.
So the job is not "create a central home" — it is fix and complete the one that exists, then link other pages to it rather than duplicating.
Correction 2 — the lexicon surface is 8 pages, not 22
The original filing said "every lexicon ships intrinsics.mdx and composites.mdx". Wrong. The complete fold-affected lexicon set is:
lexicons/aws/docs/src/content/docs/{composites,intrinsics}.mdx
lexicons/azure/docs/src/content/docs/{composites,intrinsics}.mdx
lexicons/gitlab/docs/src/content/docs/intrinsics.mdx
lexicons/helm/docs/src/content/docs/{composites,intrinsics}.mdx
lexicons/github/docs/src/content/docs/composites.mdx
Audit those eight. Do not go looking for files that do not exist.
Scope
Core pages to audit (docs/src/content/docs/): concepts/{typescript-as-data,evaluation-pipeline,philosophy,comparison,overview,where-values-come-from}.mdx, lint-rules/evaluability.mdx, guide/{writing-resources,linting}.mdx, cli/{build,run}.mdx, getting-started/quick-start.mdx, serialization/output-formats.mdx, troubleshooting/*.
Verified leads to start from:
cli/build.mdx— zero mentions of--fold. The flag andbuild.foldare undocumented in the CLI reference.- Absolute "never runs" / "not enforced" claims live in
cli/run.mdx,lint-rules/audit-rules.mdx, andconcepts/typescript-as-data.mdx. Every such claim is a prime suspect: precise only under--fold, since the default still runs. #1024's agent explicitly left the "not enforced by chant build" framing inevaluation-pipeline.mdxandtypescript-as-data.mdxunaudited. Folding is the enforcement under--fold.lint-rules/evaluability.mdx— does it describe EVL as a diagnostic over the shared subset, and the divergences?
Coordination with #1039
#1039 (in flight) fixes the CLI fold path never threading lexicon intrinsics through, plus per-lexicon isTag registration. Until it lands, intrinsic tagged templates fall back in practice even though the folder supports them.
Write the docs to the designed behavior — "a registered intrinsic tagged template folds" — and do not assert per-lexicon specifics like "AWS Sub folds" or "AWS Sub does not fold", since #1039 is actively changing exactly that. Keep the intrinsics note general.
Method
- Do not trust a page because it reads plausibly. Cross-check each claim against the code paths listed above.
- Any "never/always/only" about running or folding is a suspect.
- Prefer a small number of authoritative pages plus cross-links over scattered half-updates.
- Where you assert behavior, verify it: run
chant build <dir> --foldon a real example and read the[fold:*]lines, or runjust fold-differential.
Acceptance criteria
- Findings table: every audited page (13 core + 8 lexicon) marked
accurate/stale/missing, with the specific stale claim and the fix. -
concepts/typescript-as-data.mdx's## Folded vs Runis corrected (composites fold; feat(core): fold — resolve identifiers across the module graph #1020 cross-file is the remaining gap) and is complete enough to be the single canonical home other pages link to. -
cli/build.mdxdocuments--foldandbuild.fold. -
lint-rules/evaluability.mdxdescribes EVL-as-diagnostic plus the fold/EVL divergences. - A before/after explainer: default run-based (deterministic by lint discipline) vs opt-in fold-based (deterministic by construction, with run-fallback); what changed for the author (nothing — it is opt-in); how to see it (
--foldlogs, the test(core): differential conformance corpus — fold-output === run-output #1025 differential). - The eight lexicon pages carry a fold note where behavior is non-obvious.
- No page makes an absolute "never runs" claim without the
--foldqualifier.
Verification
Docs are a separate Astro build. cd docs && npm run build must pass, and CI runs a link check — do not leave links to pages or anchors that do not exist.
Activity
lex00 commentedon Jul 25, 2026
Audit complete — consolidated findings (4 parallel auditors, code-verified)
This issue stated "registered intrinsic tagged templates fold." They don't, in the wired CLI path —
--foldhardcodes an empty intrinsics array (fold-import.ts), so every intrinsic tagged template falls back to run. Filed as #1039. Consequence for the fix wave: no doc may claim intrinsics fold today. The honest note is "intrinsic-using files fall back to run under--fold." Empirically: 0/~20 AWS, 0/~9 Azure, 0/~8 GCP examples fold; the 14/98 that fold are intrinsic-free leaf/composite/destructure examples.The pattern: the epic touched exactly ONE doc file, and #1023 landed after even that
git showof the epic commit edited onlylint-rules/evaluability.mdx(2 lines). Composite folding (#1023) merged after the epic's doc pass, so the one fold section that exists (typescript-as-data.mdx"Folded vs Run") is now factually wrong — it says composite calls don't fold.Q1 — central home
concepts/typescript-as-data.mdxis the right home (keep it; don't fork), but currently stale + incomplete: line ~201 wrongly says composite calls fall back; missing the EVL-shared-subset (#1024), the documented fold/EVL divergences, and the #1025 differential/parity claim. Its own[fold:run]example is a case that now folds.Q2 — references to fix (per-page verdicts)
Stale / wrong (highest priority):
guide/writing-resources.mdx— "It never executes your code" — FALSE for default path.getting-started/quick-start.mdx— "chant reads your TypeScript as data, it never executes it" — same.concepts/comparison.mdx— "Code as Data / without being executed" stated as flat external fact; the "execution model difference" section is the biggest missing--foldfact.concepts/philosophy.mdx— "Synthesis does run your code … EVL reject anything" (determinism-only-by-lint framing).concepts/typescript-as-data.mdx— the stale composite claim (above).Missing (critical):
cli/build.mdx— zero--foldcoverage (grep-verified).configuration/config-file.mdx— zerobuild.fold.concepts/evaluation-pipeline.mdx— single run-only pipeline, no fold path.Incomplete:
lint-rules/evaluability.mdx— the one edited page: only names EVL001 (not EVL003), overclaims "exactly the same" (ignores 5+ documented divergences), and "the folder actually enforces it" lacks the opt-in--foldqualifier.troubleshooting/common-errors.mdx— no[fold:run]/FoldErrorguidance.concepts/overview.mdx,concepts/where-values-come-from.mdx— minor default-only framing.Accurate (no change):
cli/run.mdx,guide/linting.mdx,serialization/output-formats.mdx,troubleshooting/type-errors.mdx,lint-rules/audit-rules.mdx.Lexicons (all additive — no false claims found, only silence):
new-as-value (gitlabnew Image(), githubnew Step(), flynew MachineConfig()), pseudo-param proxy on unresolved imports (CI.*,Fly.*, helmvalues.*), and intrinsic calls (bug(core): --fold never threads lexicon intrinsics through, so intrinsic tagged templates never fold in production #1039) — all fall back today.pipeline-concepts, githubworkflow-concepts, helmhelm-concepts— strongest case, it's the core idiom, flyresources, dockerinterpolationscoped toenv(), aws/azureintrinsics+compositeswith the "falls back today" caveat).composite-examples.mdx(destructuring shape — 4 of the 14 folding entries) and gcpcomposite-examples.mdx.reference()isisTag:truebut invoked as a plain call; AWSSubisisTag:false— both feed bug(core): --fold never threads lexicon intrinsics through, so intrinsic tagged templates never fold in production #1039.getting-started.mdx"TypeScript-to-X compiler" boilerplate (azure/gcp/k8s, identical) nudges a static-transform model true only under--fold— one shared softening.Q3 — before/after
No page narrates the run→fold shift. Recommendation: expand
typescript-as-data.mdx's "Folded vs Run" into it — "deterministic by lint discipline" (default) → "deterministic by construction" (--fold), nothing required of the author,[fold:fold]/[fold:run]logs + #1025 to verify — and have philosophy/comparison/overview/evaluation-pipeline each carry one linking sentence back.docs: adversarial audit of fold / TypeScript-as-Data docs (#1038) (#1043