You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MCP-exposure batch adds a set of read-only MCP tools to AMS covering status, portfolio, claims, event-ledger, governor-ledger, run-state, and plan-store. gittensory-engine already has its own driver parity/contract suite (#4296) that enforces shared safety invariants across all coding-agent drivers, but nothing analogous exists for the MCP surface — each read-only tool would otherwise ship with only its own bespoke tests, with no shared enforcement that none of them leak secrets, expose excluded raw columns, or fail inconsistently.
Dependencies
Depends on the MCP-exposure batch landing first — specifically the MCP scaffold issue and the seven read-only tool issues (status, portfolio, claims, event-ledger, governor-ledger, run-state, plan-store) in this same batch. Do not start until at least those tools exist to test against; this issue adds a shared contract-test suite layered on top of them, it is not a substitute for each tool's own individual tests.
Requirements
After the MCP scaffold and the seven read-only tools (status, portfolio, claims, event-ledger, governor-ledger, run-state, plan-store) have landed, add a shared contract-test module — e.g. under packages/gittensory-miner/lib/mcp/__tests__/contract.test.js or the package's existing test convention — parameterized over every registered read-only MCP tool.
For each tool, assert the response never contains a secret-shaped value (token/key/hotkey-shaped patterns) — reuse or extend any existing secret-pattern matcher in the codebase rather than writing a new detector from scratch, if one already exists.
For each tool, assert the response never includes payload_json or any other explicitly-excluded raw column: read each tool's own exclusion list and assert none of those keys appear anywhere in the response, including nested objects.
For each tool, assert a consistent, uniform error shape is returned when the underlying local store (ledger/plan-store file, etc.) is missing or corrupt — inject a missing-file scenario and a corrupt-file scenario per tool and assert the error shape is identical in structure across all seven tools, not ad hoc per tool.
Structure the suite so that adding a new read-only MCP tool in the future requires only a single registration entry (e.g. one array/table of tool definitions), not duplicated per-tool assertion code.
This is a test-only addition: do not modify the production behavior of any individual MCP tool as part of this issue. If a tool fails one of the new contract assertions, file that as a separate bug-fix issue against the specific tool rather than patching it inline here.
New shared contract-test suite covering all seven read-only AMS MCP tools (status, portfolio, claims, event-ledger, governor-ledger, run-state, plan-store).
Secret-shaped-value assertion applied uniformly across all tools.
payload_json / excluded-raw-column assertion applied uniformly across all tools.
Consistent error-shape assertion for missing/corrupt local store, applied uniformly across all tools.
Suite structured so a new tool requires only a single registration point, not per-tool duplicate test code.
Any tool-specific defect discovered while writing the suite is filed as its own follow-up issue rather than silently fixed here.
Test Coverage Requirements
This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. Add: (1) unit tests covering the contract-suite harness's own success and failure paths (e.g. correctly failing when a tool violates a rule), (2) an invariant test asserting that none of the read-only AMS MCP tools ever returns a secret-shaped value, a payload_json/excluded raw column, or an inconsistent error shape when its backing local store is missing or corrupt, and (3) a "canary" regression test that deliberately feeds a tool response containing a secret-shaped string or an excluded column into the harness to prove the assertion actually catches it — this guards against the contract check silently regressing to a no-op.
Codecov visibility note:packages/gittensory-miner/**, apps/gittensory-miner-ui/**, and apps/gittensory-miner-extension/** currently sit entirely outside vitest's coverage.include glob, so codecov/patch cannot measure changes there yet — closing that gap is exactly what #4864 and #4865 (in this same milestone) do. Any part of this change under packages/gittensory-engine/src/** or the repo's own src/** remains fully Codecov-instrumented as usual. Either way, this does not lower the bar: treat the 100%-including-invariants-and-regression target above as the enforced house standard regardless of what Codecov can currently see, and it becomes gate-enforced for real once #4864/#4865 ship.
Expected Outcome
Once any new read-only MCP tool is added or an existing one is modified, one shared test suite automatically checks it against the safety invariants that matter (no secret leakage, no excluded raw columns, consistent error handling), instead of relying on each tool author to remember and re-implement these checks individually.
Context
The MCP-exposure batch adds a set of read-only MCP tools to AMS covering status, portfolio, claims, event-ledger, governor-ledger, run-state, and plan-store. gittensory-engine already has its own driver parity/contract suite (#4296) that enforces shared safety invariants across all coding-agent drivers, but nothing analogous exists for the MCP surface — each read-only tool would otherwise ship with only its own bespoke tests, with no shared enforcement that none of them leak secrets, expose excluded raw columns, or fail inconsistently.
Dependencies
Depends on the MCP-exposure batch landing first — specifically the MCP scaffold issue and the seven read-only tool issues (status, portfolio, claims, event-ledger, governor-ledger, run-state, plan-store) in this same batch. Do not start until at least those tools exist to test against; this issue adds a shared contract-test suite layered on top of them, it is not a substitute for each tool's own individual tests.
Requirements
packages/gittensory-miner/lib/mcp/__tests__/contract.test.jsor the package's existing test convention — parameterized over every registered read-only MCP tool.payload_jsonor any other explicitly-excluded raw column: read each tool's own exclusion list and assert none of those keys appear anywhere in the response, including nested objects.Deliverables / Acceptance Criteria
payload_json/ excluded-raw-column assertion applied uniformly across all tools.Test Coverage Requirements
This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. Add: (1) unit tests covering the contract-suite harness's own success and failure paths (e.g. correctly failing when a tool violates a rule), (2) an invariant test asserting that none of the read-only AMS MCP tools ever returns a secret-shaped value, a
payload_json/excluded raw column, or an inconsistent error shape when its backing local store is missing or corrupt, and (3) a "canary" regression test that deliberately feeds a tool response containing a secret-shaped string or an excluded column into the harness to prove the assertion actually catches it — this guards against the contract check silently regressing to a no-op.Codecov visibility note:
packages/gittensory-miner/**,apps/gittensory-miner-ui/**, andapps/gittensory-miner-extension/**currently sit entirely outside vitest'scoverage.includeglob, socodecov/patchcannot measure changes there yet — closing that gap is exactly what #4864 and #4865 (in this same milestone) do. Any part of this change underpackages/gittensory-engine/src/**or the repo's ownsrc/**remains fully Codecov-instrumented as usual. Either way, this does not lower the bar: treat the 100%-including-invariants-and-regression target above as the enforced house standard regardless of what Codecov can currently see, and it becomes gate-enforced for real once #4864/#4865 ship.Expected Outcome
Once any new read-only MCP tool is added or an existing one is modified, one shared test suite automatically checks it against the safety invariants that matter (no secret leakage, no excluded raw columns, consistent error handling), instead of relying on each tool author to remember and re-implement these checks individually.
Links & Resources
packages/gittensory-miner/lib/mcp/(MCP tool implementations)