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(cli): submit records only the item's own files [N21]

Corey Olsonc925bee99b46
diff --git a/src/cli.js b/src/cli.js
index 319bb8a7..2ff82667 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -350,16 +350,19 @@ function dirtyFiles(root) {
/**
* The files an item's own commits changed since its claim (N21). First parents only, so main merged
- * into a lane branch is not counted as the item's work.
+ * into a lane branch is not counted as the item's work; and nothing another item submitted, such as
+ * a verified dependency fast-forwarded in, which merges no commit to skip.
*
* @param {string} root
+ * @param {number} id
* @param {string | null} from
* @param {string} to
* @returns {string[]}
*/
-function filesSince(root, from, to) {
+function filesSince(root, id, from, to) {
if (!from) return [];
- const result = tryGit(root, ['log', '--first-parent', '--no-merges', '--format=', '--name-only', `${from}..${to}`]);
+ const others = [`--exclude=refs/pullboard/items/${id}/*`, '--glob=refs/pullboard/items/*'];
+ const result = tryGit(root, ['log', '--first-parent', '--no-merges', '--format=', '--name-only', to, '--not', from, ...others]);
return result.status === 0 ? [...new Set(result.stdout.split('\n').filter(Boolean))].sort() : [];
}
@@ -692,7 +695,7 @@ function submitHere(ctx, id) {
if (!commit) throw new Refused('NO_COMMIT', 'nothing committed yet');
const gate = runGate(root, ctx.config);
if (!gate.isGreen) throw new Refused('GATE_RED', `the gate is red at ${commit.slice(0, 12)}; fix it, commit, submit again. ${gateReport(gate)}`);
- withBoard(ctx, (board) => store.submit(board, id, { agentId: me.id, commit, tree: headTree(root) ?? '', files: filesSince(root, claimHead, commit) }));
+ withBoard(ctx, (board) => store.submit(board, id, { agentId: me.id, commit, tree: headTree(root) ?? '', files: filesSince(root, id, claimHead, commit) }));
const pin = `refs/pullboard/items/${id}/${commit.slice(0, 12)}`;
git(root, ['update-ref', pin, commit]);
ctx.io.say(`submitted #${id} at ${commit.slice(0, 12)}; ${gateReport(gate)}`);
diff --git a/test/e2e.test.js b/test/e2e.test.js
index 63e5791a..765fd698 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -768,3 +768,21 @@ test('check runs the item\'s own check command, yours by default, and prints a d
assert.match(box.run(box.web, 'check', '2').err, /NO_CHECK.*#2 has no check command/);
assert.match(box.run(box.repo, 'help').out, /pullboard check \[id\]/);
});
+
+test('submit leaves a dependency fast-forwarded in out of the files it records [N21]', () => {
+ const box = project();
+ box.run(box.repo, 'add', 'web', 'Dependency', '--specs', 'G1');
+ box.run(box.repo, 'add', 'web', 'Page', '--specs', 'G1', '--after', '1');
+ const second = box.run(box.repo, 'worktree', 'web').out.match(/^made (\S+) /)[1];
+ box.run(box.web, 'claim', '1');
+ commitFile(box, box.web, 'web/dep.html', 'dep', 'feat(web): the dependency [G1]');
+ assert.equal(box.run(box.web, 'submit', '1').code, 0);
+ box.git(box.repo, 'switch', '-q', '--detach', 'web/one');
+ assert.match(box.run(box.repo, 'verify', '1', 'accept', '--as', 'coordinator', '--note', 'removed dep.html; the page broke').out, /verified #1/);
+ box.git(box.repo, 'switch', '-q', 'main');
+ box.run(second, 'claim', '2');
+ box.git(second, 'merge', '-q', '--ff-only', 'web/one');
+ commitFile(box, second, 'web/page.html', 'page', 'feat(web): the page [G1]');
+ assert.equal(box.run(second, 'submit', '2').code, 0);
+ assert.equal(JSON.parse(box.run(box.repo, 'show', '2', '--json').out).item_files, 'web/page.html');
+});