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: keep one-call provenance authority [A2,N26,A5,A6,C7]
Corey Olson690100cb7274
diff --git a/test/api-http.test.js b/test/api-http.test.jsindex de1d93a3..8757b05d 100644--- a/test/api-http.test.js+++ b/test/api-http.test.js@@ -462,7 +462,7 @@ test('a detail read after a cache miss on a linked board spawns no git process [const controls = JSON.parse(lines[0]).provenanceChecks;assert.deepEqual(controls.map(control => control.status), ['unknown main status', 'true main status']);for (const control of controls) {- assert.equal(control.processes.git, 2, JSON.stringify(control));+ assert.equal(control.processes.git, 1, JSON.stringify(control));assert.ok(control.processes.gitCalls.some(call => call.stack.some(line => line.includes('readCodeIsFromMain'))),'unknown and true main status still check actual code provenance');assert.equal(control.processes.node + control.processes.other, 0, JSON.stringify(control));diff --git a/test/git-provenance.test.js b/test/git-provenance.test.jsindex 40fc5478..9c6f81f3 100644--- a/test/git-provenance.test.js+++ b/test/git-provenance.test.js@@ -6,6 +6,8 @@ import { tmpdir } from 'node:os';import { join, resolve } from 'node:path';import { pathToFileURL } from 'node:url';import { test } from 'node:test';+import { DatabaseSync } from 'node:sqlite';+import { openBoard, closeBoard, SCHEMA_VERSION } from '../src/board.js';import { codeIsFromMain, withGitFacts } from '../src/git.js';/** Run Git in a disposable fixture without depending on user or system config. */@@ -103,3 +105,49 @@ test('[A2,N26,A5,A6] code provenance is cached per request and refreshes for theassert.equal(codeIsFromMain(alias), false, 'the next request recomputes linked-worktree provenance');assert.equal(codeIsFromMain(fixture), true, 'a source path outside Git retains released-source provenance');});++/** A cheaper provenance read retains checkout authority and the persistent schema refusal boundary [A5,A6,C7]. */+test('[A5,A6,C7] one provenance read preserves main branch detached and absent-main authority', t => {+ const directory = mkdtempSync(join(tmpdir(), 'pullboard-main-authority-'));+ t.after(() => rmSync(directory, { recursive: true, force: true }));+ const primary = join(directory, 'primary');+ const branch = join(directory, 'branch');+ const detached = join(directory, 'detached');+ const released = join(directory, 'released');+ mkdirSync(primary); mkdirSync(released);+ const env = { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1',+ GIT_AUTHOR_NAME: 'Authority fixture', GIT_AUTHOR_EMAIL: '[email protected]',+ GIT_COMMITTER_NAME: 'Authority fixture', GIT_COMMITTER_EMAIL: '[email protected]' };+ for (const args of [['init', '-q', '-b', 'main'], ['commit', '--allow-empty', '-q', '-m', 'private authority fixture'],+ ['worktree', 'add', '-q', '-b', 'feature', branch], ['worktree', 'add', '-q', '--detach', detached]]) {+ const result = git(primary, args, env);+ assert.equal(result.status, 0, result.stderr);+ }+ const helper = pathToFileURL(resolve(import.meta.dirname, '../src/git.js')).href;+ const cases = [['main', primary, true], ['branch', branch, false], ['detached', detached, false], ['released', released, true]];+ for (const [label, root, expected] of cases) {+ const actual = probe(helper, root, env);+ assert.equal(actual, expected, label + ' checkout authority');+ const file = join(directory, label + '.sqlite');+ const old = new DatabaseSync(file); old.exec('PRAGMA user_version = 0'); old.close();+ if (expected) {+ const board = openBoard(file, undefined, { isMain: actual });+ assert.equal(board.db.prepare('PRAGMA user_version').get().user_version, SCHEMA_VERSION, label + ' may initialize a throwaway schema');+ closeBoard(board);+ } else {+ assert.throws(() => openBoard(file, undefined, { isMain: actual }), { code: 'UNMERGED_SCHEMA' }, label + ' cannot upgrade persistent schema');+ const unchanged = new DatabaseSync(file, { readOnly: true });+ assert.equal(unchanged.prepare('PRAGMA user_version').get().user_version, 0, label + ' refusal leaves version unchanged');+ assert.equal(unchanged.prepare("SELECT count(*) AS n FROM sqlite_master WHERE type='table'").get().n, 0, label + ' refusal creates no tables');+ unchanged.close();+ }+ }+ const renamed = git(primary, ['branch', '-m', 'without-main'], env);+ assert.equal(renamed.status, 0, renamed.stderr);+ assert.notEqual(git(primary, ['show-ref', '--verify', '--quiet', 'refs/heads/main'], env).status, 0);+ assert.equal(probe(helper, primary, env), true, 'primary checkout retains authority when no branch is named main');+ assert.equal(probe(helper, branch, env), false, 'linked branch has no upgrade authority when the main ref is absent');+ assert.equal(probe(helper, detached, env), false, 'linked detached HEAD has no upgrade authority when the main ref is absent');+ for (const label of ['branch', 'detached']) assert.throws(() => openBoard(join(directory, label + '.sqlite'), undefined,+ { isMain: probe(helper, label === 'branch' ? branch : detached, env) }), { code: 'UNMERGED_SCHEMA' }, label + ' still refuses an old schema with no main ref');+});