Skip to content

Commit c11df3b

Browse files
test(review): split the tool-call guards in the retirement classifier tests
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 0cf3170 commit c11df3b

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

packages/cli/src/commands/review/lib/retirement.test.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ describe('scheduleReverseAuditRound — the scheduler on its own', () => {
9595

9696
/**
9797
* Write a transcript the way the harness writes one: launch prompt first,
98-
* then `calls` successful reads of the diff, then the final text.
99-
* `calls: 0` is the whiff shape — prose and nothing else.
98+
* then `calls` successful reads of `filePath` (the diff unless told
99+
* otherwise), then the final text. `calls: 0` is the whiff shape — prose
100+
* and nothing else.
100101
*/
101102
function transcript(
102103
launchPrompt: string,
103104
finalText: string,
104105
calls = 1,
106+
filePath: string = diff,
105107
): void {
106108
const id = `aud-${++seq}`;
107109
const base = {
@@ -127,7 +129,7 @@ describe('scheduleReverseAuditRound — the scheduler on its own', () => {
127129
{
128130
functionCall: {
129131
name: 'read_file',
130-
args: { file_path: diff, offset: 0, limit: 100 },
132+
args: { file_path: filePath, offset: 0, limit: 100 },
131133
},
132134
},
133135
],
@@ -227,6 +229,25 @@ describe('scheduleReverseAuditRound — the scheduler on its own', () => {
227229
expect(schedule(3, [13]).due).toEqual([13]);
228230
});
229231

232+
it('successful calls that never touched the diff are not dry — the two guards are independent', () => {
233+
// Every other transcript here reads the diff, so `successfulToolCalls`
234+
// and `diffToolCalls` move in lockstep and the classifier's two guards
235+
// are exercised only together. An auditor that reads only its own brief
236+
// clears the first guard but not the second: the receipt must still
237+
// read `unknown`, so the chunk stays under audit.
238+
transcript(record(1, 13, 'chunk 13 round 1 territory walk'), DRY);
239+
transcript(
240+
record(2, 13, 'chunk 13 round 2 territory walk'),
241+
DRY,
242+
1,
243+
join(dir, 'brief.md'),
244+
);
245+
246+
const r3 = schedule(3, [13]);
247+
expect(r3.due).toEqual([13]);
248+
expect(r3.skipped).toEqual([]);
249+
});
250+
230251
it('a finding outranks a dry receipt — yielded history keeps the chunk hot', () => {
231252
transcript(record(1, 13, 'chunk 13 round 1 territory walk'), DRY);
232253
transcript(record(2, 13, 'chunk 13 round 2 territory walk'), YIELD);

0 commit comments

Comments
 (0)