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(core): preserve flow groups and landing measurements [R1,R2]
Corey Olson71f00d882ca3
diff --git a/docs/formats.md b/docs/formats.mdindex aa186f46..b5597c30 100644--- a/docs/formats.md+++ b/docs/formats.md@@ -429,7 +429,7 @@ The `event` table is a SQLite schema object governed by `SCHEMA_VERSION`; its ap| `claim` | builder | `leaseUntil`, `digest` || `renew` | builder | `leaseUntil`, `digest` || `release` | builder | — |-| `submit` | builder | `commit`, `tree`, `policyCommit`, engine-9 `criterionDigest`, engine-38 `submissionProof` |+| `submit` | builder | `commit`, `tree`, `policyCommit`, engine-9 `criterionDigest`, engine-38 `submissionProof`, optional `submissionSize` (the `FLOW_SIZE_ENGINE` leaf) || `reserve` | reviewer | `until` || `accept` | reviewer | `reason`, `commit`, engine-20 `implies`, engine-33 `review`, engine-68 `note` || `reject` | reviewer | `reason`, `commit`, engine-20 `implies`, engine-30 `cause`, engine-33 `review`, automatic-Rigor `causeDerivation` |@@ -496,6 +496,14 @@ An approval of proposed new wording uses that same record: `source` is the existMigration preserves event rows and adds only schema objects that are missing.+## Flow report and captured submission size++`stats` JSON exposes `flow.report` with `scope: "all-time"`, including when the older statistics are filtered with `--since` or `--window`. It reconstructs recorded lifecycle intervals rather than inferring old history from current item rows. Its seven disjoint stage keys are `ready`, `later`, `build`, `reviewWait`, `review`, `mergeWait` and `rework`. Initial open time outside the recorded focus milestone, behind an unverified dependency, or under an item/lane hold is `later`; otherwise it is `ready`. A claim starts `build`, submission starts `reviewWait`, a live reservation starts `review`, and acceptance starts `mergeWait`. Reservation expiry/release returns to `reviewWait`. Rejection, reopen, non-retained refreeze, escalation, build release or claim lapse starts `rework` until the next claim. A retained refreeze preserves the active build. Missing lifecycle boundaries remain explicitly unknown rather than becoming measured zeroes.++The report supplies per-item, per-lane, per-milestone and overall aggregates. An item can belong to several recorded milestones: `item.milestones` lists all active memberships, while `item.milestone` retains the latest active membership for compatibility. Membership in any focused milestone qualifies as focused. Each milestone aggregate includes its members once, and the overall aggregate counts the item once regardless of overlapping groups. `firstTry` counts known first-submission accept/reject decisions; later successful attempts cannot turn an initial rejection into first-try acceptance. `submissionsPerLanded` is unknown when its required history is missing. First-submission size buckets are `under100` (0–99), `100to300` (100–299), `300to800` (300–799), `800plus` (800 or more), and `unknown`.++A `submit` may carry `submissionSize: {base, head, lines, method}`. `base` is the exact accepted main commit used for comparison, `head` is the submitted commit (and must equal `commit`), `lines` is a nonnegative safe integer, and `method` is exactly `"added-plus-deleted-no-renames"`. The comparison is `git diff --numstat --no-renames <base> <head>`: added plus deleted lines across all changed files; binary `-` columns contribute zero. This is captured once at submission, not recomputed later against a moving trunk. Missing or invalid historical metadata belongs in the unknown size bucket. This optional move-envelope field is gated by the `FLOW_SIZE_ENGINE` leaf, whose numeric engine assignment is made at landing; older recorded moves retain their original envelope and replay semantics.+## Submit test selection`pullboard.json` may set `"itemSizeBudget"` to a positive whole number of changed lines; it defaults to 100. A successful submit whose diff against current main adds plus deletes more than twice that budget prints one note with the count and suggests splitting into a chain of smaller items. At or below twice the budget it prints no size note. This advice never blocks submission; the budget is read from accepted main.diff --git a/src/commands/stats.js b/src/commands/stats.jsindex 3dd56020..d824665f 100644--- a/src/commands/stats.js+++ b/src/commands/stats.js@@ -8,6 +8,7 @@ import * as gateReceipt from '../gate-receipt.js';import { readRunnerStage } from '../runner-stage-read.js';import {flowLines,+ flowReportLines,flowStats,} from '../stats-flow.js';import {@@ -57,7 +58,7 @@ export function run(io, { values }) {io.say(`events: ${stats.firstEventAt ?? 'none'} to ${stats.lastEventAt ?? 'none'}${stats.since ? ` (since ${stats.since})` : ''}`);for (const line of barStatsLines(stats.bars)) io.say(line);for (const line of caughtLines(stats.caught)) io.say(line);- for (const line of window ? flowWindowLines(window) : flowLines(stats.flow)) io.say(line);+ for (const line of window ? flowWindowLines(window) : [...flowLines(stats.flow), ...flowReportLines(stats.flow)]) io.say(line);if (window?.executionCapacity) {const waits = window.executionCapacity.slotWait;/** Keep absent window timing visibly unmeasured in the human-readable summary. */diff --git a/src/help.js b/src/help.jsindex d627754c..52404867 100644--- a/src/help.js+++ b/src/help.js@@ -200,6 +200,11 @@ Receiptsreleased/expired reservations remain wait, not review;review: closing reservation to verdict; merge wait: accept to first mergeunfinished stages are omitted; missing legacy reservations are unmeasured+ flow.report is all-time, even with --since or --window; its disjoint stages are+ ready, later, build, reviewWait, review, mergeWait and rework;+ initial focus/dependency/hold delays are later; returned work is rework until claim;+ firstTry measures acceptance of the first submission; size buckets use that submission:+ under 100, 100-299, 300-799, 800+ changed lines; missing history stays unknownJSON flow.asOf records one observation clock; oldest.since records its origin;ageMinutes = (asOf - since) / 60000 for every queue agequeues include all current work, even added before --since;diff --git a/src/proof-counter-read.js b/src/proof-counter-read.jsindex fd3401db..101c6d1d 100644--- a/src/proof-counter-read.js+++ b/src/proof-counter-read.js@@ -61,9 +61,10 @@ export function counterProofStats(board, boundary, now) {const creators = items.filter(item => item.creator !== undefined).map(item => ({ event_kind: 'add', item_id: item.id, event_by: item.creator }));const corrections = proofCounterRows(board, 'bar').map(row => decodedProofEvent({ ...row, event_kind: 'edit' }, row.detail));const verdicts = board.db.prepare('SELECT * FROM verdict ORDER BY verdict_id').all();- const flow = { reportPolicy: summary.reportVersion === 1 && summary.reportLast === summary.last ? proofCounter(board, 'report-policy') : null, items: items.filter(item => item.id !== null && item.id !== undefined).map(item => item.flow),+ const flow = { reportPolicy: summary.reportVersion === FLOW_REPORT_VERSION && summary.reportLast === summary.last ? proofCounter(board, 'report-policy') : null, items: items.filter(item => item.id !== null && item.id !== undefined).map(item => item.flow),actors: actors.filter(actor => actor.id !== 'clock').map(actor => actor.flow), dailyEvents: proofCounterRows(board, 'daily') };return { ...counts, agentCount: attributed.agents.length, familyCount: attributed.families.length, ...attributed,bars: barStats([...creators, ...corrections], verdicts, boundary), caught: counterCaught(board, boundary),flow: projectFlowStats(flow, boundary, now, counts) };}+import { FLOW_REPORT_VERSION } from './stats-flow-report.js';diff --git a/src/proof-counters.js b/src/proof-counters.jsindex 839a9c62..bcfe8884 100644--- a/src/proof-counters.js+++ b/src/proof-counters.js@@ -67,7 +67,7 @@ export function clearProofCounters(board) {/** Start a bounded all-time aggregate; window-specific contributions live in separate event shards. */function emptySummary() {return { last: 0, submissions: 0, rejections: 0, merged: 0, mergedWithoutAccept: 0,- firstEventAt: null, lastEventAt: null, invalid: false, reportVersion: 1, reportLast: 0 };+ firstEventAt: null, lastEventAt: null, invalid: false, reportVersion: FLOW_REPORT_VERSION, reportLast: 0 };}/** Advance an item's acceptance audit separately from its flow lifecycle, whose rules differ. */@@ -192,7 +192,7 @@ export function rebuildProofCounters(board) {export function ensureProofCounters(board) {ensureRigorCounters(board);const summary = proofCounter(board, 'summary');- if (!summary || summary.reportVersion !== 1 || summary.reportLast !== summary.last) { rebuildProofCounters(board); return; }+ if (!summary || summary.reportVersion !== FLOW_REPORT_VERSION || summary.reportLast !== summary.last) { rebuildProofCounters(board); return; }replayProofTail(board, summary.last);}@@ -202,3 +202,4 @@ export function currentProofCounters(board) {const last = board.db.prepare('SELECT coalesce(max(event_id),0) AS id FROM event').get().id;return summary && !summary.invalid && summary.last === last ? summary : null;}+import { FLOW_REPORT_VERSION } from './stats-flow-report.js';diff --git a/src/stats-flow-report.js b/src/stats-flow-report.jsindex 91e8e6e6..b8456c8b 100644--- a/src/stats-flow-report.js+++ b/src/stats-flow-report.js@@ -1,6 +1,7 @@/** Optional indexed flow-report accounting around the canonical lifecycle reducer [R1,R2]. */const STAGES = ['ready', 'later', 'build', 'reviewWait', 'review', 'mergeWait', 'rework'];const BUCKETS = ['under100', '100to300', '300to800', '800plus', 'unknown'];+export const FLOW_REPORT_VERSION = 2;/** Only lifecycle and recorded policy moves can change report accounting. */export function reportEvent(event, detail) {@@ -12,11 +13,17 @@ export function safeReportPolicy(policy) {for (const key of ['memberships', 'dependents', 'lanes', 'members', 'open']) {if (Object.getPrototypeOf(policy[key]) !== null) policy[key] = Object.assign(Object.create(null), policy[key]);}+ if (policy.membershipVersion !== 2) {+ for (const [id, names] of Object.entries(policy.memberships)) {+ if (!Array.isArray(names)) policy.memberships[id] = [names];+ }+ policy.membershipVersion = 2;+ }return policy;}/** Start policy facts reconstructed only from recorded events. */-export function newReportPolicy() { return safeReportPolicy({ focus: null, memberships: {}, heldLanes: [], verified: [], dependents: {}, lanes: {}, members: {}, open: {} }); }+export function newReportPolicy() { return safeReportPolicy({ membershipVersion: 2, focus: null, memberships: {}, heldLanes: [], verified: [], dependents: {}, lanes: {}, members: {}, open: {} }); }/** Allocate accounting without manufacturing an absent historical start. */function reportState() { return { totals: Object.fromEntries(STAGES.map(key => [key, 0])), known: false, missing: [], submissions: 0, first: null, deps: [], held: false }; }@@ -39,9 +46,9 @@ function stage(item, policy, at) {if (item.state === 'accepted') return 'mergeWait';if (item.state !== 'open') return null;if (report.returned) return 'rework';- const milestone = policy.memberships[item.id];+ const milestones = policy.memberships[item.id] ?? [];return report.held || policy.heldLanes.includes(item.lane) || report.deps.some(id => !policy.verified.includes(id)) ||- policy.focus && milestone !== policy.focus ? 'later' : 'ready';+ policy.focus && !milestones.includes(policy.focus) ? 'later' : 'ready';}/** Charge elapsed time, splitting recorded reservation and claim expiry boundaries exactly. */@@ -66,7 +73,7 @@ export function prepareReportMove(item, event, detail) {if (['accept', 'reject'].includes(event.event_kind) && detail.commit === item.commit && item.state === 'submitted') {if (!item.reserve || Number.isFinite(item.reserve.until) && item.reserve.until < Date.parse(event.event_at)) report.missing.push('review');}- if (event.event_kind === 'merged' && item.state !== 'accepted') report.missing.push('mergeWait');+ if (event.event_kind === 'merged' && item.state !== 'accepted' && !Number.isFinite(item.mergeAt)) report.missing.push('mergeWait');}/** Observe metadata alongside, rather than replacing, the existing lifecycle transition. */@@ -136,19 +143,44 @@ export function recordReportPolicy(policy, event, detail, item) {const matching = item?.commit && item.commit === detail.commit;if (kind === 'accept' && matching || kind === 'merged') { if (!policy.verified.includes(event.item_id)) policy.verified.push(event.item_id); }if (kind === 'reject' && matching || ['reopen', 'refreeze', 'escalate', 'lapse'].includes(kind) && !(kind === 'refreeze' && detail.retainedClaim)) policy.verified = policy.verified.filter(id => id !== event.item_id);- if (kind === 'milestone_add') for (const id of detail.items ?? []) policy.memberships[id] = detail.name;+ if (kind === 'milestone_add') for (const id of detail.items ?? []) addMembership(policy, id, detail.name);if (kind === 'milestone_items') {- for (const id of detail.add ?? []) policy.memberships[id] = detail.name;- for (const id of detail.remove ?? []) if (policy.memberships[id] === detail.name) delete policy.memberships[id];+ for (const id of detail.add ?? []) addMembership(policy, id, detail.name);+ for (const id of detail.remove ?? []) removeMembership(policy, id, detail.name);+ }+ if (kind === 'milestone_moved') {+ removeMembership(policy, event.item_id, detail.from);+ addMembership(policy, event.item_id, detail.to);}- if (kind === 'milestone_moved') policy.memberships[event.item_id] = detail.to;- if (kind === 'milestone_edit') for (const id of Object.keys(policy.memberships)) if (policy.memberships[id] === detail.before) policy.memberships[id] = detail.after;- if (kind === 'milestone_remove') for (const id of Object.keys(policy.memberships)) if (policy.memberships[id] === detail.name) delete policy.memberships[id];- if (kind.startsWith('milestone_')) {- policy.members = Object.create(null);- for (const [id, name] of Object.entries(policy.memberships)) { policy.members[name] ??= []; policy.members[name].push(Number(id)); }+ if (kind === 'milestone_edit' && detail.before !== detail.after) {+ for (const id of [...(policy.members[detail.before] ?? [])]) {+ const names = policy.memberships[id].map(name => name === detail.before ? detail.after : name);+ removeMembership(policy, id, detail.before);+ policy.memberships[id] = names;+ policy.members[detail.after] ??= [];+ if (!policy.members[detail.after].includes(id)) policy.members[detail.after].push(id);+ }}+ if (kind === 'milestone_remove') for (const id of [...(policy.members[detail.name] ?? [])]) removeMembership(policy, id, detail.name);+}+/** Append a real membership without losing other milestones or duplicating reverse indexes. */+function addMembership(policy, id, name) {+ const names = policy.memberships[id] ??= [];+ if (!names.includes(name)) names.push(name);+ policy.members[name] ??= [];+ if (!policy.members[name].includes(id)) policy.members[name].push(id);+}++/** Remove only the named membership; shipping one milestone retains all unrelated memberships. */+function removeMembership(policy, id, name) {+ const names = (policy.memberships[id] ?? []).filter(value => value !== name);+ if (names.length) policy.memberships[id] = names;+ else delete policy.memberships[id];+ if (policy.members[name]) {+ policy.members[name] = policy.members[name].filter(value => value !== id);+ if (!policy.members[name].length) delete policy.members[name];+ }}/** Summarize known first decisions without assigning unknown history a zero rate. */@@ -180,10 +212,15 @@ export function projectReport(items, policy, now) {if (!policy) return { available: false };policy = safeReportPolicy(structuredClone(policy));const rows = items.map(item => { const copy = structuredClone(item); advanceReport(copy, policy, now); return copy; });- /** Group using latest recorded membership and recorded item lanes, not current mutable rows. */+ /** Group recorded item lanes without consulting current mutable rows. */function groups(key, value) {return [...new Set(rows.map(value))].sort().map(name => ({ [key]: name, ...aggregate(rows.filter(row => value(row) === name)) }));}- return { scope: 'all-time', items: rows.map(row => ({ id: row.id, lane: row.lane, milestone: policy.memberships[row.id] ?? null, ...aggregate([row], true) })),- lanes: groups('lane', row => row.lane), milestones: groups('milestone', row => policy.memberships[row.id] ?? null), overall: aggregate(rows) };+ const milestoneNames = [...new Set(rows.flatMap(row => policy.memberships[row.id] ?? [null]))].sort();+ return { scope: 'all-time', items: rows.map(row => ({ id: row.id, lane: row.lane,+ milestone: policy.memberships[row.id]?.at(-1) ?? null, milestones: [...(policy.memberships[row.id] ?? [])], ...aggregate([row], true) })),+ lanes: groups('lane', row => row.lane),+ milestones: milestoneNames.map(name => ({ milestone: name, ...aggregate(rows.filter(row => name === null+ ? !policy.memberships[row.id]?.length : policy.memberships[row.id]?.includes(name))) })),+ overall: aggregate(rows) };}diff --git a/src/stats-flow.js b/src/stats-flow.jsindex 6624b2db..56fc3bf0 100644--- a/src/stats-flow.js+++ b/src/stats-flow.js@@ -309,6 +309,16 @@ export function flowLines(flow) {lines.push(`per day: ${flow.daily.map(row => `${row.date}: ${row.added} added, ${row.merged} merged`).join('; ') || 'none'}`);lines.push(`${number(flow.submitsPerMerged)} submissions per merged item`);lines.push(`active in the last hour: ${flow.activeAgents.total} agents · roles ${Object.entries(flow.activeAgents.roles).map(([role, count]) => `${role} ${count}`).join(', ')} · lanes ${Object.entries(flow.activeAgents.lanes).map(([lane, count]) => `${lane} ${count}`).join(', ') || 'none'}`);+ const bottleneck = flow.bottleneck;+ lines.push(`bottleneck: ${bottleneck.message}${bottleneck.share === null ? '' : ` (${number(bottleneck.share * 100)}%)`}${bottleneck.lowConfidence ? ' · low confidence' : ''}`);+ if (bottleneck.recommendation) lines.push(`next: ${bottleneck.recommendation}`);+ return lines;+}++/** Render the detailed report without changing the existing compact flow-summary contract. */+export function flowReportLines(flow) {+ const lines = [];+ const percent = value => value === null ? 'unmeasured' : `${number(value * 100)}%`;if (flow.report?.items) {lines.push('flow report (all-time): waiting for an agent; filed for later; building; review; landing; rework');const labels = { ready: 'waiting for an agent', later: 'filed for later', build: 'building', reviewWait: 'waiting for review', review: 'reviewing', mergeWait: 'waiting to land', rework: 'rework' };@@ -316,14 +326,11 @@ export function flowLines(flow) {for (const row of rows) {const name = kind === 'item' ? `#${row.id}` : row.lane ?? row.milestone ?? 'unknown';lines.push(`${kind} ${name}: ${Object.entries(row.stages).map(([key, value]) => `${labels[key]} ${duration(value.minutes)} (${value.unknown} unknown)`).join(' · ')}`);- lines.push(` first try ${number(row.firstTry.rate === null ? null : row.firstTry.rate * 100)}% (${row.firstTry.accepted}/${row.firstTry.decided}; ${row.firstTry.unknown} unknown); submissions per landed ${number(row.submissionsPerLanded)}`);- lines.push(` size buckets: ${Object.entries(row.sizeBuckets).map(([key, value]) => `${key} ${number(value.rate === null ? null : value.rate * 100)}% (${value.accepted}/${value.decided}; ${value.unknown} unknown)`).join(' · ')}`);+ lines.push(` first try ${percent(row.firstTry.rate)} (${row.firstTry.accepted}/${row.firstTry.decided}; ${row.firstTry.unknown} unknown); submissions per landed ${number(row.submissionsPerLanded)}`);+ lines.push(` size buckets: ${Object.entries(row.sizeBuckets).map(([key, value]) => `${key} ${percent(value.rate)} (${value.accepted}/${value.decided}; ${value.unknown} unknown)`).join(' · ')}`);}}} else lines.push('flow report: unavailable until the next writer rebuilds historical accounting');- const bottleneck = flow.bottleneck;- lines.push(`bottleneck: ${bottleneck.message}${bottleneck.share === null ? '' : ` (${number(bottleneck.share * 100)}%)`}${bottleneck.lowConfidence ? ' · low confidence' : ''}`);- if (bottleneck.recommendation) lines.push(`next: ${bottleneck.recommendation}`);return lines;}diff --git a/test/flow-report-cache.test.js b/test/flow-report-cache.test.jsindex e2cf0510..c7b9d728 100644--- a/test/flow-report-cache.test.js+++ b/test/flow-report-cache.test.js@@ -10,12 +10,13 @@ import { proofStats } from '../src/stats.js';import { flowStats } from '../src/stats-flow.js';import { ensureProofCounters } from '../src/proof-counters.js';import { runFixtureGit } from './fixture-child.js';+import { submitFixture } from './board-submit-fixture.js';/** Construct a native board whose append path maintains current report shards. */-function fixture(t, { item = true } = {}) {+function fixture(t, { item = true, now } = {}) {const root = mkdtempSync(join(tmpdir(), 'pullboard-report-cache-'));runFixtureGit(['init', '-q', '-b', 'main'], { cwd: root, stdio: 'pipe' });- const board = store.openBoard(join(root, '.git', 'board.sqlite'));+ const board = store.openBoard(join(root, '.git', 'board.sqlite'), { now });store.register(board, { lane: 'coordinator', path: root });if (item) store.addItem(board, { by: 'coordinator', lane: 'core', title: 'Known open history' });t.after(() => { store.closeBoard(board); rmSync(root, { recursive: true, force: true }); });@@ -129,3 +130,86 @@ test('an item fact after claim expiry cannot reclassify the preceding active buiassert.deepEqual(completed.stages.build, { minutes: 20, unknown: 0 });assert.deepEqual(completed.stages.rework, { minutes: 20, unknown: 0 });});+++test('cached flow retains every native milestone membership through edits removals and shipping [R1,R2]', t => {+ const base = Date.parse('2026-10-10T00:00:00Z');+ let minute = 0;+ const board = fixture(t, { now: () => new Date(base + minute * 60_000) });+ const who = { agentId: 'coordinator' };+ store.addMilestone(board, { ...who, name: 'A', items: [1] });+ store.addMilestone(board, { ...who, name: 'B', items: [1] });+ store.setLineSetting(board, { ...who, key: 'focusMilestone', value: 'A', reason: 'Private focus control', window: { items: 1 } });+ /** Compare the hot cached projection with canonical replay after each native policy transition. */+ const observe = () => {+ const now = base + minute * 60_000;+ const history = store.events(board);+ const stats = proofStats(board, { now });+ assert.deepEqual(stats.flow.report, flowStats(history, null, now, stats).report);+ assert.deepEqual(store.events(board), history, 'observation never changes native history');+ assert.equal(stats.flow.report.overall.firstTry.unknown, 1, 'multiple groups do not duplicate the overall item');+ return stats.flow.report;+ };+ minute = 10;+ let report = observe();+ assert.deepEqual(report.items[0].milestones, ['A', 'B']);+ assert.equal(report.items[0].milestone, 'B', 'the compatibility field keeps the latest recorded membership');+ assert.deepEqual(report.items[0].stages.ready, { minutes: 10, unknown: 0 });+ assert.deepEqual(report.items[0].stages.later, { minutes: 0, unknown: 0 }, 'membership in focus A survives later membership in B');+ assert.deepEqual(report.milestones.map(row => row.milestone), ['A', 'B']);+ store.editMilestoneItems(board, 'B', { ...who, remove: [1] });+ minute = 20;+ assert.deepEqual(observe().items[0].milestones, ['A']);+ store.editMilestoneItems(board, 'B', { ...who, add: [1] });+ minute = 30;+ store.editMilestone(board, 'B', { ...who, newName: 'C' });+ assert.deepEqual(observe().items[0].milestones, ['A', 'C']);+ minute = 40;+ store.shipMilestone(board, 'A', { ...who, commit: 'a'.repeat(40), next: 'C' });+ report = observe();+ assert.deepEqual(report.items[0].milestones, ['C'], 'shipping removes only its source membership and deduplicates the target');+ assert.equal(report.items[0].milestone, 'C');+ assert.deepEqual(report.milestones.map(row => row.milestone), ['C']);+ minute = 50;+ store.removeMilestone(board, 'C', who);+ assert.deepEqual(observe().items[0].milestones, []);+ minute = 60;+ store.addMilestone(board, { ...who, name: 'D', items: [1] });+ store.setLineSetting(board, { ...who, key: 'focusMilestone', value: 'D', reason: 'Private next focus', window: { items: 1 } });+ minute = 70;+ store.editMilestoneItems(board, 'D', { ...who, remove: [1] });+ minute = 80;+ report = observe();+ assert.deepEqual(report.items[0].stages.ready, { minutes: 50, unknown: 0 });+ assert.deepEqual(report.items[0].stages.later, { minutes: 30, unknown: 0 });+ assert.equal(report.items[0].milestone, null);+ assert.deepEqual(report.milestones.map(row => row.milestone), [null]);+});++test('repeated native landing receipts preserve the first measured landing interval [R1,R2]', t => {+ const base = Date.parse('2026-10-10T00:00:00Z');+ let minute = 0;+ const board = fixture(t, { now: () => new Date(base + minute * 60_000) });+ store.register(board, { lane: 'core', path: '/fixture/builder' });+ store.register(board, { lane: 'review', path: '/fixture/reviewer' });+ const digest = 'f'.repeat(64), commit = 'a'.repeat(40);+ minute = 1;+ store.claim(board, 1, { agentId: 'core-1', lane: 'core', leaseMs: 3_600_000,+ freeze: () => ({ text: '{"rows":[]}', digest }) });+ minute = 2;+ submitFixture(board, 1, { agentId: 'core-1', commit, tree: 'b'.repeat(40) });+ minute = 3;+ store.reserveReview(board, 1, { agentId: 'review-1', leaseMs: 3_600_000, policy: 'any' });+ minute = 4;+ store.verify(board, 1, { agentId: 'review-1', decision: 'ACCEPT', head: commit, digest, policy: 'any',+ note: 'Private native lifecycle fixture; no gate execution claimed.' });+ minute = 10;+ store.merged(board, 1, { agentId: 'coordinator', commit });+ const first = proofStats(board, { now: base + minute * 60_000 }).flow.report;+ assert.deepEqual(first.items[0].stages.mergeWait, { minutes: 6, unknown: 0 });+ minute = 20;+ store.merged(board, 1, { agentId: 'coordinator', commit });+ const repeated = proofStats(board, { now: base + minute * 60_000 }).flow.report;+ assert.deepEqual(repeated, first, 'another valid receipt cannot turn measured history into a gap or double its elapsed time');+ assert.deepEqual(repeated, flowStats(store.events(board), null, base + minute * 60_000, { submissions: 1, rejections: 0, rejectionShare: 0 }).report);+});diff --git a/test/flow-submit-size.test.js b/test/flow-submit-size.test.jsindex 54581539..14ca9292 100644--- a/test/flow-submit-size.test.js+++ b/test/flow-submit-size.test.js@@ -88,11 +88,12 @@ test('submission size replays identically and refuses unsupported or malformed mconst before = store.events(copies[2]);assert.throws(() => applyEngineMove(copies[2], { ...move, engine: FLOW_SIZE_ENGINE - 1 }, receipt), { code: 'RELAY_MOVE' });assert.deepEqual(store.events(copies[2]), before, 'unsupported metadata cannot partially change native history');- for (const change of [{ lines: -1 }, { lines: 0.5 }, { lines: null }, { lines: Number.MAX_SAFE_INTEGER + 1 },- { head: 'd'.repeat(40) }, { base: 'missing' }, { method: 'guess' }]) {+ for (const [index, change] of [{ lines: -1 }, { lines: 0.5 }, { lines: null }, { lines: Number.MAX_SAFE_INTEGER + 1 },+ { head: 'd'.repeat(40) }, { base: 'missing' }, { method: 'guess' }].entries()) {const forged = structuredClone(move);+ forged.id = `size-invalid-${index}`;Object.assign(forged.args[1].submissionSize, change);- assert.equal(applyRelayMove(copies[2], forged, receipt).error?.code, 'SUBMISSION_PROOF');+ assert.equal(applyRelayMove(copies[2], forged, { ...receipt, sequence: index + 1 }).error?.code, 'SUBMISSION_PROOF');assert.deepEqual(store.events(copies[2]), before);}const legacy = structuredClone(move);