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: expose consumed person OFF stamp replay
Corey Olson9b4958683d4c
diff --git a/test/person-off-replay-fixture.js b/test/person-off-replay-fixture.jsnew file mode 100644index 00000000..bdccde07--- /dev/null+++ b/test/person-off-replay-fixture.js@@ -0,0 +1,65 @@+/** Exact signed-request provenance must replace optional SSH signing at native apply, never named identity [E22,H16]. */+import assert from 'node:assert/strict';+import {+ createHash,+ generateKeyPairSync,+ randomUUID,+ sign,+} from 'node:crypto';+import { join } from 'node:path';+import * as store from '../src/board.js';+import * as signing from '../src/person-signing.js';+import { presenceAttestation } from '../src/person-presence.js';+import { preparePersonRequest } from '../src/person-request.js';+import { loadConfig } from '../src/config.js';+import {+ applyRelayMove,+ prepareEngineMove,+} from '../src/engine.js';+import {+ receivePersonRequest,+ personRequestRecords,+ requestIntentDigest,+ requestStageText,+} from '../src/relay-requests.js';+import { relayClientFixture } from './relay-client-fixture.js';++/** A consumed genuine OFF stamp cannot disable signing a second time after ordinary re-enable [E22,H16]. */+export async function rejectConsumedOffReplay(t) {+ const box = await relayClientFixture(t);+ const board = store.openBoard(join(box.root, '.git', 'pullboard', 'board.sqlite'));+ t.after(() => store.closeBoard(board));+ const authority = generateKeyPairSync('ed25519');+ signing.pinAuthority(board, 'https://fixture-relay.invalid', { version: 1, algorithm: 'Ed25519',+ publicKey: authority.publicKey.export({ format: 'der', type: 'spki' }).toString('base64url') });+ signing.setPersonSigning(board, { agentId: 'coordinator', signed: true });+ const document = preparePersonRequest({ verb: 'signing', args: { signed: 'off' } }, randomUUID());+ const boardId = board.db.prepare("SELECT meta_value FROM board_meta WHERE meta_key='board_id'").get().meta_value;+ const presence = { board: boardId, request: document.id, digest: createHash('sha256').update(JSON.stringify(document)).digest('hex'),+ credential: 'fixture-passkey', at: Date.now() };+ presence.signature = sign(null, presenceAttestation(presence), authority.privateKey).toString('base64url');+ const at = new Date().toISOString();+ receivePersonRequest(board, document, { sequence: 1, at, sender: { kind: 'person', userId: 'fixture-user', presence } });+ const executor = 'fixture-executor';+ let sequence = 1;+ /** Use real sealed request execution, never a self-declared presence flag. */+ function execute(operation, args, phase) {+ const record = personRequestRecords(board).find(entry => entry.id === document.id);+ const move = prepareEngineMove(board, operation, args);+ move.personRequest = { id: document.id, executor, phase, digest: requestIntentDigest(record) };+ const outcome = applyRelayMove(board, move, { sequence: ++sequence, at, kind: 'move',+ sender: { kind: 'machine', userId: 'fixture-user', machine: 'fixture-native-device' } });+ assert.equal(outcome.error, undefined, JSON.stringify(outcome));+ }+ const intake = personRequestRecords(board).find(entry => entry.id === document.id);+ execute('shout', [{ from: 'person', to: 'coordinator', text: requestStageText(intake, 'claim'), lanes: Object.keys(loadConfig(box.root).lanes) }], 'claim');+ execute('setPersonSigning', [{ agentId: 'person', signed: false, request: document.id }], 'execute');+ assert.equal(signing.personSigning(board).signed, false, 'a genuine first execution turns signing off');+ const original = board.db.prepare("SELECT * FROM event WHERE event_kind='person_signing' ORDER BY event_id DESC LIMIT 1").get();+ assert.equal(JSON.parse(original.event_detail).request, document.id);+ signing.setPersonSigning(board, { agentId: 'coordinator', signed: true });+ assert.equal(signing.personSigning(board).signed, true, 'ordinary re-enable is the positive control');+ board.db.prepare('INSERT INTO event(event_at,event_by,event_kind,item_id,event_detail) VALUES (?,?,?,?,?)')+ .run(original.event_at, original.event_by, original.event_kind, original.item_id, original.event_detail);+ assert.equal(signing.personSigning(board).signed, true, 'an exact consumed OFF event cannot disable signing again without new presence');+}diff --git a/test/team.test.js b/test/team.test.jsindex e9eaab75..cc4d3c24 100644--- a/test/team.test.js+++ b/test/team.test.js@@ -60,6 +60,7 @@ import {rejectFabricatedPasskeyMetadata,rejectSyntheticPasskeyEvent,} from './person-optional-apply-fixture.js';+import { rejectConsumedOffReplay } from './person-off-replay-fixture.js';import { firstUnpairedAuthorityInsertion } from './person-first-pin-fixture.js';import { refuseNamedSigners } from '../src/person-signing-cli.js';import { createE2eHelpers } from './e2e-helpers.js';@@ -1231,3 +1232,5 @@ test('person-only moves are signed against fabricated receipt metadata [E22,H16]/** A local event insertion is not an authenticated execution of a different row source. */test('person-only moves are signed against synthetic execution events [E22,H16]', rejectSyntheticPasskeyEvent);++test('person-only moves are signed against consumed OFF replay [E22,H16]', rejectConsumedOffReplay);