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
refactor(submit): extract unchanged submission recording [V4,H16]
Corey Olsond2fead1a2981
diff --git a/src/board.js b/src/board.jsindex 7f67f1da..acdcb124 100644--- a/src/board.js+++ b/src/board.js@@ -1,3 +1,4 @@+import { submissionItemValues, recordSubmissionEvent } from './submission-record.js';import { companionPlan } from './companion.js';import { applyCompanionRequest } from './companion.js';export { readBoardMembers, setBoardMembers } from './board-members.js';@@ -1239,31 +1240,10 @@ export function submit(board, id, { agentId, commit, tree, files = [], policyCom},},before: () => { if (carry) logEvent(board, agentId, 'merge-only-accept', id, { ...mergeOnly, by: basis.by }); },- set: (found) => ({- item_built_by: agentId,- item_builder_family: board.db.prepare('SELECT agent_family FROM agent WHERE agent_id = ?').get(agentId)?.agent_family ?? null,- item_commit: commit,- item_tree: tree,- item_lease_until: null,- item_review_by: null,- item_review_until: null,- item_files: [...new Set([...(found.item_files ?? '').split('\n').filter(Boolean), ...files])].join('\n'),- ...(carry ? { item_verdict: 'ACCEPT', item_verified_by: basis.by } : {}),- }),- });- const engineVersion = board.executionEngineVersion ?? ENGINE_VERSION;- const criterionDigest = engineVersion >= 9 ? getItem(board, id).item_frozen_digest : null;- logEvent(board, agentId, 'submit', id, {- commit,- tree,- ...(policyCommit ? { policyCommit } : {}),- ...(criterionDigest ? { criterionDigest } : {}),- ...(note === undefined ? {} : { note: note.trim() }),- ...(recordedProof ? { submissionProof: recordedProof } : {}), ...(infra ? { infra } : {}),- ...(modern && gateGreen !== undefined ? { gateGreen: gateGreen === true } : {}),- ...(carry ? { mergeOnly } : {}),- ...(recordedSize ? { submissionSize: recordedSize } : {}),+ set: found => submissionItemValues(board, found, { agentId, commit, tree, files, carry, basis }),});+ recordSubmissionEvent(board, id, { agentId, commit, tree, policyCommit, note, recordedProof, infra,+ modern, gateGreen, carry, mergeOnly, recordedSize, engineVersion: board.executionEngineVersion ?? ENGINE_VERSION });});}diff --git a/src/submission-record.js b/src/submission-record.jsnew file mode 100644index 00000000..d0d042b3--- /dev/null+++ b/src/submission-record.js@@ -0,0 +1,34 @@+/** Record the existing submitted item fields and native event without changing transaction ownership [V4,H16]. */+import { getItem } from './board-query.js';+import { logEvent } from './board-event-log.js';++/** Build the original submit mutation at the same guarded point in its caller's transaction. */+export function submissionItemValues(board, found, { agentId, commit, tree, files, carry, basis }) {+ return {+ item_built_by: agentId,+ item_builder_family: board.db.prepare('SELECT agent_family FROM agent WHERE agent_id = ?').get(agentId)?.agent_family ?? null,+ item_commit: commit,+ item_tree: tree,+ item_lease_until: null,+ item_review_by: null,+ item_review_until: null,+ item_files: [...new Set([...(found.item_files ?? '').split('\n').filter(Boolean), ...files])].join('\n'),+ ...(carry ? { item_verdict: 'ACCEPT', item_verified_by: basis.by } : {}),+ };+}++/** Append the original submit payload after the guarded mutation, preserving legacy omissions and field order. */+export function recordSubmissionEvent(board, id, { agentId, commit, tree, policyCommit, note, recordedProof, infra, modern, gateGreen, carry, mergeOnly, recordedSize, engineVersion }) {+ const criterionDigest = engineVersion >= 9 ? getItem(board, id).item_frozen_digest : null;+ logEvent(board, agentId, 'submit', id, {+ commit,+ tree,+ ...(policyCommit ? { policyCommit } : {}),+ ...(criterionDigest ? { criterionDigest } : {}),+ ...(note === undefined ? {} : { note: note.trim() }),+ ...(recordedProof ? { submissionProof: recordedProof } : {}), ...(infra ? { infra } : {}),+ ...(modern && gateGreen !== undefined ? { gateGreen: gateGreen === true } : {}),+ ...(carry ? { mergeOnly } : {}),+ ...(recordedSize ? { submissionSize: recordedSize } : {}),+ });+}