test(stats): a project_dir inside cwd finds the repo that holds it
/trekreview of e7ac34b..3f073b7 (WARN, 1 MAJOR, finding 986c939f93808a274b5e4ecd2c5318fd422a3be4): baseDir's accepting branch was never exercised, though every production /trekbrief record carries project_dir. One unit test (attributeOrder from a non-git parent with projectDir inside it) and one end-to-end landing test (the Phase 7 line with a record carrying project_dir). Both pass on HEAD and both fail on the always-cwd mutant (measured, then reverted). Suite 1364 (1362/0/2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3f073b7bd7
commit
5329355690
2 changed files with 27 additions and 0 deletions
|
|
@ -278,3 +278,17 @@ test('attributeOrder: finds the claimed order of the cwd repo; a projectDir outs
|
||||||
assert.equal(attributeOrder({ cwd: a.dir, env, projectDir: '../../' + b.parent.split('/').pop() + '/repo-b' }).order_reason, 'none-claimed');
|
assert.equal(attributeOrder({ cwd: a.dir, env, projectDir: '../../' + b.parent.split('/').pop() + '/repo-b' }).order_reason, 'none-claimed');
|
||||||
} finally { cleanup(a.parent, b.parent, coord); }
|
} finally { cleanup(a.parent, b.parent, coord); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('attributeOrder: a projectDir inside cwd moves the lookup to the repo that holds it', async () => {
|
||||||
|
const { attributeOrder } = await load();
|
||||||
|
const m = repo('mbx');
|
||||||
|
const coord = fixture(claimed('mbx', 'o-1'));
|
||||||
|
try {
|
||||||
|
mkdirSync(join(m.dir, '.claude', 'projects', 'x'), { recursive: true });
|
||||||
|
const env = { CLAUDE_COORD_DIR: coord, HOME: m.parent };
|
||||||
|
// Control: cwd (the repo's parent) is outside git, so without projectDir there is no mailbox.
|
||||||
|
assert.equal(attributeOrder({ cwd: m.parent, env }).order_reason, 'mailbox-unresolved');
|
||||||
|
assert.deepEqual(attributeOrder({ cwd: m.parent, env, projectDir: 'mbx/.claude/projects/x' }),
|
||||||
|
{ order_id: 'o-1', order_claimed_at: '2026-10-04T10:00:00Z', order_reason: null });
|
||||||
|
} finally { cleanup(m.parent, coord); }
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,19 @@ test('order: one claimed order in the repo\'s mailbox lands in the trekbrief rec
|
||||||
} finally { rmSync(home, { recursive: true, force: true }); rmSync(repo.parent, { recursive: true, force: true }); rmSync(coord, { recursive: true, force: true }); }
|
} finally { rmSync(home, { recursive: true, force: true }); rmSync(repo.parent, { recursive: true, force: true }); rmSync(coord, { recursive: true, force: true }); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('order: the record\'s own project_dir finds the mailbox when the shell stands outside the repo', () => {
|
||||||
|
const home = mkdtempSync(join(tmpdir(), 'stats-landing-'));
|
||||||
|
const repo = gitRepo('mbx');
|
||||||
|
const coord = coordWith({ mbx: ['o-1'] });
|
||||||
|
try {
|
||||||
|
mkdirSync(join(repo.dir, '.claude', 'projects', 'x'), { recursive: true });
|
||||||
|
const rec = landTrekbrief({ ts: '2026-10-04T18:00:00Z', slug: 's', project_dir: 'mbx/.claude/projects/x' },
|
||||||
|
{ repo: repo.parent, coord, home });
|
||||||
|
assert.equal(rec.order_id, 'o-1');
|
||||||
|
assert.equal(rec.order_reason, null);
|
||||||
|
} finally { rmSync(home, { recursive: true, force: true }); rmSync(repo.parent, { recursive: true, force: true }); rmSync(coord, { recursive: true, force: true }); }
|
||||||
|
});
|
||||||
|
|
||||||
test('order: zero claimed orders - the three keys are PRESENT, order_id null, reason none-claimed', () => {
|
test('order: zero claimed orders - the three keys are PRESENT, order_id null, reason none-claimed', () => {
|
||||||
const home = mkdtempSync(join(tmpdir(), 'stats-landing-'));
|
const home = mkdtempSync(join(tmpdir(), 'stats-landing-'));
|
||||||
const repo = gitRepo('mbx');
|
const repo = gitRepo('mbx');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue