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(core): keep dirty proof source unknown [C7,H16]

Corey Olson567492f7d7b1
diff --git a/src/gate.js b/src/gate.js
index 36289bc8..6967f9ed 100644
--- a/src/gate.js
+++ b/src/gate.js
@@ -372,7 +372,8 @@ function proofSourceAt(root, commit = null) {
invalidateGitFacts(); // The child may have changed Git facts outside this command context.
const head = commit ?? headCommit(root);
const tree = head ? tryGit(root, ['rev-parse', '--verify', `${head}^{tree}`], { env: gitChildEnv(root) }) : null;
- return { head, tree: tree?.status === 0 ? tree.stdout : null, clean: commit !== null || committedTree(root) !== null };
+ const clean = commit !== null || committedTree(root) !== null;
+ return { head: clean ? head : null, tree: clean && tree?.status === 0 ? tree.stdout : null, clean };
}
/** The private gate writer records process results, never provenance supplied by a CLI argument. */
diff --git a/test/proof-provenance.test.js b/test/proof-provenance.test.js
index 0df9dd90..da709e5f 100644
--- a/test/proof-provenance.test.js
+++ b/test/proof-provenance.test.js
@@ -22,6 +22,8 @@ test('a real failed native check records its actual exit without invented test c
criterion: 'The process exits successfully.', specIds: ['G1'], check: command });
const claim = box.run(box.web, 'claim', String(id), '--json');
assert.equal(claim.code, 0, claim.err || claim.out);
+ mkdirSync(join(box.web, 'web'), { recursive: true });
+ writeFileSync(join(box.web, 'web/uncommitted.txt'), 'not in a commit\n');
const check = box.run(box.web, 'check', String(id), '--yes', '--json');
assert.equal(check.code, 1, check.out);
const shown = box.run(box.repo, 'show', String(id), '--json');
@@ -29,6 +31,9 @@ test('a real failed native check records its actual exit without invented test c
const [receipt] = JSON.parse(shown.out).proofReceipts;
assert.equal(receipt.kind, 'check');
assert.equal(receipt.exitCode, 7);
+ assert.equal(receipt.sourceClean, false);
+ assert.equal(receipt.commit, null, 'a dirty check cannot attest the committed HEAD');
+ assert.equal(receipt.tree, null, 'a dirty check cannot attest the committed tree');
assert.deepEqual(receipt.counts, { passed: null, failed: null, skipped: null });
assert.deepEqual(receipt.environment, { node: process.versions.node, platform: process.platform, arch: process.arch });
});