Context
AMS's governor writes a decision log via packages/gittensory-miner/lib/governor-ledger.js recording ts, eventType, repoFullName, actionClass, decision, reason — plus a payload_json column that also lives in that table. There is no MCP-exposed read path into these governor decisions today. #5134's in-flight work is actively adding new state (reputation/self-plagiarism/budget-related data) into that same payload_json column, so this exposure work must exclude that column by construction rather than by convention or filtering.
Dependencies
Requires the AMS MCP server scaffold to exist first (same scaffold C06 depends on). This issue is NOT blocked on #5134 landing — it should ship independently — but because #5134 is concurrently changing what payload_json contains, the SQL projection must be written defensively (an explicit column allowlist), not filtered after the fact. Also distinct from #4851 (a governor pause/resume control/mutation surface, not a read tool) — no dependency in either direction.
Requirements
- Add a new MCP tool exposing
packages/gittensory-miner/lib/governor-ledger.js's decision log for read-only lookup.
- The underlying SQL query must use an explicit named-column SELECT —
ts, eventType, repoFullName, actionClass, decision, reason only — and must never use SELECT * or otherwise implicitly include payload_json or any other column.
- Add a dedicated test asserting the tool's response object contains no key named
payload_json, reputation, selfPlagiarism/self_plagiarism, or budget (nor any nested field under those names) — this test must fail if a future edit widens the SELECT.
- Support the same filtering the underlying ledger already supports (e.g. by repo, by decision, by time range) as tool parameters — do not invent new filter semantics beyond what
governor-ledger.js already supports.
- This PR must not modify
governor-ledger.js's write path and must not touch any governor decision-making/control-flow logic — it is exposition-only.
- The tool's MCP-facing description must state that the response is a decision-log projection and intentionally excludes internal/sensitive payload data.
Deliverables / Acceptance Criteria
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 new/changed logic's success and failure paths (valid filters, empty result set, missing/malformed input), (2) an invariant test asserting the MCP tool's response never contains a payload_json/reputation/self-plagiarism/budget-shaped field, even as #5134 changes what that column holds, and (3) no regression test is required since this is new functionality, not a bug fix.
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
Operators and MCP-connected agents can inspect the governor's recent allow/deny/defer decisions and reasons over MCP, with no risk of the sensitive payload column (which #5134 is actively expanding) leaking through this read surface.
Links & Resources
Context
AMS's governor writes a decision log via
packages/gittensory-miner/lib/governor-ledger.jsrecordingts,eventType,repoFullName,actionClass,decision,reason— plus apayload_jsoncolumn that also lives in that table. There is no MCP-exposed read path into these governor decisions today. #5134's in-flight work is actively adding new state (reputation/self-plagiarism/budget-related data) into that samepayload_jsoncolumn, so this exposure work must exclude that column by construction rather than by convention or filtering.Dependencies
Requires the AMS MCP server scaffold to exist first (same scaffold C06 depends on). This issue is NOT blocked on #5134 landing — it should ship independently — but because #5134 is concurrently changing what
payload_jsoncontains, the SQL projection must be written defensively (an explicit column allowlist), not filtered after the fact. Also distinct from #4851 (a governor pause/resume control/mutation surface, not a read tool) — no dependency in either direction.Requirements
packages/gittensory-miner/lib/governor-ledger.js's decision log for read-only lookup.ts, eventType, repoFullName, actionClass, decision, reasononly — and must never useSELECT *or otherwise implicitly includepayload_jsonor any other column.payload_json,reputation,selfPlagiarism/self_plagiarism, orbudget(nor any nested field under those names) — this test must fail if a future edit widens the SELECT.governor-ledger.jsalready supports.governor-ledger.js's write path and must not touch any governor decision-making/control-flow logic — it is exposition-only.Deliverables / Acceptance Criteria
payload_jsongovernor-ledger.js's existing query capabilitiesgovernor-ledger.js's write pathTest 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 new/changed logic's success and failure paths (valid filters, empty result set, missing/malformed input), (2) an invariant test asserting the MCP tool's response never contains a
payload_json/reputation/self-plagiarism/budget-shaped field, even as #5134 changes what that column holds, and (3) no regression test is required since this is new functionality, not a bug fix.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
Operators and MCP-connected agents can inspect the governor's recent allow/deny/defer decisions and reasons over MCP, with no risk of the sensitive payload column (which #5134 is actively expanding) leaking through this read surface.
Links & Resources
packages/gittensory-miner/lib/governor-ledger.jspayload_jsonstate additions — concurrent, not blocking)