Skip to content

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.

feat(rigor): read the growth budget from pullboard.json [D1,D3]

Corey Olsoncd2db97ac2ca
diff --git a/docs/formats.md b/docs/formats.md
index fabf5b1e..d7c3b3e8 100644
--- a/docs/formats.md
+++ b/docs/formats.md
@@ -170,6 +170,8 @@ Engine 56 (`BOARD_SENTINEL_ENGINE`) adds board-owned watch proposals, exact pers
The board's committed `flakes.rerun` setting defaults off. Off retains released execution, including landing's whole-file diagnosis and first legacy `landing_flake`; the new ledger still records the original failure. On permits one exact-target diagnostic for a supported structured Node test at unchanged source, never green-by-retry. Built-in `node --test` is supported; a `bin/run-tests.js` script is recognized only when its committed bytes on candidate and pinned main match the bundled Native runner. Its filename alone does not establish selector support, and a probe that executes other targets remains unclassified. A pinned green main marks a possible regression, not a flake. Unknown selectors, source changes or unsupported remote execution evidence remain unclassified; no local substitute is run for a remote admission. A confirmed second sighting drafts an ordinary strong repair item, not an approved spec or doctrine row. A landed repair reads fixed until another sighting. Enabled landing consumes its captured pair without another legacy diagnosis or first-sighting legacy defect; saved typed relationships prevent remeasurement on adoption. Diagnostic-recording failures are reported while the original red and completed evidence remain retained. Older engines refuse the new operation and typed landing relationships before changing rows or the replay cursor; legacy `landing_flake` meaning and the schema/event-log versions are unchanged.
+The board's committed `rigor.budget` setting is the number of lines of non-test code one change may add, net, before `pullboard rigor quality` names it under its size-budget rule; it defaults to 400, and `--budget` overrides it for one run.
+
Engine 60 (`SUBMITTED_CONFLICT_ENGINE`) lets a conflict reopen return a submitted head, not only an accepted one, and lets any joined seat record it. Before it offers a review, `pullboard next --verify` merges every submitted head onto the trunk in memory, as landing does; a head that conflicts goes back to its builder, open and unreviewed, with Git's conflicting files and the trunk commit, and its builder is told which files and that the one step back is to claim it, merge main and submit again. The reopen sets no accept aside and records no verdict; its next review is a whole one. A hand-written `--conflict` on a submission, which names no trunk commit, is still refused. Engines 57 to 59 are allocated to other changes; older engines refuse this move before replay.
Engine 61 (`NATIVE_FLAKE_ENGINE`) adds `recordFlakeObservation` and typed diagnostic relationships in landing-batch receipts. A registered reporting agent supplies a bounded observation: stable id, relative test file/name (or null when unknown), pinned head/tree/main, gate kind, classification, observation time, machine-load sample, diagnostic duration, command digest, and original/paired/main receipt references. A receipt contains its result, byte count, SHA-256 and optional profile digest; full raw output and profiles stay under the common Git directory's `pullboard/flake-evidence/<id>/`, outside board events. Those local artifacts are not automatically copied to another device by a board snapshot. A duplicate observation id returns the original receipt; different evidence under that id is refused. The original red remains authoritative.
diff --git a/src/config.js b/src/config.js
index 0107ac38..9342dab7 100644
--- a/src/config.js
+++ b/src/config.js
@@ -167,6 +167,9 @@ export function configProblems(config) {
if (config.flakes !== undefined && (!config.flakes || typeof config.flakes !== 'object' || Array.isArray(config.flakes)
|| config.flakes.rerun !== undefined && typeof config.flakes.rerun !== 'boolean'
|| Object.keys(config.flakes).some(key => key !== 'rerun'))) problems.push('"flakes" has only the optional boolean "rerun", off by default');
+ if (config.rigor !== undefined && (!config.rigor || typeof config.rigor !== 'object' || Array.isArray(config.rigor)
+ || config.rigor.budget !== undefined && (!Number.isSafeInteger(config.rigor.budget) || config.rigor.budget < 0)
+ || Object.keys(config.rigor).some(key => key !== 'budget'))) problems.push('"rigor" has only the optional whole number "budget", the lines of non-test code one change may add; 400 by default');
if (!['inside', 'beside'].includes(config.worktrees)) problems.push('"worktrees" is "inside" or "beside"');
if (config.submitGate !== undefined && config.submitGate !== 'landing') {
problems.push('"submitGate" is "landing" when the full suite should be deferred until landing');
diff --git a/src/rigor-quality-draft.js b/src/rigor-quality-draft.js
index 24cf59e0..582ba1f2 100644
--- a/src/rigor-quality-draft.js
+++ b/src/rigor-quality-draft.js
@@ -71,7 +71,8 @@ export function qualityCommand(root, key) {
*/
export function rigorQualityCommand(io, { values }, { root, config }) {
const rules = values.rule ? String(values.rule).split(',').map((key) => key.trim()).filter(Boolean) : undefined;
- const budget = values.budget === undefined ? GROWTH_BUDGET : Number(values.budget);
+ // A flag wins over the board's committed rigor.budget setting, which wins over the default.
+ const budget = values.budget === undefined ? config.rigor?.budget ?? GROWTH_BUDGET : Number(values.budget);
if (!Number.isSafeInteger(budget) || budget < 0) throw new Refused('USAGE', `--budget takes a whole number of lines, such as ${GROWTH_BUDGET}`);
const range = changeRange(root, { base: values.base, head: values.head });
const breaches = qualityBreaches(root, range, { rules, budget });
diff --git a/src/rigor-quality.js b/src/rigor-quality.js
index 3fe9fd44..5e2bc421 100644
--- a/src/rigor-quality.js
+++ b/src/rigor-quality.js
@@ -54,7 +54,7 @@ export const QUALITY_RULES = Object.freeze([
{ key: 'guard-mutation', section: 'T', text: 'A guard test fails when the guard is deleted.',
how: 'Rigor turns each throw a change adds to a source file into a no-op, one at a time, and runs the test files the change touches; a guard they still pass without is named.' },
{ key: 'size-budget', section: 'C', text: `A file over the ${LINE_CAP}-line cap, or a change that grows code past its ${GROWTH_BUDGET}-line budget, is named.`,
- how: `Rigor names each changed source file that ends over ${LINE_CAP} lines and grew, and a change whose non-test code grows by more than ${GROWTH_BUDGET} lines net, at the file that grew most.` },
+ how: `Rigor names each changed source file that ends over ${LINE_CAP} lines and grew, and a change whose non-test code grows by more than ${GROWTH_BUDGET} lines net, or the board's rigor.budget setting, at the file that grew most.` },
{ key: 'root-cause-control', section: 'T', text: 'A root cause is proven by a control that would have come out differently before the fix lands.',
how: 'Rigor runs each fix commit\'s changed test files on the fix\'s parent, where they must fail, and at the fix, where they must pass; a cause argued only in prose is review.' },
]);
diff --git a/test/rigor-quality.test.js b/test/rigor-quality.test.js
index dbd86c08..d363eca3 100644
--- a/test/rigor-quality.test.js
+++ b/test/rigor-quality.test.js
@@ -9,6 +9,7 @@ import { spawnSync } from 'node:child_process';
import {
mkdirSync,
mkdtempSync,
+ readFileSync,
realpathSync,
rmSync,
writeFileSync,
@@ -160,6 +161,17 @@ test('quality rules are drafted for the person and stay off until approved [D1,D
const row = drafts.find((draft) => draft.row.text.startsWith(QUALITY_RULES[0].text)).id;
assert.equal(report.out.trim(), `web/page.js:1: ${row} fix-test: fix ${fix.slice(0, 12)} "fix(web): close the page" changes no test that reproduces its failure`,
'the breach names its file, line, doctrine row and rule');
+ const config = JSON.parse(readFileSync(join(box.web, 'pullboard.json'), 'utf8'));
+ writeFileSync(join(box.web, 'pullboard.json'), JSON.stringify({ ...config, rigor: { budget: 0 } }));
+ const sizeRow = drafts.find((draft) => draft.row.text.startsWith(QUALITY_RULES[4].text)).id;
+ const budget = box.run(box.web, 'rigor', 'quality', '--rule', 'size-budget');
+ assert.equal(budget.code, 1, budget.out + budget.err);
+ assert.equal(budget.out.trim(), `web/page.js:1: ${sizeRow} size-budget: this change grows code by 1 lines, past its 0-line budget; split the change`,
+ 'the board\'s committed rigor.budget setting replaces the default');
+ assert.equal(box.run(box.web, 'rigor', 'quality', '--rule', 'size-budget', '--budget', '5').code, 0, '--budget wins over the setting');
+ writeFileSync(join(box.web, 'pullboard.json'), JSON.stringify({ ...config, rigor: { budget: -1 } }));
+ assert.match(box.run(box.web, 'rigor', 'quality').err, /BAD_CONFIG/u);
+ writeFileSync(join(box.web, 'pullboard.json'), JSON.stringify(config, null, 2));
const clean = box.run(box.repo, 'rigor', 'quality');
assert.equal(clean.code, 0, clean.out + clean.err);
assert.equal(clean.out.trim(), '', 'main against itself has no change to judge');