Repository navigation
Tie SchemaRule's imperative and prose forms together with parity tests (closes #2629) - #3251
Conversation
Pragmatic Code Review — PR #3251Review Type: Initial Review (no prior reviews or comments on the PR) SummaryA small change that clearly improves things. Before this PR, nothing in CI tied the two hand-written forms of a Requirements Check (#2629)
Code Review Findings🟡 The 🟡 An example that stops being valid JSON is silently dropped 🟢 Some single-word anchors are weak signals 🟢 One-sided content still drifts freely (inherent, and worth knowing) 🟢 Nit: test-only metadata lives on the shipped struct Project standards: no issue numbers in code comments ✅, no lint suppression ✅, the comments explain why (drift intent, the reason for the exemption) ✅, and the golden was regenerated rather than hand-edited ✅. RecommendationAPPROVE. Both 🟡 items are small tightenings to the test harness (narrow the exemption; assert that |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Review addressed✅ 🟡 Exemption scope: skill_rules tests: 10/10 pass. Re-review: not needed. The changes are a narrowed condition in one test plus two anchor strings. |
closes #2629) Each SchemaRule now declares `anchors` — the load-bearing names, values and phrases both forms must carry — and two tests enforce that the imperative form (in-app agent prompt) and prose form (rendered verbatim into the shipped skill) contain every anchor and show the same JSON examples. The prose → skill link was already held by gen_skill_md --check, so this closes the remaining untied pair. EXTENDS_SCHEMA_COMPOSITION's imperative example elided its coreValues as `[...]`; it now carries the same concrete values as the prose form, so the example is valid JSON and matches (golden regenerated). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…hors
- PROSE_ONLY_EXAMPLES now exempts only the prose->imperative direction, so an
example added to delete-a-schema's imperative form is still checked.
- Replaced the generic "default" anchor with "must be one of the declared
values" and dropped "child" (subsumed by has_child).
- Skipped: making every {" candidate must-parse. Both forms of
EXTENDS_SCHEMA_COMPOSITION intentionally show an elided rejected shape
({"relationships": [{... ...}]}); a must-parse rule would need an elision
exemption that reopens the same hole. Documented on json_examples.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
85c17bc to
1116f19
Compare
Summary
Closes #2629.
The issue described three untied copies per schema rule (
imperative,prose, cli.md). One link is already covered on current main: cli.md's schema-rules section sits inside<!-- BEGIN GENERATED: schema-rules -->and is rendered verbatim fromprose, andchecked_in_skill_md_is_up_to_dateguards it. The pair that remained untied isimperative↔prose.A single shared source doesn't fit that pair, because the two forms differ on purpose: they name different surface verbs (
update_schemavsschema update), and some rules diverge by design (ADD_ENUM_VALUESdocuments why). So this adds a parity test:SchemaRule::anchors: each rule lists its load-bearing names, values and phrases.schema_rule_forms_share_their_anchorsasserts every anchor appears (case-insensitively) in both forms. On failure it names the rule, the form and the missing anchor.schema_rule_forms_share_their_json_examples: every JSON object embedded in either form is parsed, so spacing differences don't count, and the two forms must show the same set.delete-a-schemais exempt (PROSE_ONLY_EXAMPLES) because its prose walks through complete CLI commands the imperative form has no counterpart for.EXTENDS_SCHEMA_COMPOSITION's imperative example elidedcoreValuesas[...], which is not valid JSON and did not match the prose example. It now carries the same concrete values. Thestage2_candidate_blockgolden was regenerated for that one line.InteractionRuleis left as is: itsproseisn't rendered anywhere, andskill_md_key_phrasealready ties it to SKILL.md.Test plan
cannot nestfrom GROUPING's imperative fails the anchor test withgrouping-is-collections: imperative is missing "cannot nest", and restoring[...]in EXTENDS fails the example testbun run test:changedpasses🤖 Generated with Claude Code