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
feat(gate): propose escaped tests as submit invariants [C7,V4]
Corey Olsona0cf2e916cbe
diff --git a/docs/api.md b/docs/api.mdindex fd626f8b..6a4b87c0 100644--- a/docs/api.md+++ b/docs/api.md@@ -132,6 +132,8 @@ Each checkout is bound to the first agent session that writes there. The local G`status.reviewQueue` contains `pending`, `reviewing` (distinct agents with live review leases), `reserved`, `oldestSubmittedAt` and `ageMs`. Age starts at each outstanding item's latest submit event; reserving or renewing its review does not reset it. An empty queue has `oldestSubmittedAt: null` and `ageMs: 0`. Among unreserved submissions, `awaitingFirstReview` counts items with no release since their latest submission; `releasedWithoutVerdict` counts those released without a verdict. `releasedItems` lists `{item, releases, reason}` with the cumulative release count and latest reason for that submission. Historical releases without a reason show `reason not recorded`.+With `submitGate: "landing"`, `status.submitInvariantProposals` lists files that failed outside a recorded submit selection. Each proposal carries `file`, `escapes` (distinct tested merge commits), `runtimeMs`, `budgetMs: 60000`, `withinBudget`, `commits` and the participating `submissions`. Repeated escapes below budget come first. Unmeasured whole-file runtime is `null`, not a sum of test-case durations. A later whole-file diagnostic or full gate passing at the identical commit suppresses that escape; another commit or merely an equal Git tree does not. Submission events record versioned `submissionProof: { version: 1, files, full, deferred, reason }`, including the actual full-fallback reason. A deferred full fallback records only invariants actually selected to run, rather than its possible full selection. Historical submissions without this receipt remain unknown. Landing batches append versioned `invariantEvidence` with actual tested commits, participants and whole-file diagnostics; earlier evidence cannot be replaced. Status reads those canonical events and changes no configuration. Edit `submitInvariants` on main to accept a proposal. Outside the landing submit policy the proposal list is empty.+Releasing a reserved review requires a nonempty one-line `--note` (or `--note-file`); the authenticated release action accepts the same `note` field. A refusal keeps the reservation and records no release. The same reviewer is not offered that submission again until it is resubmitted or an hour passes, while other reviewers remain eligible. Releasing a build claim keeps its existing behavior and does not require a reason.When outstanding reviews reach `verify.reviewRatio` times the active reviewers (default 3, with zero reviewers counting as one), `next` first offers a review the agent may take. This creates no claim or reservation. Its additive v1 `offer` has the review's `item` id, exact `command` to reserve it, `queue` and `ratio`; `build` previews the otherwise available build or is `null`. `next --verify <id>` reserves explicitly. `next --build` claims explicitly; a fresh claim's event detail records `reviewSkipped` with the offered id (or `null`), ratio and queue snapshot. Renewing an existing claim creates no new skip.diff --git a/docs/lifecycle.md b/docs/lifecycle.mdindex b2af58f0..b210435c 100644--- a/docs/lifecycle.md+++ b/docs/lifecycle.md@@ -54,7 +54,7 @@ Each move checks its guards in this order and refuses with the first one that do| claim | open, claimed | claimed | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_CLAIMABLE), itemNotHeld (ITEM_HELD), inLane (WRONG_LANE), routeAllows (ROUTE), dependenciesVerified (BLOCKED), notHeldByAnother (HELD), correctionRefrozen (PENDING_REFREEZE), laneOpen (LANE_HELD), oneLiveClaim (ONE_CLAIM), rowsInForce (UNKNOWN_SPEC or A5_GRAMMAR_VERSION or NO_POLICY or BAD_CONFIG or SPEC_BEHIND_MAIN) || release | claimed | open | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), reviewReleaseExplained (NOTE_REQUIRED) || lapse | claimed | open | clock, when its lease runs out | none |-| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), correctionRefrozen (PENDING_REFREEZE), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), gateConfigured (NO_GATE), gateGreen (GATE_RED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) |+| submit | claimed | submitted | agent, coordinator | joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_YOURS), isHolder (NOT_YOURS), correctionRefrozen (PENDING_REFREEZE), criterionUnchanged (CRITERIA_CHANGED), treeClean (DIRTY), nothingUntracked (UNTRACKED), hasCommit (NO_COMMIT), withinLane (OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), gateConfigured (NO_GATE), gateGreen (GATE_RED or PIPEFAIL_UNAVAILABLE), treeStillDuringGate (MOVED_DURING_GATE), submissionProofValid (SUBMISSION_PROOF), childrenDone (CHILDREN_OPEN), headIsNew (HEAD_NOT_NEW) || reserve | submitted | submitted | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), roadmapReadable (MILESTONES_CORRUPT), itemExists (NO_ITEM), inState (NOT_SUBMITTED), reviewCooldownElapsed (REVIEW_COOLDOWN), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD) || accept | submitted | verified | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonIsMet (BAD_REASON), trunkMergeClean (MERGE_CONFLICT or MERGE_CHECK_FAILED or NO_POLICY or NO_TRUNK), noUnverifiedStack (STACKED_ON_UNVERIFIED), itemCheckGreen (CHECK_RED or CHECK_UNVERIFIED), proofNoted (PROOF_REQUIRED) || reject | submitted | open | agent, coordinator | coordinatorSaysAs (MAIN_IS_COORDINATOR), joined (NOT_JOINED), itemExists (NO_ITEM), inState (NOT_SUBMITTED), atSubmittedCommit (NOT_AT_COMMIT or OUTSIDE_LANE or NO_POLICY or BAD_CONFIG or GIT_GRAFTS), notBuilder (SELF_VERIFY), routeAllows (ROUTE), policyAllows (COORDINATOR_VERIFIES), familyAllows (O2_FAMILY_MATCH), reviewFree (REVIEW_HELD), criterionUnchanged (CRITERIA_CHANGED), reasonCoded (BAD_REASON), noteGiven (NOTE_REQUIRED) |@@ -143,6 +143,7 @@ Each move checks its guards in this order and refuses with the first one that do| REVIEW_COOLDOWN | the reviewer has not released this submission within the past hour, engine 5 or newer, only for the same reviewer and current submission | let another reviewer take it, or wait an hour or for a new submission || NOTE_REQUIRED | the move carries a note: what failed, what was tried, or why | --note "..." or --note-file <file> || ALREADY_MERGED | the item has no recorded merge receipt | a merged item cannot be reopened |+| SUBMISSION_PROOF | recorded test selection names literal project files and its full-fallback policy, engine 17 or later; absent legacy selection remains unknown | rerun submit with the current CLI || LANDING_FAILURE_REQUIRED | a verified item note names the failing test and landing merge commit | cite the recorded batch, or name the test and merge commit in a manual note || BAD_DECISION | a verdict is accept or reject | pullboard verify <id> accept, or reject --reason CODE --note "..." |diff --git a/src/board.js b/src/board.jsindex 025ae554..92f9a5bc 100644--- a/src/board.js+++ b/src/board.js@@ -15,6 +15,9 @@ import { COORDINATOR } from './config.js';import { ENGINE_VERSION, GUARDS, IN_STATE, MOVES, STATES, UNKNOWN_MOVE, effectiveGuards, storeTriggers } from './machine.js';import { Refused } from './refused.js';import { parseSpec } from './spec.js';+import { invariantEvidence } from './submit-invariants.js';+import { submissionProof } from './submit-invariants.js';+import { SUBMISSION_PROOF_ENGINE } from './submit-invariants.js';export const ACCEPT_REASON = 'CRITERION_MET';export const PERSON = 'person';@@ -1182,7 +1185,8 @@ export function release(board, id, agentId, note = '') {* @param {{ agentId: string, commit: string, tree: string, files?: string[], policyCommit?: string, note?: string }} at - `files`: what the* item's own commits changed since its claim; a rework adds to what the first attempt changed.*/-export function submit(board, id, { agentId, commit, tree, files = [], policyCommit = null, note }) {+export function submit(board, id, { agentId, commit, tree, files = [], policyCommit = null, note, submissionProof: proof }) {+ let recordedProof;if (note !== undefined && (typeof note !== 'string' || !note.trim() || /[\r\n\u2028\u2029]/u.test(note))) {throw new Refused('USAGE', 'a submission note, when present, is one nonempty line');}@@ -1204,6 +1208,10 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyComgateConfigured: null,gateGreen: null,treeStillDuringGate: null,+ submissionProofValid: () => {+ if ((board.executionEngineVersion ?? ENGINE_VERSION) >= SUBMISSION_PROOF_ENGINE) recordedProof = submissionProof(proof);+ return null;+ },childrenDone: () => {const { total } = board.db.prepare("SELECT COUNT(*) AS total FROM item WHERE item_parent_id = ? AND item_status IN ('open', 'claimed', 'submitted')")@@ -1241,6 +1249,7 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyCom...(policyCommit ? { policyCommit } : {}),...(criterionDigest ? { criterionDigest } : {}),...(note === undefined ? {} : { note: note.trim() }),+ ...(recordedProof ? { submissionProof: recordedProof } : {}),});});}@@ -2682,6 +2691,7 @@ export function landingBatches(board) {/** Append one coordinator-owned batch revision without changing the board schema [B3,R3]. */export function recordLandingBatch(board, { agentId, batch, revision = 0 }) {coordinatorOnly(agentId, 'records landing batches');+ const evidence = (board.executionEngineVersion ?? ENGINE_VERSION) >= SUBMISSION_PROOF_ENGINE ? invariantEvidence(batch?.invariantEvidence) : undefined;if (!batch || batch.version !== 1 || typeof batch.id !== 'string' || !/^[a-zA-Z0-9_-]{1,80}$/u.test(batch.id)|| !['merging', 'gating', 'bisecting', 'flaky', 'blocked', 'ready', 'pushed', 'landed'].includes(batch.state)|| !/^[a-f0-9]{40,64}$/u.test(batch.base ?? '') || !/^[a-f0-9]{40,64}$/u.test(batch.tip ?? '')@@ -2693,6 +2703,13 @@ export function recordLandingBatch(board, { agentId, batch, revision = 0 }) {}return atomic(board, () => {const previous = landingBatches(board).find((entry) => entry.id === batch.id);+ if (previous?.invariantEvidence && (board.executionEngineVersion ?? ENGINE_VERSION) >= SUBMISSION_PROOF_ENGINE) {+ for (const kind of ['gates', 'diagnostics']) {+ if (!evidence || JSON.stringify(evidence[kind].slice(0, previous.invariantEvidence[kind].length)) !== JSON.stringify(previous.invariantEvidence[kind])) {+ throw new Refused('LAND_EVIDENCE', 'recorded landing evidence is append-only; preserve earlier gate and diagnostic receipts when adopting');+ }+ }+ }if ((previous?.revision ?? 0) !== revision || previous?.state === 'landed') {throw new Refused('LAND_MOVED', 'the landing batch changed; read pullboard resume and adopt its current revision');}@@ -2700,6 +2717,8 @@ export function recordLandingBatch(board, { agentId, batch, revision = 0 }) {throw new Refused('LAND_BATCH', 'a batch keeps its original base and landing worktree; adopt it with pullboard land --adopt');}const recorded = { ...batch, revision: revision + 1, updatedAt: now(board) };+ delete recorded.invariantEvidence;+ if (evidence) recorded.invariantEvidence = evidence;logEvent(board, agentId, 'landing_batch', null, { batch: recorded });return recorded;});diff --git a/src/cli.js b/src/cli.jsindex 950ef125..4450f67c 100644--- a/src/cli.js+++ b/src/cli.js@@ -19,6 +19,8 @@ import { bindLocalSession, localSessionMatches } from './agent-session.js';import { decisionProjection, planRowApply, prepareRowDecisions, restoreRowApply, writeRowApply } from './row-decisions.js';import { digestOf, gateReport, runGate, runProfiledShell, runSubmitGate, submitGateReport, timingDigest, withGateSlot } from './gate.js';import { checkNeedsBrowser } from './browser-admission.js';+import { submitInvariantLine } from './submit-invariants.js';+import { submitInvariantProposals } from './submit-invariants.js';import { bareWorktreeFinding, codeIsFromMain, contains, differFromHead, git, gitChildEnv, headCommit, headTree, invalidateGitFacts, isClean, mainCheckout, patchId, repoInfo, resolveCommit, tryGit, untracked, withGitFacts } from './git.js';import {FIX_NOTE,@@ -2028,7 +2030,8 @@ function readCommands(io, { first, second, rest, values }) {const summary = withBoard(ctx, (board) => {const me = whoAmI(ctx, board);const mine = store.listItems(board).filter((item) => item.item_status === 'claimed' && item.item_owner === me.id);- return { me, mine, stats: store.stats(board), reviewQueue: { ...store.reviewQueue(board), ...store.reviewQueueBreakdown(board) }, unread: store.unreadCount(board, me.id), relay: relayStatus(ctx.info.root) };+ return { me, mine, stats: store.stats(board), reviewQueue: { ...store.reviewQueue(board), ...store.reviewQueueBreakdown(board) }, unread: store.unreadCount(board, me.id), relay: relayStatus(ctx.info.root),+ submitInvariantProposals: submitInvariantProposals(store.events(board), ctx.config) };});if (values.json) {io.result(summary);@@ -2041,6 +2044,7 @@ function readCommands(io, { first, second, rest, values }) {io.say(`board: ${items.open} open, ${items.claimed} claimed, ${items.submitted} awaiting verification, ${items.verified} verified, ${items.withdrawn} withdrawn`);io.say(`verdicts: ${accepted} accepted, ${rejected} rejected`);io.say(reviewQueueLine(ctx, summary.reviewQueue));+ for (const proposal of summary.submitInvariantProposals) io.say(submitInvariantLine(proposal));if (Object.keys(ctx.config.products).length) {const all = withBoard(ctx, (board) => store.listItems(board, { all: true }));productSummaries(ctx.config, loadSpec(ctx.info.root, ctx.config), all).forEach((product) => io.say(productLine(product)));@@ -2247,6 +2251,7 @@ async function submitHere(ctx, id) {await withBoard(ctx, async (board) => {refuseUnverifiedStack(root, board, store.getItem(board, id), commit, currentTrunk);return await ordered(ctx, board, 'submit', [id, { agentId: me.id, commit, tree: headTree(root) ?? '', files: filesSince(root, id, claimHead, commit), policyCommit: acceptedMain.commit,+ submissionProof: { version: 1, files: gate.files, full: gate.full, deferred: gate.deferred, reason: gate.reason },...(gate.deferred ? { note: 'full suite deferred to the landing gate' } : {}) }]);});return reportSubmission(ctx, id, commit, { green: gate.isGreen, report: submitGateReport(gate), files: gate.files, full: gate.full, deferred: gate.deferred, deferFullFallback: gate.deferFullFallback, reason: gate.reason, check: gate.check,diff --git a/src/engine.js b/src/engine.jsindex 4948b094..a3dbdb31 100644--- a/src/engine.js+++ b/src/engine.js@@ -6,6 +6,7 @@ import { ENGINE_VERSION } from './machine.js';import { Refused } from './refused.js';import { requestMoveProblem, recordRequestMove } from './relay-requests.js';import { relayMoveActor, relaySenderProblem, validRelaySender } from './relay-sender.js';+import { SUBMISSION_PROOF_ENGINE } from './submit-invariants.js';const ITEM_ID_FIRST_ARGUMENT = new Set(['editItem', 'escalate', 'recordAttempt', 'claim', 'release', 'submit', 'reserveReview', 'verify', 'merged', 'withdraw', 'refreeze', 'reopen', 'appendFact']);@@ -25,6 +26,8 @@ const OPERATION_ENGINE = Object.freeze({ reopen: 8, recordLandingBatch: 8, recor/** Dependency edits add engine-10 meaning without changing ordinary historical edit envelopes. */function minimumOperationEngine(operation, args) {const options = args[1];+ if (operation === 'submit' && options?.submissionProof !== undefined+ || operation === 'recordLandingBatch' && args[0]?.batch?.invariantEvidence !== undefined) return SUBMISSION_PROOF_ENGINE;return operation === 'editItem' && options && Object.hasOwn(options, 'after') && options.after !== undefined? 10 : OPERATION_ENGINE[operation] ?? 1;}diff --git a/src/land.js b/src/land.jsindex 03816629..6ea7e57b 100644--- a/src/land.js+++ b/src/land.js@@ -7,6 +7,7 @@ import { git, headCommit, headTree, isClean, mainCheckout, repoInfo, tryGit, untimport { runGate, runProfiledShell, withGateSlot } from './gate.js';import { laneOf } from './lanes.js';import { Refused } from './refused.js';+import { landingFileTimes } from './submit-invariants.js';/** Quote a command argument without allowing shell interpolation. */function quote(value) { return `'${String(value).replaceAll("'", "'\\''")}'`; }@@ -122,6 +123,7 @@ async function mergeGroup(state, items) {/** Run one full landing gate and retain its complete output under this batch's immutable phase path. */async function gateGroup(state, label) {const tree = headTree(state.batch.root);+ const commit = headCommit(state.batch.root);if (state.gates.has(tree)) return state.gates.get(tree);const directory = join(dirname(state.batch.root), 'logs');mkdirSync(directory, { recursive: true });@@ -130,9 +132,18 @@ async function gateGroup(state, label) {const gate = await runGate(state.batch.root, state.config, { trustStamp: false, landing: true, agent: 'coordinator', onWait: state.onWait });copyFileSync(gate.log, logPath);if (gate.profilePath) copyFileSync(gate.profilePath, `${logPath}.profile.json`);+ if (headCommit(state.batch.root) !== commit || headTree(state.batch.root) !== tree || !isClean(state.batch.root)) {+ throw new Refused('LAND_SOURCE_CHANGED', `the landing source changed while the gate ran; inspect ${logPath} and restore the recorded batch before adopting`);+ }const result = { ...gate, failures: landingFailures(gate.output, state.batch.root), tree, logPath };state.gates.set(tree, result);- await save(state, { gateResults: [...state.gates.values()].map(({ tree: testedTree, isGreen, failures, logPath: log }) => ({ tree: testedTree, isGreen, failures, logPath: log })) });+ const evidence = state.batch.invariantEvidence ?? { version: 1, gates: [], diagnostics: [] };+ const tested = { commit, isGreen: gate.isGreen,+ submissions: state.batch.items.map(({ id, commit }) => ({ id, commit })),+ failures: [...new Set(result.failures.map(failure => failure.file).filter(Boolean))],+ fileTimes: landingFileTimes(state.batch.root, gate.profile) };+ await save(state, { gateResults: [...state.gates.values()].map(({ tree: testedTree, isGreen, failures, logPath: log }) => ({ tree: testedTree, isGreen, failures, logPath: log })),+ invariantEvidence: { ...evidence, gates: [...evidence.gates, tested] } });return result;}@@ -145,11 +156,19 @@ async function diagnose(state, failures) {if (state.diagnosed.has(file)) { if (state.diagnosed.get(file)) flakes.push(file); continue; }const runner = state.config.affectedTests || (/\.[cm]?js$/u.test(file) ? 'node --test' : null);if (!runner) throw new Refused('LAND_DIAGNOSTIC', `no runner can isolate ${file}; configure affectedTests for the project’s test runner`);+ const commit = headCommit(state.batch.root);+ const tree = headTree(state.batch.root);const result = await withGateSlot(state.batch.root, (lease) => runProfiledShell(state.batch.root, `${runner} ${quote(file)}`, {waitMs: lease.waitMs, artifactDirectory: dirname(state.batch.logPath), artifactPrefix: 'diagnostic', persistLog: true, pipefail: true, gateLease: lease,}), { landing: true, browser: true, agent: 'coordinator', kind: 'land-diagnostic', onWait: state.onWait });+ if (headCommit(state.batch.root) !== commit || headTree(state.batch.root) !== tree || !isClean(state.batch.root)) {+ throw new Refused('LAND_SOURCE_CHANGED', `the landing source changed during its whole-file diagnostic; inspect ${result.logPath} before adopting`);+ }state.diagnosed.set(file, result.isGreen);- await save(state, { diagnostics: [...state.diagnosed].map(([test, isGreen]) => ({ test, isGreen })) });+ const evidence = state.batch.invariantEvidence ?? { version: 1, gates: [], diagnostics: [] };+ await save(state, { diagnostics: [...state.diagnosed].map(([test, isGreen]) => ({ test, isGreen })),+ invariantEvidence: { ...evidence, diagnostics: [...evidence.diagnostics,+ { test: file, isGreen: result.isGreen, commit, wallMs: result.profile?.wallMs ?? null }] } });if (result.isGreen) flakes.push(file);}return flakes;diff --git a/src/machine.js b/src/machine.jsindex 605bf80b..56eea2b6 100644--- a/src/machine.js+++ b/src/machine.js@@ -10,7 +10,7 @@*//** Executable move semantics, carried by every sealed move and retained during replay [H16]. */-export const ENGINE_VERSION = 12;+export const ENGINE_VERSION = 17;/** @typedef {'agent' | 'coordinator' | 'clock'} Role */@@ -138,6 +138,7 @@ export const GUARDS = [{ id: 'reviewCooldownElapsed', refuse: 'REVIEW_COOLDOWN', rule: 'the reviewer has not released this submission within the past hour', next: 'let another reviewer take it, or wait an hour or for a new submission', source: 'board', when: 'engine 5 or newer, only for the same reviewer and current submission' },{ id: 'noteGiven', refuse: 'NOTE_REQUIRED', rule: 'the move carries a note: what failed, what was tried, or why', next: '--note "..." or --note-file <file>', source: 'board' },{ id: 'notMerged', refuse: 'ALREADY_MERGED', rule: 'the item has no recorded merge receipt', next: 'a merged item cannot be reopened', source: 'board' },+ { id: 'submissionProofValid', refuse: 'SUBMISSION_PROOF', rule: 'recorded test selection names literal project files and its full-fallback policy', next: 'rerun submit with the current CLI', source: 'board', when: 'engine 17 or later; absent legacy selection remains unknown' },{ id: 'landingFailureRecorded', refuse: 'LANDING_FAILURE_REQUIRED', rule: 'a verified item note names the failing test and landing merge commit', next: 'cite the recorded batch, or name the test and merge commit in a manual note', source: 'board' },];@@ -155,7 +156,7 @@ export const MOVES = [{ verb: 'lapse', from: ['claimed'], to: 'open', by: ['clock'], guards: [], when: 'its lease runs out' },{verb: 'submit', from: ['claimed'], to: 'submitted', by: ['agent', 'coordinator'], refuse: 'NOT_YOURS',- guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'correctionRefrozen', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'noUnverifiedStack', 'gateConfigured', 'gateGreen', 'treeStillDuringGate', 'childrenDone', 'headIsNew'],+ guards: ['joined', 'itemExists', IN_STATE, 'isHolder', 'correctionRefrozen', 'criterionUnchanged', 'treeClean', 'nothingUntracked', 'hasCommit', 'withinLane', 'trunkMergeClean', 'noUnverifiedStack', 'gateConfigured', 'gateGreen', 'treeStillDuringGate', 'submissionProofValid', 'childrenDone', 'headIsNew'],sets: ['item_built_by', 'item_commit'], command: 'pullboard submit <id>',},{diff --git a/src/next-steps.js b/src/next-steps.jsindex d8afe8fe..abd25913 100644--- a/src/next-steps.js+++ b/src/next-steps.js@@ -140,6 +140,8 @@ export const NEXT_STEPS = Object.freeze({LANE_TAKEN: 'choose a different lane name with pullboard lane add',LAND_ADOPT: 'read pullboard resume, then run pullboard land --adopt, or pullboard land when nothing is unfinished',LAND_BATCH: 'adopt the recorded batch: pullboard land --adopt',+ LAND_EVIDENCE: 'preserve earlier gate and diagnostic evidence, then pullboard land --adopt',+ LAND_SOURCE_CHANGED: 'inspect the recorded landing logs and restore the batch source before pullboard land --adopt',LAND_DIAGNOSTIC: 'read the landing log the message names, and make the test reporter print file names',LAND_DIRTY: 'inspect the landing worktree, commit or remove its edits, then pullboard land --adopt',LAND_FLAKE: 'fix the flaky test, or ask the person for a waiver: pullboard land --waive <test> --until <date> --reason "why"',@@ -349,6 +351,7 @@ export const NEXT_STEPS = Object.freeze({SSH_KEY_NOT_FOUND: 'pass the key path: --key ~/.ssh/id_ed25519.pub',STACKED_ON_UNVERIFIED: 'wait for the earlier item to be accepted, or rebuild on main without its commits',STALE_ROW_DECISION: 'ask the person to approve the current row again in pullboard view',+ SUBMISSION_PROOF: 'rerun pullboard submit <id> with the current CLI so its selected files and fallback are recorded',TOKENS_NOT_AVAILABLE: 'manage agent tokens in pullboard view or the signed-in relay account',TOKEN_NOT_OWNED: 'name a token id from pullboard relay tokens',TOO_LARGE: 'open the file in your editor instead',diff --git a/src/submit-invariants.js b/src/submit-invariants.jsnew file mode 100644index 00000000..dba73531--- /dev/null+++ b/src/submit-invariants.js@@ -0,0 +1,125 @@+/** Read-only submit-invariant proposals from recorded selection and exact-commit evidence [C7,V4]. */+import { Refused } from './refused.js';+import { isAbsolute } from 'node:path';+import { relative } from 'node:path';++export const SUBMISSION_PROOF_ENGINE = 17;+const BUDGET_MS = 60_000;+const COMMIT = /^[a-f0-9]{40,64}$/u;++/** Accept only literal project-relative paths that can be displayed and configured safely. */+function projectFile(value) {+ return typeof value === 'string' && value.length > 0 && value.length <= 4096+ && !/[:\\\p{Cc}\p{Zl}\p{Zp}]/u.test(value)+ && value.split('/').every(part => part && part !== '.' && part !== '..');+}++/** Normalize a versioned selection receipt; absent legacy receipts remain unknown. */+export function submissionProof(value) {+ if (value === undefined) return undefined;+ if (!value || value.version !== 1 || typeof value.full !== 'boolean'+ || typeof value.deferred !== 'boolean' || typeof value.reason !== 'string'+ || value.reason.length > 8192 || !Array.isArray(value.files) || value.files.some(file => !projectFile(file))) {+ throw new Refused('SUBMISSION_PROOF', 'a submission proof needs its version, selected project files, full-fallback reason and deferred flag; rerun submit with the current CLI');+ }+ return { version: 1, files: [...new Set(value.files)].sort(), full: value.full,+ deferred: value.deferred, reason: value.reason };+}++/** Accept only measured finite nonnegative durations; unavailable is always null. */+function duration(value) { return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : null; }++/** Retain printed whole-file timings only; never sum case bodies into a file runtime. */+export function landingFileTimes(root, profile) {+ return (profile?.files ?? []).flatMap(file => {+ if (typeof file?.path !== 'string') return [];+ const path = (isAbsolute(file.path) ? relative(root, file.path) : file.path).replace(/^\.\//u, '');+ return projectFile(path) && duration(file.durationMs) !== null ? [{ path, durationMs: file.durationMs }] : [];+ });+}++/** Validate canonical landing evidence before a move can change the board. */+export function invariantEvidence(value) {+ if (value === undefined) return undefined;+ /** Raise a typed refusal before malformed evidence can reach the canonical event log. */+ const bad = () => { throw new Refused('LAND_EVIDENCE', 'landing invariant evidence needs exact commits, participating submissions and literal test files; rerun land with the current CLI'); };+ if (!value || value.version !== 1 || !Array.isArray(value.gates) || !Array.isArray(value.diagnostics)) bad();+ const gates = value.gates.map(gate => {+ if (!gate || !COMMIT.test(gate.commit ?? '') || typeof gate.isGreen !== 'boolean'+ || !Array.isArray(gate.submissions) || !Array.isArray(gate.failures) || !Array.isArray(gate.fileTimes)) bad();+ if (gate.submissions.some(row => !Number.isSafeInteger(row?.id) || row.id < 1 || !COMMIT.test(row.commit ?? ''))+ || gate.failures.some(file => !projectFile(file))+ || gate.fileTimes.some(row => !projectFile(row?.path) || row.durationMs !== null && duration(row.durationMs) === null)) bad();+ return { commit: gate.commit, isGreen: gate.isGreen,+ submissions: gate.submissions.map(row => ({ id: row.id, commit: row.commit })),+ failures: [...new Set(gate.failures)].sort(),+ fileTimes: gate.fileTimes.map(row => ({ path: row.path, durationMs: row.durationMs })) };+ });+ const diagnostics = value.diagnostics.map(row => {+ if (!row || !COMMIT.test(row.commit ?? '') || !projectFile(row.test) || typeof row.isGreen !== 'boolean'+ || row.wallMs !== null && duration(row.wallMs) === null) bad();+ return { commit: row.commit, test: row.test, isGreen: row.isGreen, wallMs: row.wallMs };+ });+ return { version: 1, gates, diagnostics };+}++/** Propose escaped files without inspecting mutable logs, inferring legacy coverage or editing config. */+export function submitInvariantProposals(events, config) {+ if (config.submitGate !== 'landing') return [];+ const selections = new Map();+ for (const event of events) {+ if (event.event_kind !== 'submit') continue;+ const detail = JSON.parse(event.event_detail);+ if (detail.submissionProof) selections.set(`${event.item_id}:${detail.commit}`, detail.submissionProof);+ }+ const gates = [];+ const diagnostics = [];+ const seen = new Set();+ for (const event of events) {+ if (event.event_kind !== 'landing_batch') continue;+ const { batch } = JSON.parse(event.event_detail);+ if (!batch?.invariantEvidence) continue;+ for (const [kind, target] of [['gates', gates], ['diagnostics', diagnostics]]) {+ batch.invariantEvidence[kind].forEach((row, index) => {+ const identity = `${batch.id}:${kind}:${index}`;+ if (seen.has(identity)) return;+ seen.add(identity);+ target.push({ ...row, order: event.event_id });+ });+ }+ }+ const proposals = new Map();+ for (const gate of gates) {+ if (gate.isGreen) continue;+ for (const file of gate.failures) {+ if ((config.submitInvariants ?? []).includes(file)) continue;+ if (gates.some(other => other.commit === gate.commit && other.isGreen && other.order >= gate.order)+ || diagnostics.some(row => row.commit === gate.commit && row.test === file && row.isGreen && row.order >= gate.order)) continue;+ const outside = gate.submissions.filter(row => {+ const proof = selections.get(`${row.id}:${row.commit}`);+ return proof && !(proof.full && !proof.deferred) && !proof.files.includes(file);+ });+ if (!outside.length) continue;+ const entry = proposals.get(file) ?? { file, merges: new Set(), runtimes: [], submissions: new Map() };+ entry.merges.add(gate.commit);+ for (const row of outside) entry.submissions.set(`${row.id}:${row.commit}`, row);+ for (const row of gate.fileTimes) if (row.path === file && duration(row.durationMs) !== null) entry.runtimes.push(row.durationMs);+ for (const row of diagnostics) if (row.commit === gate.commit && row.test === file && duration(row.wallMs) !== null) entry.runtimes.push(row.wallMs);+ proposals.set(file, entry);+ }+ }+ return [...proposals.values()].map(entry => {+ const runtimeMs = entry.runtimes.length ? Math.max(...entry.runtimes) : null;+ return { file: entry.file, escapes: entry.merges.size, runtimeMs, budgetMs: BUDGET_MS,+ withinBudget: runtimeMs === null ? null : runtimeMs < BUDGET_MS,+ commits: [...entry.merges].sort(), submissions: [...entry.submissions.values()].sort((a, b) => a.id - b.id || a.commit.localeCompare(b.commit)) };+ }).sort((a, b) => Number(b.escapes >= 2 && b.withinBudget === true) - Number(a.escapes >= 2 && a.withinBudget === true)+ || Number(b.withinBudget === true) - Number(a.withinBudget === true) || b.escapes - a.escapes || a.file.localeCompare(b.file));+}++/** Render a proposal with its measured budget and the explicit human-controlled next step. */+export function submitInvariantLine(proposal) {+ const runtime = proposal.runtimeMs === null ? 'unmeasured' : `${(proposal.runtimeMs / 1000).toFixed(2)} s`;+ const budget = proposal.withinBudget === null ? '' : proposal.withinBudget ? ' (within budget)' : ' (over budget)';+ return `submit invariant proposal: ${proposal.file}; ${proposal.escapes} escaped merge(s); runtime ${runtime} / 60 s${budget}; edit submitInvariants on main to accept`;+}diff --git a/test/land.test.js b/test/land.test.jsindex 6ebbbdb4..eece8cae 100644--- a/test/land.test.js+++ b/test/land.test.js@@ -520,6 +520,17 @@ test('land bisects a real red, skips named conflicts and refuses an unverified sassert.deepEqual(result.conflicts, dry.conflicts);assert.deepEqual(result.blocked, dry.blocked);assert.deepEqual(result.culprits.map((entry) => entry.id), [entries[2].item]);+ const evidence = result.batch.invariantEvidence;+ assert.equal(evidence.version, 1);+ const failedGate = evidence.gates.find(gate => !gate.isGreen);+ assert.match(failedGate.commit, /^[a-f0-9]{40}$/u, 'the actual gate records its tested commit, not only a tree');+ assert.ok(failedGate.submissions.some(row => row.id === entries[2].item && row.commit === entries[2].commit));+ assert.ok(failedGate.failures.includes(FILES[2]));+ const diagnosis = evidence.diagnostics.find(row => row.test === FILES[2]);+ assert.equal(diagnosis.commit, failedGate.commit, 'the whole-file diagnosis names the exact original merge');+ assert.equal(diagnosis.isGreen, false);+ assert.equal(typeof diagnosis.wallMs, 'number', 'runtime is the real queued diagnostic execution wall');+ assert.ok(diagnosis.wallMs >= 0);assert.equal(result.culprits[0].tests[0].file, FILES[2]);assert.match(result.culprits[0].tests[0].name, /keeps the landed behavior/u);assert.ok(json(box, box.repo, 'show', String(entries[2].item)).thread.some((entry) => entry.type === 'fact' && entry.text.includes(FILES[2])));diff --git a/test/machine.test.js b/test/machine.test.jsindex 985d8fc1..01515d53 100644--- a/test/machine.test.js+++ b/test/machine.test.js@@ -943,6 +943,8 @@ test('submit, accept and reject refuse in the declared order, one failure peeledsubmits.push(submitAs(piece, 'web-1', SHA_A));assert.equal(submits.at(-1), 'PENDING_REFREEZE', 'a pending correction stops the board submission before later guards');store.refreeze(board, piece, { agentId: 'web-1', freeze });+ submits.push(outcome(() => store.submit(board, piece, { agentId: 'web-1', commit: SHA_A, tree: 'tree',+ submissionProof: { version: 99, files: [], full: false, deferred: true, reason: '' } })));store.submit(board, piece, { agentId: 'web-1', commit: SHA_A, tree: 'tree' });verdictOn(board, piece, 'web-2', 'REJECT');store.claim(board, piece, { agentId: 'web-1', lane: 'web', leaseMs: 7_200_000, freeze });diff --git a/test/submit-invariants.test.js b/test/submit-invariants.test.jsnew file mode 100644index 00000000..a3fb582d--- /dev/null+++ b/test/submit-invariants.test.js@@ -0,0 +1,189 @@+/** Submission receipts distinguish actual selection from later landing escapes [C7,V4]. */+import assert from 'node:assert/strict';+import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';+import { join } from 'node:path';+import { after, test } from 'node:test';+import * as store from '../src/board.js';+import { applyEngineMove, applyRelayMove, prepareEngineMove } from '../src/engine.js';+import { exportBoard, importBoard } from '../src/exchange.js';+import { SUBMISSION_PROOF_ENGINE, landingFileTimes } from '../src/submit-invariants.js';+import { createE2eHelpers } from './e2e-helpers.js';++const e2e = createE2eHelpers();+after(e2e.cleanup);++/** Read a fixture's real board through its public interface. */+function onBoard(box, action) {+ const board = store.openBoard(join(box.repo, '.git/pullboard/board.sqlite'));+ try { return action(board); } finally { store.closeBoard(board); }+}++/** Run the real fixture CLI, preserving a refusal as an assertion failure. */+function json(box, root, ...args) {+ const result = box.run(root, ...args, '--json');+ assert.equal(result.code, 0, result.err + result.out);+ return JSON.parse(result.out);+}++/** Record synthetic landing history through the public operation, never direct database writes. */+function landing(box, id, submit, commit, files, diagnostics = [], green = false) {+ return onBoard(box, board => store.recordLandingBatch(board, {+ agentId: 'coordinator', batch: {+ version: 1, id, base: submit.policyCommit, tip: commit, root: join(box.dir, id),+ branch: 'refs/heads/main', owner: 'fixture', state: 'blocked', logPath: join(box.dir, id + '.log'),+ items: [{ id: submit.id, commit: submit.commit }],+ gateResults: [{ commit, tree: 'e'.repeat(40), isGreen: green,+ submissions: [{ id: submit.id, commit: submit.commit }],+ failures: green ? [] : files.map(file => ({ file: file.path, name: file.path + ' contract' })),+ fileTimes: files, logPath: join(box.dir, id + '.log') }],+ invariantEvidence: { version: 1, gates: [{ commit, isGreen: green,+ submissions: [{ id: submit.id, commit: submit.commit }],+ failures: green ? [] : files.map(file => file.path), fileTimes: files }], diagnostics },+ },+ }));+}++test('a landing escape is proposed as a submit invariant [C7,V4]', async () => {+ const box = e2e.project('node --test web/page.test.js');+ const configPath = join(box.repo, 'pullboard.json');+ const config = JSON.parse(readFileSync(configPath, 'utf8'));+ config.submitGate = 'landing';+ config.affectedTests = 'node --test';+ writeFileSync(configPath, JSON.stringify(config));+ writeFileSync(join(box.repo, 'package.json'), '{"type":"module"}\n');+ mkdirSync(join(box.repo, 'web'), { recursive: true });+ writeFileSync(join(box.repo, 'web/page.js'), 'export const page = 1;\n');+ writeFileSync(join(box.repo, 'web/page.test.js'), "import { test } from 'node:test';\nimport assert from 'node:assert/strict';\nimport { page } from './page.js';\ntest('page contract', () => assert.ok(page));\n");+ writeFileSync(join(box.repo, 'web/other.test.js'), "import { test } from 'node:test';\nimport assert from 'node:assert/strict';\ntest('unrelated contract', () => assert.ok(true));\n");+ box.git(box.repo, 'add', '-A');+ box.git(box.repo, 'commit', '-q', '-m', 'chore: configure private selection');+ box.git(box.web, 'merge', '-q', '--ff-only', 'main');+ const made = json(box, box.repo, 'add', 'web', 'change the page', '--specs', 'G1',+ '--criterion', 'The page remains present.', '--check', 'node --test web/page.test.js', '--wait');+ const id = made.item.item_id;+ json(box, box.web, 'claim', String(id));+ assert.equal(e2e.commitFile(box, box.web, 'web/page.js', 'export const page = 2;\n',+ 'feat(web): update page [G1]').status, 0);+ json(box, box.web, 'submit', String(id));+ const event = onBoard(box, board => store.events(board, { itemId: id }).findLast(row => row.event_kind === 'submit'));+ const submit = { id, ...JSON.parse(event.event_detail) };+ assert.ok(submit.submissionProof, 'the actual submit event retains the selected files instead of relying on its human note');+ assert.equal(submit.submissionProof.full, false);+ assert.deepEqual(submit.submissionProof.files, ['web/page.test.js']);+ assert.equal(submit.submissionProof.reason, '');+ assert.equal(submit.submissionProof.deferred, true);+ assert.equal(submit.submissionProof.version, 1);++ const first = 'a'.repeat(40);+ const second = 'b'.repeat(40);+ const third = 'c'.repeat(40);+ landing(box, 'first-escape', submit, first, [+ { path: 'test/repeated.test.js', durationMs: 4000 },+ { path: 'test/once.test.js', durationMs: 1000 },+ { path: 'test/slow.test.js', durationMs: 70000 },+ { path: 'web/page.test.js', durationMs: 12 },+ { path: 'test/recovered.test.js', durationMs: 50 },+ { path: 'test/other-commit.test.js', durationMs: 75 },+ { path: 'test/unknown.test.js', durationMs: null },+ ], [+ { test: 'test/recovered.test.js', isGreen: true, commit: first, wallMs: 52 },+ { test: 'test/other-commit.test.js', isGreen: true, commit: second, wallMs: 76 },+ ]);+ landing(box, 'second-escape', submit, second, [+ { path: 'test/repeated.test.js', durationMs: 4500 },+ { path: 'test/slow.test.js', durationMs: 80000 },+ ]);+ // A second receipt of the same merge is evidence custody, not another escaped merge.+ landing(box, 'duplicate-receipt', submit, second, [{ path: 'test/repeated.test.js', durationMs: 4500 }]);+ const untouchedConfig = readFileSync(configPath, 'utf8');+ const proposals = json(box, box.repo, 'status').submitInvariantProposals;+ assert.equal(proposals[0].file, 'test/repeated.test.js', 'a repeated escape below budget is first');+ const byFile = new Map(proposals.map(proposal => [proposal.file, proposal]));+ assert.equal(byFile.get('test/repeated.test.js').escapes, 2);+ assert.equal(byFile.get('test/repeated.test.js').runtimeMs, 4500);+ assert.equal(byFile.get('test/repeated.test.js').budgetMs, 60000);+ assert.equal(byFile.get('test/repeated.test.js').withinBudget, true);+ assert.equal(byFile.get('test/slow.test.js').withinBudget, false);+ assert.equal(byFile.get('test/unknown.test.js').runtimeMs, null, 'unmeasured is not zero');+ assert.equal(byFile.get('test/unknown.test.js').withinBudget, null);+ assert.ok(byFile.has('test/other-commit.test.js'), 'green on a different commit cannot erase the escape');+ assert.equal(byFile.has('test/recovered.test.js'), false, 'whole-file green at the exact merge suppresses it');+ assert.equal(byFile.has('web/page.test.js'), false, 'a selected file did not escape selection');+ const human = box.run(box.repo, 'status');+ assert.equal(human.code, 0, human.err);+ assert.match(human.out, /submit invariant/u);+ assert.match(human.out, /test\/repeated\.test\.js/u);+ assert.match(human.out, /60\s*s/u);+ assert.match(human.out, /unmeasured/u);+ assert.equal(readFileSync(configPath, 'utf8'), untouchedConfig, 'status never auto-edits configuration');++ // Historical submits with no selection remain unknown, even if their human note mentions a fallback.+ onBoard(box, board => {+ const legacy = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'legacy submit' });+ store.claim(board, legacy, { agentId: 'web-1', lane: 'web', leaseMs: 3600000,+ freeze: () => ({ text: '{"rows":[]}', digest: 'f'.repeat(64) }) });+ store.submit(board, legacy, { agentId: 'web-1', commit: 'd'.repeat(40), tree: 'e'.repeat(40), note: 'full suite deferred to the landing gate' });+ submit.legacy = legacy;+ });+ landing(box, 'legacy-unknown', { id: submit.legacy, commit: 'd'.repeat(40), policyCommit: submit.policyCommit }, third,+ [{ path: 'test/legacy.test.js', durationMs: 1 }]);+ assert.equal(json(box, box.repo, 'status').submitInvariantProposals.some(row => row.file === 'test/legacy.test.js'), false);++ const fallbackItem = json(box, box.repo, 'add', 'web', 'change a non-module input', '--specs', 'G1',+ '--criterion', 'Non-module selection is recorded.', '--check', 'node --test web/page.test.js', '--wait').item.item_id;+ const fallbackTree = join(box.dir, 'web-fallback');+ box.git(box.repo, 'worktree', 'add', '-q', '-b', 'web/fallback', fallbackTree, 'main');+ json(box, fallbackTree, 'join', 'web');+ json(box, fallbackTree, 'claim', String(fallbackItem));+ assert.equal(e2e.commitFile(box, fallbackTree, 'web/style.css', 'body { color: red; }\n', 'feat(web): change non-module input [G1]').status, 0);+ json(box, fallbackTree, 'submit', String(fallbackItem));+ const fallback = onBoard(box, board => store.events(board, { itemId: fallbackItem }).findLast(row => row.event_kind === 'submit'));+ const fallbackProof = JSON.parse(fallback.event_detail).submissionProof;+ assert.equal(fallbackProof.full, true);+ assert.equal(fallbackProof.deferred, true);+ assert.deepEqual(fallbackProof.files, [], 'a deferred full fallback did not run its possible selection');+ assert.match(fallbackProof.reason, /style\.css/u, 'the actual full-fallback reason remains durable');++ delete config.submitGate;+ writeFileSync(configPath, JSON.stringify(config));+ assert.deepEqual(json(box, box.repo, 'status').submitInvariantProposals, [], 'feature is off outside landing submit policy');+});++test('submission selection replays on two replicas and legacy history remains unknown [C7,V4,H16]', t => {+ const box = e2e.sandbox();+ const source = store.openBoard(join(box.dir, 'source.sqlite'));+ const copies = [];+ t.after(() => { for (const board of [source, ...copies]) store.closeBoard(board); });+ store.register(source, { lane: 'coordinator', path: '/fixture/main' });+ store.register(source, { lane: 'web', path: '/fixture/web' });+ const id = store.addItem(source, { by: 'coordinator', lane: 'web', title: 'selection replica' });+ store.claim(source, id, { agentId: 'web-1', lane: 'web', leaseMs: 3600000,+ freeze: () => ({ text: '{"rows":[]}', digest: 'f'.repeat(64) }) });+ const document = exportBoard(source);+ for (let index = 0; index < 4; index += 1) {+ const board = store.openBoard(join(box.dir, `replica-${index}.sqlite`));+ importBoard(board, document); copies.push(board);+ }+ const options = { agentId: 'web-1', commit: 'a'.repeat(40), tree: 'b'.repeat(40),+ submissionProof: { version: 1, files: ['test/a.test.js'], full: false, deferred: true, reason: '' } };+ const move = prepareEngineMove(source, 'submit', [id, options], { id: 'selection-replay', actor: 'web-1' });+ const receipt = { sequence: 1, at: '2026-10-17T00:00:00.000Z', kind: 'move',+ sender: { kind: 'agent', userId: 'fixture', agent: 'web-1' } };+ const first = applyRelayMove(copies[0], move, receipt);+ assert.equal(first.error, undefined);+ assert.deepEqual(applyRelayMove(copies[1], move, receipt), first);+ assert.deepEqual(store.events(copies[0]), store.events(copies[1]));+ assert.throws(() => applyEngineMove(copies[2], { ...move, engine: SUBMISSION_PROOF_ENGINE - 1 }, receipt), { code: 'RELAY_MOVE' });+ assert.equal(store.getItem(copies[2], id).item_status, 'claimed');+ const legacy = structuredClone(move);+ legacy.engine = 12;+ delete legacy.args[1].submissionProof;+ const old = applyRelayMove(copies[3], legacy, receipt);+ assert.equal(old.error, undefined);+ const last = store.events(copies[3]).findLast(event => event.event_kind === 'submit');+ assert.equal(Object.hasOwn(JSON.parse(last.event_detail), 'submissionProof'), false);+ assert.deepEqual(landingFileTimes('/fixture', { files: [], tests: [{ file: 'test/a.test.js', durationMs: 8 }] }), [],+ 'case-body duration is not a measured file duration');+ assert.deepEqual(landingFileTimes('/fixture', { files: [{ path: '/fixture/test/a.test.js', durationMs: 8 }, { path: '/elsewhere/private.js', durationMs: 1 }] }),+ [{ path: 'test/a.test.js', durationMs: 8 }], 'reported file timings are relative and cannot escape the project');+});