Reduce snapshot batch test fixture sizes (#28381)

This commit is contained in:
Kit Langton
2026-05-19 16:10:43 -04:00
committed by GitHub
parent 71e90073d2
commit 4db2746e31
2 changed files with 8 additions and 4 deletions

View File

@@ -15,6 +15,9 @@ const it = testEffect(Layer.mergeAll(Snapshot.defaultLayer, AppFileSystem.defaul
// with path.join (which produces \ on Windows) then normalizes back to /.
// This helper does the same for expected values so assertions match cross-platform.
const fwd = (...parts: string[]) => path.join(...parts).replaceAll("\\", "/")
const SNAPSHOT_BATCH_BOUNDARY = 100
const OVER_BATCH_COUNT = SNAPSHOT_BATCH_BOUNDARY + 1
const MIXED_BATCH_GROUP_COUNT = Math.ceil(OVER_BATCH_COUNT / 4)
afterEach(async () => {
await disposeAllInstances()
@@ -802,7 +805,7 @@ it.instance(
Effect.gen(function* () {
const tmp = yield* bootstrap()
const snapshot = yield* Snapshot.Service
const ids = Array.from({ length: 60 }, (_, i) => i.toString().padStart(3, "0"))
const ids = Array.from({ length: MIXED_BATCH_GROUP_COUNT }, (_, i) => i.toString().padStart(3, "0"))
const mod = ids.map((id) => fwd(tmp.path, "mix", `${id}-mod.txt`))
const del = ids.map((id) => fwd(tmp.path, "mix", `${id}-del.txt`))
const add = ids.map((id) => fwd(tmp.path, "mix", `${id}-add.txt`))
@@ -862,7 +865,7 @@ it.instance(
Effect.gen(function* () {
const tmp = yield* bootstrap()
const snapshot = yield* Snapshot.Service
const ids = Array.from({ length: 140 }, (_, i) => i.toString().padStart(3, "0"))
const ids = Array.from({ length: OVER_BATCH_COUNT }, (_, i) => i.toString().padStart(3, "0"))
yield* mkdirp(`${tmp.path}/order`)
yield* Effect.all(
ids.map((id) => write(`${tmp.path}/order/${id}.txt`, `before-${id}`)),
@@ -1090,8 +1093,8 @@ it.instance(
Effect.gen(function* () {
const tmp = yield* bootstrap()
const snapshot = yield* Snapshot.Service
const base = Array.from({ length: 140 }, (_, i) => fwd(tmp.path, "batch", `${i}.txt`))
const fresh = Array.from({ length: 140 }, (_, i) => fwd(tmp.path, "fresh", `${i}.txt`))
const base = Array.from({ length: OVER_BATCH_COUNT }, (_, i) => fwd(tmp.path, "batch", `${i}.txt`))
const fresh = [fwd(tmp.path, "fresh", "0.txt")]
yield* mkdirp(`${tmp.path}/batch`)
yield* mkdirp(`${tmp.path}/fresh`)
yield* Effect.all(

View File

@@ -82,6 +82,7 @@ Repeated setup work, long sleeps/timeouts, serial integration tests, filesystem/
| Local plugin and subagent config fixtures can use Effect-aware instance fixtures | Migrated scoped npm plugin and custom subagent markdown cases to `it.instance` | 2.37s | 1.67s | keep | Single baseline before edit; after median from three sequential reruns (1.66, 1.67, 1.67). |
| MCP merge config cases can use Effect-aware instance fixtures | Migrated three MCP merge/override cases to `it.instance` | 1.98s | 1.95s | keep | Neutral timing within noise; removes manual `tmpdir` + `withTestInstance` setup from isolated filesystem-only config cases. |
| Remaining legacy tools config cases can use Effect-aware instance fixtures | Migrated allow/deny legacy `tools` permission cases to `it.instance` | 2.65s | 1.90s | keep | Single baseline before edit; after median from three sequential reruns (2.58, 1.90, 1.90). |
| Oversized snapshot batch tests only need to cross the 100-file boundary | Reduced large diff/revert fixture sizes while keeping each case above the batch boundary | 4.32s | 3.66s | keep | Three affected snapshot tests; after median from three reruns (4.32, 3.66, 3.66) while still crossing the 100-file boundary. |
## Profiling Results