Repository navigation
fold: F-Call step 5 refuses project-owned invocation outside executing (#199) - #2477
Merged
Merged
Conversation
…ting` (#199) spec 2.0 narrows `F-Call` step 5: a declarator whose callee resolves to a project file is `run` rather than imported and invoked at step 6, under any mode but `ι = executing`. Invoking it runs the factory body, and its whole module's top level, in the CLI's own process, and that is the project's own code rather than a package's. This is the same migration step 2 already made. Step 2's project-owned invocation moved behind `executing` at v0.72.3 (#2455); step 6 is the same path and had not moved. The specification decided first: its rationale says of `executing` that "it is never the default", and `verdict.md` calls `open` the strict default. The gate is in `invokeResolvedCallee`, the one choke point both step-6 callers reach, and it asks `isTrustedExecutableBinding` rather than `isProjectFileSpecifier` alone. The shape test is true of any absolute path and chant's own modules are imported by absolute path throughout the tests, so on its own it refused `propagate` and every other host function chant publishes. An active lexicon package or chant-core's own tree is a package's code; a relative or absolute specifier reaching anything else is the project's. `executing` was reachable only from `foldProject`. It is now on `DiscoveryOptions` and `BuildOptions` too, so a caller can ask for the mode the rule names, with the same sandbox-contradiction refusal `foldProject` has. The CLI flag and the `build.executing` config key are #2476. FOLD COVERAGE IS UNCHANGED: 96 of 109 example projects, byte-identical generated docs. No corpus example reaches step 6 with a project-file callee. Six tests encoded the old behaviour and now encode the new one, each keeping an `executing` counterpart so the mode stays covered. Two corrections in them worth naming: - "the module did not run" was the wrong assertion. A `run` verdict means the file IS run, and without --sandbox that is this process, so the module runs from the fallback. What the fold no longer does is invoke it, which `projectFactoryInvocations: 0` states exactly. - fold-provenance's fixture had an interpretable composite beside an inadmissible one in a single file. A verdict is per file, so the refusal took the whole file to run and every field's origin with it. The inadmissible one moved to its own file. SPEC_VERSION 1.8 -> 2.1. 2.0 is this rule. 2.1 bounds what an entity constructor may do, which `packages/core/src/runtime.ts` already satisfies: it defines the markers, stores props, and builds one AttrRef per attrMap entry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AzfJnYw9p6rAxhJqXK3CPv
…ts rules `scripts/check-docs-citations.ts` loads rules from the pinned `@intentius/tsad-conformance` and refuses a mismatch with chant's own SPEC_VERSION: Docs citations: chant declares specification 2.1, the loaded rules are 1.8. That gate is right, and it caught this commit's predecessor: chant cannot claim a version whose rules it does not install. `@intentius/tsad-conformance` 2.1.0 carries spec 2.1 (typescript-as-data#209, tag `tsad-v2.1.0`), so the declaration now has the rule set behind it. Docs citations: 166 file(s) clean against specification 2.1 (139 rules). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AzfJnYw9p6rAxhJqXK3CPv
This was referenced Sep 15, 2026
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.
Closes #199. Implements spec 2.0 and declares
2.1.The rule
Step 2's project-owned invocation moved behind
executingatv0.72.3(#2455). Step 6 is the same path and had not moved — the comment above the step-2 gate says so in as many words:Where the gate sits
invokeResolvedCallee, the one choke point both step-6 callers reach (resolveImportedCallfor the declarator form andresolveCompositeCallfor<Identifier>(...).step). Constructor revival is a different path and is untouched.It asks
isTrustedExecutableBinding, notisProjectFileSpecifieralone. My first cut used the shape test, which is true of any absolute path — and chant's own modules are imported by absolute path throughout the tests, so it refusedpropagateand every other host function chant publishes. Four test failures were that mistake rather than the rule. "Project file" is the specifier's origin: an active lexicon package or chant-core's own tree is a package's code, everything else reached relatively or absolutely is the project's.Fold coverage is unchanged
96 of 109 example projects before and after, with byte-identical generated docs. No corpus example reaches step 6 with a project-file callee — the ones that fold do it by interpretation at step 4.
That was the open question in #199 ("the step-6 subset of that, which is smaller"), and the answer is that it costs the corpus nothing.
executingis now reachableIt existed only on
foldProject.discoverandbuildnow take it too, with the same sandbox-contradiction refusal, so a caller can ask for the mode the rule names as the way back.The CLI flag and
build.executingconfig key are #2476, left out deliberately to keep this change to the rule and its plumbing. Nothing in the corpus needs them today, which is why that is a follow-up and not a blocker.Tests
Six encoded the old behaviour and now encode the new one, each with an
executingcounterpart so the mode stays covered. Two corrections in my own updates worth naming:runverdict means the file is run, and without--sandboxthat is this process, so the module runs from the fallback. What the fold no longer does is invoke it —projectFactoryInvocations: 0states that exactly, and the marker assertions were replaced with counter assertions.fold-provenance.test.ts's fixture put an interpretable composite beside an inadmissible one in one file. A verdict is per file, so the refusal took the whole file to run and every field's origin with it.LegacyServicemoved to its own file;WebServicestill proves all four origin kinds.Verification
packages/core/src/discovery— 433 passingmain(lexicons/aws/src/codegen/any-budget.test.tsand aterraform fmtcheck needing a binary this machine lacks)tsc --noEmit -p packages/core/tsconfig.jsoncleanscripts/generate-fold-coverage.ts— 96 of 109, no doc diffSPEC_VERSION 1.8 → 2.1
2.0 is this rule. 2.1 bounds what an entity constructor may do, which
packages/core/src/runtime.tsalready satisfies — it defines the markers, storesprops, and builds oneAttrRefperattrMapentry, with no validation, I/O or graph construction.This closes the one-major window
version.test.tsopened in the specification repo, which currently allows chant to declare at most one major behind and names #199 as what closes it.🤖 Generated with Claude Code
https://claude.ai/code/session_01AzfJnYw9p6rAxhJqXK3CPv