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
test(submit): compose prior size behavior for repair [V4,C7]
Corey Olsond2f4181dde92
diff --git a/src/commands/submit.js b/src/commands/submit.jsindex ac0c7683..85a99449 100644--- a/src/commands/submit.js+++ b/src/commands/submit.js@@ -57,6 +57,10 @@ import * as seatCheckout from '../seat-checkout.js';import {submitPreflight,} from '../submit-preflight.js';+import {+ changedLines,+ oversizeNote,+} from '../submit-size.js';import {dependencySnapshots,frozenCheck,@@ -211,6 +215,9 @@ export async function submitHere(ctx, id, infra) {submissionProof: { version: 1, files: gate.files, full: gate.full, deferred: gate.deferred, reason: gate.reason, ...(gate.deferredFiles ? { deferredFiles: gate.deferredFiles } : {}) },...(gate.deferred ? { note: gate.deferredFiles ? deferredSelectionNote(gate.deferredFiles) : 'full suite deferred to the landing gate' } : {}) }]);});+ // A large submit still goes through; the note only suggests a chain of smaller items (#1162).+ const sizeNote = oversizeNote(changedLines(root, acceptedMain.commit, commit));+ if (sizeNote) ctx.io.say(`note: ${sizeNote}`);const report = waived? `submission proof waived, not green: ${waived.length} failure(s), each covered by a live person waiver; the whole output is in ${gate.log}\n${waivedLines.join('\n')}`: submitGateReport(gate);diff --git a/src/submit-size.js b/src/submit-size.jsnew file mode 100644index 00000000..c7966498--- /dev/null+++ b/src/submit-size.js@@ -0,0 +1,34 @@+/** The changed-line count of a submit against main, and the split note an oversized one prints [V4,C7]. */+import { tryGit } from './git.js';++/** The item size budget in changed lines (added plus deleted) against main; the note appears above twice it. */+export const ITEM_SIZE_BUDGET = 100;++/**+ * Count the changed lines (added plus deleted) between two commits. A binary file reports `-`, so it counts none.+ *+ * @param {string} root the checkout git runs in+ * @param {string} base the trunk commit the submit is compared with+ * @param {string} head the commit being submitted+ * @returns {number | null} null when git cannot compare the two commits+ */+export function changedLines(root, base, head) {+ const result = tryGit(root, ['diff', '--numstat', '--no-renames', base, head]);+ if (result.status !== 0) return null;+ return result.stdout.split('\n').filter(Boolean).reduce((total, line) => {+ const [added, deleted] = line.split('\t');+ return total + (Number(added) || 0) + (Number(deleted) || 0);+ }, 0);+}++/**+ * The one split note for a submit over twice the item budget, or null. It suggests a chain and never blocks,+ * because the submit goes through as usual.+ *+ * @param {number | null} lines the changed-line count from changedLines+ * @returns {string | null}+ */+export function oversizeNote(lines) {+ if (lines === null || lines <= 2 * ITEM_SIZE_BUDGET) return null;+ return `this submit changes ${lines} lines against main, over twice the ${ITEM_SIZE_BUDGET}-line item budget; consider splitting it into a chain of smaller items. The submit went through as usual.`;+}diff --git a/test/submit-size.test.js b/test/submit-size.test.jsindex bc006afd..6d8b0b39 100644--- a/test/submit-size.test.js+++ b/test/submit-size.test.js@@ -42,7 +42,7 @@ process.exit(fs.existsSync('web/big.txt') ? 0 : 1);test('a submit far over the size budget prints a split suggestion and still submits [V4,C7]', { timeout: 180_000 }, t => { // budget: six real Git/SQLite submissions prove configurable boundaries.const helpers = createE2eHelpers();t.after(helpers.cleanup);- for (const [lines, budget, expected] of [[250, undefined, true], [200, undefined, false], [100, 50, false], [101, 50, true], [250, 200, false], [401, 200, true]]) {+ for (const [lines, budget, expected] of [[101, 50, true], [250, undefined, true], [200, undefined, false], [100, 50, false], [250, 200, false], [401, 200, true]]) {const output = submitSized(helpers, lines, budget);const notes = output.match(/[^\n]*consider splitting[^\n]*/gu) ?? [];assert.equal(notes.length, expected ? 1 : 0, `${lines} changed lines with budget ${budget ?? 100}: ${output}`);