Skip to content

Commit 50e937e

Browse files
committed
test(web): cover the write-then-edit path for the artifact file count
The countArtifactFileOps case only exercised a read+edit file for the `edit > write` rule. The #5909 repro path is create + edit the SAME file, so switch the b.ts entry to write-then-edit and assert it still counts as one edit (not one write + one edit), while the op-level counter sees the additional write (roian6 / lefarcen review on #6420).
1 parent 8686547 commit 50e937e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

apps/web/tests/runtime/file-ops.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ describe('countArtifactFileOps', () => {
224224
ok('t3'),
225225
use('Read', { file_path: '/a.ts' }, 't4'),
226226
ok('t4'),
227-
// b.ts read then edited → one edit (edit beats write).
228-
use('Read', { file_path: '/b.ts' }, 't5'),
227+
// b.ts written THEN edited (the #5909 repro path: create + edit the same
228+
// file) → one edit (edit beats write).
229+
use('Write', { file_path: '/b.ts' }, 't5'),
229230
ok('t5'),
230231
use('Edit', { file_path: '/b.ts' }, 't6'),
231232
ok('t6'),
@@ -242,8 +243,8 @@ describe('countArtifactFileOps', () => {
242243
];
243244
const rows = deriveFileOps(events);
244245
expect(countArtifactFileOps(rows)).toEqual({ write: 1, edit: 2 });
245-
// The op-level counter is unchanged: it still sees all three writes.
246-
expect(countFileOps(rows).write).toBe(3);
246+
// The op-level counter is unchanged: a.ts (3) + b.ts (1) writes.
247+
expect(countFileOps(rows).write).toBe(4);
247248
expect(countFileOps(rows).edit).toBe(4);
248249
});
249250
});

0 commit comments

Comments
 (0)