test: derive subc registration checks from the embedded tool schemas
Closes #195, implementing the five points you pinned.
| # | Point | Where |
|---|---|---|
| 1 | Derived test beside build_manifest, four assertions per key | manifest.rs embedded_subc_tools_are_registered_across_all_rust_surfaces |
| 2 | command_lane_explicit(&str) -> Option<Lane>, command_lane a thin wrapper | manifest.rs:92 |
| 3 | Documented exemption const, empty today | TRANSLATION_EXEMPT |
| 4 | CORE_TOOLS and the hardcoded counts derive from the keys | manifest.rs, subc_bridge_test.rs:6886 |
| 5 | Test asserts its own denominator | SUBC_TOOL_SCHEMAS.len() == tools.len() |
Notes on two places where I made a judgement call
Point 4, CORE_TOOLS shape. A fixed-size [&str; N] cannot derive its length from a runtime map, so I made it &[&str] — no arity to drift — and asserted both len() against the key count and exact set equality. The alternative (keep the array, assert its length) leaves an arity literal in the file, which is the thing #195 is about.
Point 5, the denominator. You framed this as key count equals BARE_TOOL_ORDER's length. BARE_TOOL_ORDER is TypeScript-only and not reachable from Rust, so the Rust-side denominator asserts key count equals the manifest tool count, with a comment saying why. The TS side already pins the other half — subc-tool-schemas-fresh.test.ts asserts the committed artifact matches in-memory generation byte-for-byte and that SUBC_BARE_TOOL_NAMES covers exactly the artifact's keys. Between the two, a truncated artifact fails on one side and a drifted selection list on the other. If you want the count itself pinned in Rust, say so and I will add it, but it would be a literal again.
command_lane behaviour is unchanged
The catch-all returned Mutating for anything unmatched, which is exactly why a missing lane was unobservable. command_lane_explicit returns None there; command_lane is command_lane_explicit(c).unwrap_or(Lane::Mutating).
Six tools reached that fallthrough and now carry explicit Mutating arms — apply_patch, delete, move, import, refactor, safety. Same lane they already had, now stated. Every other call site is untouched.
Every assertion was observed failing before being trusted
A guard nobody has watched fail is the defect this PR is about, so each one got a red:
tool "zoom" is missing from is_subc_agent_core_tool in crates/aft/src/subc/manifest.rs
tool "zoom" is missing from build_manifest in crates/aft/src/subc/manifest.rs
tool "delete" is missing an explicit command_lane arm in crates/aft/src/subc/manifest.rs
tool "zoom" is missing from supports_tool in crates/aft/src/subc_translate.rs
denominator: left: 21, right: 22
Messages name the tool, the missing registration, and the file to edit — I followed the register subc_plumbing_drift_test.rs already uses.
Verification
cargo nextest run -p agent-file-tools --lib -E 'test(subc)' → 122 passed. Full workspace run reached the complete selected count; the failures in my worktree are pre-existing there (read-only borrow worktree ⇒ callgraph artifacts unavailable, plus sandbox/permission cases), and I confirmed that by running the identical selection on upstream/main in the same worktree — byte-identical failure sets, 25 both sides, none naming a file this PR touches. Lint, format, and the v0.49 audit pass; release artifacts untouched.
One thing worth flagging separately: you mentioned your gate scripts moved to --no-fail-fast. .config/nextest.toml still sets fail-fast = true at the profile level, so a bare cargo nextest run inherits it. On a machine with any pre-existing environmental failure that silently truncates the run — mine cancelled at ~1320 of 1643 and hid the rest, which is how the count assertion in this file reached CI in the first place.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Derives subc tool registration checks from the embedded schema so missing registrations fail tests with clear errors, addressing #195. Also makes command lane mapping explicit and removes hardcoded tool counts.
- Refactors
- Registration guard now derives from
subc_tool_schemas.json; for each tool we assert presence in core list, manifest, explicit lane, and translation support. - Added
command_lane_explicit(&str) -> Option<Lane>;command_lanewraps it with defaultMutating. Added explicitMutatingarms for apply_patch, delete, move, import, refactor, safety. - Replaced fixed-size CORE_TOOLS with a slice and assert set equality and count vs schema keys; test also checks schema key count equals manifest tools.
- Updated integration test to compare manifest tool count to schema key count; refreshed docs artifacts to the new source commit (no behavior change).
- Registration guard now derives from
Greptile Summary
This PR derives Rust-side subc registration checks and manifest counts from the embedded tool schemas while preserving existing command-lane behavior. It also refreshes governed v0.49 audit artifacts, but those artifacts were generated before the final test changes and are stale at the PR head.
- Adds an explicit optional lane classifier and verifies every embedded subc tool across Rust registration surfaces.
- Replaces a literal integration-test tool count with the embedded schema count.
- Refreshes v0.49 prefix, surface-manifest, and vocabulary-allowlist artifacts.
Confidence Score: 4/5
The subc test changes appear sound, but the governed v0.49 artifacts must be regenerated from the final PR head before merging because the repository audit currently fails.
The final integration-test insertion shifted source occurrences after the governed allowlist and integrity manifest were generated, leaving stale locations and artifact hashes that the audit script rejects.
Files Needing Attention: docs/v0.49-agent-surface-manifest.json, docs/v0.49-legacy-vocabulary-allowlist.json, docs/v0.49-agent-prefix-capture.json
Important Files Changed
| Filename | Overview |
|---|---|
| crates/aft/src/subc/manifest.rs | Adds behavior-preserving explicit lane classification and comprehensive schema-derived registration tests. |
| crates/aft/tests/integration/subc_bridge_test.rs | Derives the expected manifest count from the embedded schema, but its inserted lines invalidate source locations in the separately changed governed allowlist. |
| docs/v0.49-agent-surface-manifest.json | Records governed artifact provenance and hashes from an intermediate commit, so final-head audit verification fails. |
| docs/v0.49-legacy-vocabulary-allowlist.json | Refreshes source locations before the final integration-test insertion, leaving tracked line positions stale. |
| docs/v0.49-agent-prefix-capture.json | Refreshes capture provenance from the same intermediate artifact-generation commit and requires final-head regeneration with the manifest. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Embedded subc schema keys] --> B[CORE_TOOLS exact-set check]
A --> C[Manifest registration]
A --> D[Core-tool gate]
A --> E[Explicit command lane]
A --> F[Translation support]
C --> G[Integration manifest count]
Reviews (1): Last reviewed commit: "test: derive subc registration checks fr..." | Re-trigger Greptile
Greptile also left 1 inline comment on this PR.