fix(opencode): avoid snapshotting files over 2MB (#19043)

This commit is contained in:
Dax
2026-03-25 04:43:48 +00:00
committed by GitHub
parent 4f9667c4bb
commit 0a80ef4278
2 changed files with 77 additions and 10 deletions
@@ -181,7 +181,7 @@ test("symlink handling", async () => {
})
})
test("large file handling", async () => {
test("file under size limit handling", async () => {
await using tmp = await bootstrap()
await Instance.provide({
directory: tmp.path,
@@ -196,6 +196,23 @@ test("large file handling", async () => {
})
})
test("large added files are skipped", async () => {
await using tmp = await bootstrap()
await Instance.provide({
directory: tmp.path,
fn: async () => {
const before = await Snapshot.track()
expect(before).toBeTruthy()
await Filesystem.write(`${tmp.path}/huge.txt`, new Uint8Array(2 * 1024 * 1024 + 1))
expect((await Snapshot.patch(before!)).files).toEqual([])
expect(await Snapshot.diff(before!)).toBe("")
expect(await Snapshot.track()).toBe(before)
},
})
})
test("nested directory revert", async () => {
await using tmp = await bootstrap()
await Instance.provide({