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.

fix(rigor): ignore unreadable decline provenance [D1,H16,M1]

Corey Olson1dc4c2806f60
diff --git a/src/rigor-notices.js b/src/rigor-notices.js
index 48008589..ff668031 100644
--- a/src/rigor-notices.js
+++ b/src/rigor-notices.js
@@ -12,6 +12,15 @@ export function rigorTriggerCauses(event, person) {
return eventCauses(event);
}
+/** Ignore an unreadable historical row source; it cannot establish a person’s typed decline. */
+function declinedRigorSource(source) {
+ if (typeof source !== 'string') return null;
+ let rows;
+ try { rows = parseSpec(`## Source\n${source}\n`).rows; }
+ catch { return null; } // Historical metadata is optional; a parser refusal must never abort the original item move.
+ return rows.length === 1 ? readRigorSource(rows[0].source) : null;
+}
+
/** Reconstruct notice and exact person-decline state from ordered receipts, never free text. */
function noticeState(events, person) {
const seen = new Map();
@@ -26,9 +35,7 @@ function noticeState(events, person) {
if (event.event_kind === 'rigor-notice' && event.event_by === 'rigor' && detail.engine === RIGOR_NOTICE_ENGINE
&& typeof detail.cause === 'string' && !causeProblem(detail.cause)) notified.set(detail.cause, event.event_id);
if (event.event_kind !== 'row_decision' || event.event_by !== person || detail.record?.decision !== 'decline') continue;
- const row = parseSpec(`## Source\n${detail.record.source}\n`).rows;
- if (row.length !== 1) continue;
- const source = readRigorSource(row[0].source);
+ const source = declinedRigorSource(detail.record.source);
if (source) declined.set(source.key, { event: event.event_id, items: new Set(seen.get(source.key) ?? []) });
}
return { notified, declined };
diff --git a/test/machine.test.js b/test/machine.test.js
index 65837181..be8f4f92 100644
--- a/test/machine.test.js
+++ b/test/machine.test.js
@@ -113,6 +113,8 @@ const CALLBACKS = { 'board.js': { freeze: 'cli.js#freezer' } };
const CAUGHT = {
'cli.js#submitHere': ['cli.js#freezer', 'main-red.js#compareMainFailures', 'main-red.js#matchingReworks', 'doctrine-checks.js#checkRulesAt'],
'cli.js#verifyHere': ['cli.js#freezer'],
+ // Historical decline metadata is parsed inside a non-throwing boundary, covered by the Rigor history control.
+ 'board.js#reopen': ['rigor-notices.js#declinedRigorSource'],
};
/**
diff --git a/test/rigor.test.js b/test/rigor.test.js
index d9da8982..b33b6bab 100644
--- a/test/rigor.test.js
+++ b/test/rigor.test.js
@@ -16,6 +16,7 @@ import { main } from '../src/cli.js';
import { refusePersonMove } from '../src/mcp.js';
import { CAUSE_ENGINE, ENGINE_VERSION } from '../src/machine.js';
import { rigorReport } from '../src/rigor.js';
+import { newRigorNotices, undraftedRigor } from '../src/rigor-notices.js';
import { readRigorSource, rigorSource, RIGOR_NOTICE_ENGINE } from '../src/rigor-source.js';
import { loadConfig } from '../src/config.js';
import { loadDoctrine } from '../src/doctrine.js';
@@ -231,6 +232,31 @@ test('automatic Rigor notices retain old replay and include reopen and never-aga
historyBox.close();
});
+test('unreadable historical decline metadata cannot abort or silence a repeated cause [D1,H16,M1]', () => {
+ const box = freshBoard();
+ const recorded = history(box.file);
+ recorded.board.executionEngineVersion = RIGOR_NOTICE_ENGINE - 1;
+ for (const id of ['Historical first', 'Historical second'].map(recorded.add)) {
+ recorded.submit(id); recorded.reject(id, 'row:G1');
+ }
+ const events = store.events(recorded.board);
+ const trigger = events.at(-1);
+ const cause = rigorReport(events, { person: store.PERSON }).causes[0];
+ const proof = { check: 'test -f fixed', red: { commit: 'a'.repeat(40), exit: 1 }, green: { commit: 'b'.repeat(40), exit: 0 } };
+ const row = `- G9 [draft, must] A proved rule | source: ${rigorSource(cause, proof)}`;
+ const declined = source => [...events, { event_id: trigger.event_id + 1, event_kind: 'row_decision', event_by: store.PERSON,
+ item_id: null, event_detail: JSON.stringify({ record: { decision: 'decline', source } }) }];
+ const state = { spec: [], practice: [] };
+ assert.deepEqual(undraftedRigor(declined(row), state, { person: store.PERSON }), [], 'a valid typed decline still stays quiet');
+ for (const source of [undefined, 'ordinary prose', `<!-- pullboard-grammar 999 -->\n${row}`]) {
+ const historical = declined(source);
+ assert.deepEqual(newRigorNotices(historical, trigger, { person: store.PERSON }).map(entry => entry.key), ['row:G1'],
+ 'unknown provenance neither refuses the item move nor suppresses the notice');
+ assert.deepEqual(undraftedRigor(historical, state, { person: store.PERSON }).map(entry => entry.key), ['row:G1']);
+ }
+ recorded.close();
+});
+
test('a repeated failure cause is noticed [D1,V1]', () => {
const box = freshBoard();
const before = json(box, 'rigor');