Repository navigation
Guard against a SCHEMA_RULES entry silently missing the in-app agent prompt - #2479
Conversation
…prompt (closes #2438) Adds schema_rules_are_wired_or_explicitly_excluded, a test that checks every SCHEMA_RULES entry is either interpolated into schema_creation_guidance() (the in-app agent's prompt) or named in the new SCHEMA_RULES_NOT_IN_PROMPT exclusion list, with the ADR-064 rationale recorded inline for the five field/enum shape rules that are deliberately prose-only. This closes the gap that let DELETE_A_SCHEMA (PR #2435) reach the shipped SKILL.md without ever being wired into the in-app prompt: the existing every_schema_rule_reaches_the_skill test only checks the SKILL.md renderer, and the prompt_assembly_snapshot golden cannot catch an unwired rule since it never changes the rendered output. Verified the new test actually fails on an unwired rule and on a wrongly-excluded one before finalizing the failure messages, which name the two concrete fixes (wire it, or exclude it with a reason) rather than just reporting a mismatch. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY
Automated Pragmatic Code Review — PR #2479Review Type: Initial Review (no prior review comments found) Requirements Check (issue #2438)
Verification performed independentlyI did not trust the PR description's claim of having tested both failure modes — I reproduced both myself on a fresh checkout of the PR branch, mutating source and reverting after each:
Both reverts left On the substring-matching robustness question: Code Review Findings🟡 Important:
|
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). One non-blocking Important finding (the enum-edge-fields exclusion comment misstates where that rule is currently enforced — see full review comment above). Both failure-mode claims independently reproduced by mutating source and reverting; purely additive with zero production-path changes; full findings in the review comment above.
Review of PR #2479 caught that the enum-edge-fields entry in SCHEMA_RULES_NOT_IN_PROMPT claimed enforcement via create_schema's edgeFields tool-schema description. Neither create_schema nor update_schema takes an edgeFields parameter (local_agent/tools.rs) -- the only enforcement is the post-hoc validator in packages/core/src/schema/mod.rs, which runs after the model has already committed to a shape. That's exactly the failure mode ADR-064 exists to prevent for this rule category. Rewrote the comment to say so plainly: the rule sits in the exclusion list per ADR-064's intent, but the tool-schema side that intent describes hasn't been built for this specific rule yet. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY
Summary
schema_rules_are_wired_or_explicitly_excluded(packages/agent/src/skill_pipeline.rs), a test that checks everySCHEMA_RULESentry is either interpolated intoschema_creation_guidance()(the in-app agent's prompt) or explicitly named in a newSCHEMA_RULES_NOT_IN_PROMPTexclusion list.SCHEMA_RULES_NOT_IN_PROMPTnames the 5 field/enum shape rules ADR-064 deliberately moved ontocreate_schema's own tool schema instead of the prompt (no-name-title-field,fields-from-request-only,name-placeholder-exception,enum-format,enum-edge-fields), with the rationale recorded inline as comments so a future reader can tell a deliberate omission from a forgotten one.schema_creation_guidance()'s format string, or add it to the exclusion list with a reason — not just that a count mismatched. It also fails if a rule is both wired and listed as excluded, since that would mean the exclusion list itself is wrong.Why
SchemaRulecarries two renderings consumed by two different renderers (prose → shippedSKILL.md, imperative → the in-app agent prompt viaschema_creation_guidance()). A rule can be registered inSCHEMA_RULESand rendered intoSKILL.mdwithout ever reaching the in-app prompt — this happened for real withDELETE_A_SCHEMAin PR #2435. The existingevery_schema_rule_reaches_the_skilltest (packages/cli/tests/skill_md_generation.rs) only checks theSKILL.mdrenderer, and theprompt_assembly_snapshotgolden can't catch an unwired rule since an unwired rule never enters the rendered prompt at all — the golden stays silent on exactly the omission that matters.Verification
Per the issue, confirmed the test actually catches the failure mode before finalizing: temporarily added an unwired, unexcluded rule to
SCHEMA_RULESand confirmed the test failed with the expected message; separately added a wired rule's id to the exclusion list and confirmed that failure mode (wrongly-excluded) also fires; reverted both temporary changes.Test plan
cargo test -p nodespace-agent --lib schema_rules_are_wired_or_explicitly_excluded— passescargo test -p nodespace-agent --lib— 599 passed, 0 failedcargo test -p nodespace-cli --test skill_md_generation— 11 passed, 0 failed (existing SKILL.md guard still green)bun run test:all— clean pass (233 frontend test files / 4909 tests, 4 skill test files / 55 tests, all Rust crates 0 failed)bun run quality:fix— no additional changestest:all+cargo build --bin nodespaced+test:e2e) — passed🤖 Generated with Claude Code
https://claude.ai/code/session_01KwcVcLdvBUjSkUFmtFNiTY