Preserve protected Syntax authority through generated XMD - #776
Conversation
| } | ||
| // The route goes with the domains: a wrapper projected into it, or a | ||
| // route narrowed from it, answers for nothing once the execution that | ||
| // minted the bodies is gone. |
There was a problem hiding this comment.
Redundant comment — restates what the code does.
| // minted the bodies is gone. |
PR #776: Preserve protected Syntax authority through generated XMD14 files, +795 / -76 Scope🔴 PR has 871 lines changed. Split into focused PRs. 🟡 871 lines changed. PRs under 400 receive more thorough review. StructuralOxlint structural signals:
Slop
Oxlint slop signals:
Static AnalysisOxlint: 58 diagnostics across 7 files (14 rules) no-unsafe-type-assertion (14): packages/core/src/invocation-identity.ts, packages/core/src/expand.ts, packages/core/src/execute.ts CorrectnessNo extraneous code patterns detected. |
Why
Issue #762 will allow a planning agent to ask XMD for documentation using
<Syntax names={...} />.This PR ensures that when an agent requests documentation with
<Syntax names={...} />, only XMD’s approvedSyntaxcomponent can handle the request. Middleware may observe or delegate component lookup, but it cannot substitute a different component under theSyntaxname.This is a core prerequisite. It does not yet add the information-request conversation to
xmd plan.What changes
Before:
<Evaluate>could be told thatSyntaxwas available, but it could not safely run XMD’s protectedSyntaxcomponent inside the XMD text it evaluated.After:
<Evaluate>can safely run the approvedSyntaxcomponent and return its documentation. The permission applies only to that approved component and ends when the evaluation ends.For example, this core path can now support:
The later Plan PR will use this behavior to return the requested documentation to the planning agent’s next turn.
How it remains safe
Syntax.Syntaxpermission.Review guide
The remaining details describe the internal implementation for code reviewers.
Start with:
ProtectedBodiesinpackages/core/src/invocation-identity.tsThen review:
packages/core/src/evaluation-profile.tsrecords which verified protected component is available.packages/core/src/components/Evaluate.tsgives each evaluation its own narrower permission route.packages/core/src/generated-xmd.tsandpackages/core/src/expand.tsuse that route while preserving form checks and captured results.Look carefully at:
How to verify it
deno task test packages/core/tests/generated-xmd.test.ts packages/core/tests/evaluate-component.test.ts packages/core/tests/syntax-component.test.ts packages/core/tests/evaluation-profile.test.ts packages/core/tests/evaluate-provider-lifetime.test.ts packages/core/tests/evaluate-loaded-copy.test.ts packages/core/tests/syntax-loaded-copy.test.ts deno task check deno task lint git diff --check d56d5ba016150b7750384ba4a2ba81f56a5b1ab9..33a45a31558765ed9a647bd4a5add4c6c6b200e9The final focused run passed 41 suites / 315 steps. Typecheck, repository lint/format, and diff checks passed. Required CI remains the delivery gate and has not been inspected.
Scope
Included
Syntaxcomponent inside generated XMDIntentionally unchanged
xmd planresponse classifier and information-request conversationThose Plan product changes begin only after this prerequisite is accepted. This PR does not close #762.
Risks and limitations
Syntaxcancellation test failed once and then passed unchanged in isolation and in the complete focused rerun. It is tracked separately as Make <Syntax> cancellation always release its reference #775 and was judged non-blocking by both reviewers.Scope confirmation