Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
fix(gate): stats and check JSON shapes carry the gate receipt [C7,V10]
Corey Olson4047a26db5d2
diff --git a/docs/api.md b/docs/api.mdindex c4ea7a44..cbc76291 100644--- a/docs/api.md+++ b/docs/api.md@@ -36,7 +36,7 @@ For a stale acceptance, merge current main into the submitted work and commit a`pullboard stats [--since <date>] --json` returns `{version: 1, stats: {...}}` from the append-only event log. `submissions` and `rejections` count moves, including repeated attempts; `rejectionShare` is rejections divided by submissions (zero when the window has no submissions). `merged` counts distinct items with a merge move; `mergedWithoutAccept` counts those whose merge lacks an earlier acceptance of the latest submitted commit. That audit uses earlier history even when the acceptance falls before the selected window. Current item and verdict rows do not replace event evidence.-`stats.gateWaits` lists, for each kind of gated run in the last day (`check`, `review`, `doctrine`, `gate`, `landing`), its `runs`, `medianWaitMs`, `slowestWaitMs` and `medianRunMs`, read from the board's gate receipts; text `stats` prints them under `gate waits, last day:`. A gate receipt is written for every run that takes a gate slot. Its fields are `waitMs` (queued for a slot), `admissionMs` (deciding and queueing, then handing over), `setupMs`, `runMs` and `evidenceMs` (reading the result and writing its record), and `slot: {kind, reason}`, where `kind` is `ordinary`, `browser`, `short`, `runner` or `inherited`. A timing profile carries it as `receipt`, `check --json` returns it as `receipt`, and the timing lines print it as `phases: ...; slot: <kind> (<reason>)`. A doctrine hold at submit prints its own `doctrine hold phases:` line.+`gateWaits`, beside `stats`, lists, for each kind of gated run in the last day (`check`, `review`, `doctrine`, `gate`, `landing`), its `runs`, `medianWaitMs`, `slowestWaitMs` and `medianRunMs`, read from the board's gate receipts; text `stats` prints them under `gate waits, last day:`. A gate receipt is written for every run that takes a gate slot. Its fields are `waitMs` (queued for a slot), `admissionMs` (deciding and queueing, then handing over), `setupMs`, `runMs` and `evidenceMs` (reading the result and writing its record), and `slot: {kind, reason}`, where `kind` is `ordinary`, `browser`, `short`, `runner` or `inherited`. A timing profile carries it as `receipt`, `check --json` returns it as `receipt`, and the timing lines print it as `phases: ...; slot: <kind> (<reason>)`. A doctrine hold at submit prints its own `doctrine hold phases:` line.`stats.bars` counts bar corrections, keyed by agent: `{corrections, barRejects, buildRejects}`. A correction is an `edit --criterion` or `--check` on an item that was ever claimed. It must carry `--reason "what the old bar got wrong"` (HTTP `args.reason`); without one it is refused with `BAR_REASON`. A correction that follows the item's newest, unexplained reject marks that reject as caused by the bar, counted to the correcting agent; every other reject counts to the build, under the agent who added the item. Text `stats` prints one `bars:` line per agent, and text `show` prints each correction with its reason.diff --git a/src/json.js b/src/json.jsindex c525ab03..65f2a5e4 100644--- a/src/json.js+++ b/src/json.js@@ -39,7 +39,7 @@ export const JSON_SHAPES = {'milestone remove': shape({ milestone: 'object' }),'milestone ship': shape({ milestone: 'object', into: 'string|null', moved: 'array', notMoved: 'array' }),show: shape({ item_id: 'number', item_title: 'string', item_lane: 'string', item_status: 'string', verdicts: 'array', thread: 'array' }),- stats: shape({ stats: 'object' }),+ stats: shape({ stats: 'object', gateWaits: 'array' }),status: shape({ me: 'object', mine: 'array', stats: 'object', reviewQueue: 'object', unread: 'number', relay: 'object' }),doctor: shape({ problems: 'array' }),health: shape({ asOf: 'string', thresholds: 'object', stuck: 'array', waiting: 'array' }),@@ -62,7 +62,7 @@ export const JSON_SHAPES = {run: shape({ messages: 'array' }),sweep: shape({ messages: 'array' }),next: shape({ item: 'object', review: 'boolean', held: 'boolean', shared: 'array' }),- check: shape({ id: 'number', green: 'boolean', seconds: 'number', check: 'string', report: 'string' }),+ check: shape({ id: 'number', green: 'boolean', seconds: 'number', check: 'string', receipt: 'object', report: 'string' }),'check accept': shape({ id: 'number', digest: 'string', check: 'string' }),claim: shape({ id: 'number', renewed: 'boolean', leaseUntil: 'string', digest: 'string' }),hold: shape({ lane: 'string', held: 'boolean' }),diff --git a/test/stats-cli.test.js b/test/stats-cli.test.jsindex 90ed1108..43d74b47 100644--- a/test/stats-cli.test.js+++ b/test/stats-cli.test.js@@ -59,7 +59,7 @@ test('[R1,R2,A1] stats JSON is versioned, text states the same proof numbers andconst observed = Date.parse(json.data.stats.flow.asOf);assert.ok(observed >= observationBefore && observed <= Date.now(), 'the CLI records its own observation clock');const expected = proofStats(board, { now: observed });- assert.deepEqual(json.data, { version: 1, stats: expected });+ assert.deepEqual(json.data, { version: 1, stats: expected, gateWaits: [] }, 'a board with no gated runs reports no gate waits (#836)');assert.deepEqual([expected.submissions, expected.rejections, expected.rejectionShare, expected.merged, expected.mergedWithoutAccept], [2, 1, 0.5, 1, 0]);const text = await run(root, ['stats']);assert.equal(text.code, 0, text.stderr);@@ -72,6 +72,7 @@ test('[R1,R2,A1] stats JSON is versioned, text states the same proof numbers andassert.match(text.stdout, /build: average 0 min · median 0 min · 1 measured/u);assert.match(text.stdout, /review: average unmeasured · median unmeasured · 0 measured; 1 of 1 completed items unmeasured/u);assert.match(text.stdout, /not enough measured flow to name a bottleneck \(1 items completed since the beginning, none with every stage measured\)/u);+ assert.match(text.stdout, /gate waits, last day: no gated runs recorded/u);assert.deepEqual(store.events(board), before, 'reading statistics appends no move');});