test(qa-observer): fix mode treats atomic temps of authorized src/test writes as transient

CI webhook-fix failed with 'Could not watch test/worker.regression-1.test.ts.tmp...':
Claude Code's Write renamed its temp before the per-file watch was added. The
functional eval now tells the observer its mode, and a temp whose target that
mode may write is observed through its directory watch. Report-only mode and
undeclared paths keep failing closed.
This commit is contained in:
garrytan committed 2026-09-30 19:49:54 +00:00
1 parent b541f28ddb
commit 00dacee8bd
3 files changed
+16 -5

No files matched your search

+11 -2
View File
@@ -14,11 +14,11 @@ function fixture() {
return root;
}
async function atomicPublication(directory: string, declared?: string, atomicTargets?: string[]) {
async function atomicPublication(directory: string, declared?: string, atomicTargets?: string[], atomicWriteMode?: 'qa' | 'qa-only') {
const root = fixture();
const temporary = path.join(root, directory, 'exploration-004.json.tmp.2644.340bb6ad0afe');
const target = path.join(root, directory, 'exploration-004.json');
const observer = await observeQAWrites(root, { reportDirectory: declared, atomicTargets });
const observer = await observeQAWrites(root, { reportDirectory: declared, atomicTargets, atomicWriteMode });
const stat = fs.lstatSync;
let renamedAtWatch = false;
let stopped = false;
@@ -83,6 +83,15 @@ async function atomicPublication(directory: string, declared?: string, atomicTar
expect(result.observation.events).toContainEqual(expect.objectContaining({ path: result.target, mask: 0x80 }));
});
test('fix mode treats an atomic temp for an authorized source/test write as transient; report-only mode stays strict', async () => {
const fix = await atomicPublication('src', undefined, undefined, 'qa');
expect(fix.renamedAtWatch).toBe(false);
expect(fix.observation.failures).toEqual([]);
const reportOnly = await atomicPublication('src', undefined, undefined, 'qa-only');
expect(reportOnly.renamedAtWatch).toBe(true);
expect(reportOnly.observation.complete).toBe(false);
});
test('supports an explicitly selected nested report directory, not an implicit reports name', async () => {
const result = await atomicPublication('foreign/reports', 'foreign/reports');
expect(result.observation.complete).toBe(true);