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(settings): define recorded ranged line policy [R1,R2,H16]
Corey Olsone7777819f0dd
diff --git a/test/settings.test.js b/test/settings.test.jsindex 46392b84..602e7cc7 100644--- a/test/settings.test.js+++ b/test/settings.test.js@@ -68,3 +68,55 @@ test('the settings API reports every setting with its scope, value, default andconst { proveSettingsApi } = await import('./settings-api-fixture.js');await proveSettingsApi();});++/** Board-owned settings keep native move evidence, independent of machine-wide admission settings [R1,R2,H16]. */+test('a line setting change is a recorded move with its reason and its range [R1,R2,H16]', async t => {+ const { createE2eHelpers } = await import('./e2e-helpers.js');+ const store = await import('../src/board.js');+ const { exportBoard, importBoard } = await import('../src/exchange.js');+ const { prepareEngineMove, applyRelayMove } = await import('../src/engine.js');+ const fixtures = createE2eHelpers();+ t.after(fixtures.cleanup);+ const box = fixtures.project('true');+ const initial = box.run(box.repo, 'settings', 'line', '--json');+ const numbers = { windowMinutes: 60, activeReviewers: 2, reviewWaitMedianMinutes: 40 };+ const changed = box.run(box.repo, 'settings', 'line', 'reviewsFirst', 'on', '--reason', 'Review waiting exceeds the target',+ '--window', JSON.stringify(numbers), '--json');+ assert.equal(changed.code, 0, `a board setting change succeeds: ${changed.err}${changed.out}`);+ assert.equal(initial.code, 0, initial.err);+ const defaults = { reviewsFirst: false, wipPerReviewer: false, barReady: false, takeoverMinutes: false,+ landingBatchSize: false, landingCadenceMinutes: false };+ assert.deepEqual(JSON.parse(initial.out).lineSettings, defaults, 'all line controls start off, not silently enabled by a machine file');+ assert.equal(JSON.parse(changed.out).lineSettings.reviewsFirst, true);+ const board = store.openBoard(join(box.repo, '.git', 'pullboard', 'board.sqlite'));+ const replica = store.openBoard(join(box.dir, 'line-replay.sqlite'));+ t.after(() => { store.closeBoard(replica); store.closeBoard(board); });+ importBoard(replica, exportBoard(board));+ const first = store.events(board).findLast(event => event.event_kind === 'line_setting');+ assert.ok(first, 'the actual CLI records a native board event, not only a local settings file');+ assert.deepEqual(JSON.parse(first.event_detail), { key: 'reviewsFirst', value: true,+ reason: 'Review waiting exceeds the target', window: numbers });+ assert.equal(first.event_by, 'coordinator');+ const values = [['reviewsFirst', false], ['wipPerReviewer', 1.5], ['wipPerReviewer', 3], ['barReady', true],+ ['takeoverMinutes', 15], ['takeoverMinutes', 60], ['landingBatchSize', 1], ['landingBatchSize', 8],+ ['landingCadenceMinutes', 5], ['landingCadenceMinutes', 30]];+ let sequence = Number(board.db.prepare("SELECT meta_value FROM board_meta WHERE meta_key = 'relay_applied'").get()?.meta_value ?? 0);+ for (const [key, value] of values) {+ const move = prepareEngineMove(board, 'setLineSetting', [{ agentId: 'coordinator', key, value,+ reason: 'Measured fixture policy change', window: numbers }], { id: `line-setting-${++sequence}`, actor: 'coordinator' });+ const options = { sequence, at: `2026-10-24T01:${String(sequence).padStart(2, '0')}:00.000Z`, kind: 'move',+ sender: { kind: 'agent', userId: 'line-fixture', agent: 'coordinator' } };+ const outcomes = [board, replica].map(copy => applyRelayMove(copy, move, options));+ assert.deepEqual(outcomes[0], outcomes[1]);+ assert.ok(!outcomes[0].error, JSON.stringify(outcomes[0]));+ assert.equal(store.lineSettings(board)[key], value);+ assert.deepEqual(store.lineSettings(replica), store.lineSettings(board));+ }+ for (const [key, value] of [['wipPerReviewer', 1.49], ['wipPerReviewer', 3.01], ['takeoverMinutes', 14],+ ['takeoverMinutes', 61], ['landingBatchSize', 0], ['landingBatchSize', 9], ['landingBatchSize', 1.5],+ ['landingCadenceMinutes', 4], ['landingCadenceMinutes', 31], ['reviewsFirst', 1]]) {+ const before = store.events(board).length;+ assert.throws(() => store.setLineSetting(board, { agentId: 'coordinator', key, value, reason: 'Invalid limit', window: numbers }), /LINE_SETTING_RANGE/u);+ assert.equal(store.events(board).length, before, 'a refused value appends no successful setting event');+ }+});