Public: anyone can read this; the crew can change it.

Full suite red: test/snapshot.test.ts #12763

Merged opened this in answer to

Check · Review · Land · Live done — Landed and live in production.

Merged

test/snapshot.test.ts ran 21.8 s in the full suite, over the 20 s file budget. I split it into two files that each stay well under it. What moved: the second describe, "a snapshot's uploads", went into the new test/snapshot-uploads.test.ts.

Notes

shipped production is serving it deploy e5f3b40

opened this

test/snapshot.test.ts ran 21.8 s in the full suite, over the 20 s file budget. I split it into two files that each stay well under it.

  • What moved: the second describe, "a snapshot's uploads", went into the new test/snapshot-uploads.test.ts. That covers the in-flight cap, run-log bundles and the service's progress reporting. Its tests are unchanged: same code, same assertions.
  • Imports: each file now imports only what it uses.
  • Timings: locally the original file took 13 s, of which about 9.5 s was that second describe. I did not time the two new files separately.
  • What I did not do: I did not add the file to SLOW in scripts/gate.ts. The test/snapshot*.test.ts names in test/check-tiers.test.ts are fixtures and needed no change.

Checks:

  • bun x tsc --noEmit is clean.
  • bun scripts/gate.ts printed nothing, so I take it as clean.
  • test/snapshot.test.ts, test/snapshot-uploads.test.ts and test/check-tiers.test.ts pass together: 76 tests, 0 failures.
  • I did not run scripts/fast.ts or the full suite; the forge runs the full check on the push.

To try it: bun test ./test/snapshot.test.ts ./test/snapshot-uploads.test.ts.

Closes #12746

4 earlier comments
commented

test/snapshot.test.ts ran 21.8 s in the full suite, over the 20 s file budget. I split it into two files that each stay well under it.

  • What moved: the second describe, "a snapshot's uploads", went into the new test/snapshot-uploads.test.ts. That covers the in-flight cap, run-log bundles and the service's progress reporting. Its tests are unchanged: same code, same assertions.
  • Imports: each file now imports only what it uses.
  • Timings: locally the original file took 13 s, of which about 9.5 s was that second describe. I did not time the two new files separately.
  • What I did not do: I did not add the file to SLOW in scripts/gate.ts. The test/snapshot*.test.ts names in test/check-tiers.test.ts are fixtures and needed no change.

Checks:

  • bun x tsc --noEmit is clean.
  • bun scripts/gate.ts printed nothing, so I take it as clean.
  • test/snapshot.test.ts, test/snapshot-uploads.test.ts and test/check-tiers.test.ts pass together: 76 tests, 0 failures.
  • I did not run scripts/fast.ts or the full suite; the forge runs the full check on the push.

To try it: bun test ./test/snapshot.test.ts ./test/snapshot-uploads.test.ts.

commented

The preview deploy didn't fail because of my change, so I changed nothing and pushed nothing.

  • What the message says: the preview is "running at https://lab--12763--forge-trevato-apps.open-platform.sh · no tests declared, none run". The log excerpt is only periodic process and SQL telemetry, with no error in it.
  • The preview is up: / answers 200 on the preview URL.
  • Why no tests ran: forge.json has no app.test key. The tests live under check, and the forge runs those on every push. The preview deploy has no tests to run, which is normal for this repository.
  • Nothing to fix: the working tree is clean. My earlier local results still stand: tsc and the gate are clean, and the snapshot and check-tiers tests pass.
commented

The full suite went green again on main at 5347ed3, which doesn't include this pull, so the red run looks like load rather than a code fault. I made no new change and pushed nothing.

test/snapshot.test.ts took 21.8 s in the red run, and the 20 s file budget counts the whole file's time. It ran 13 s here with no other load, so it sits close to the limit and a busy machine can push it over. A later run on a quieter machine would pass without any change, which fits the green report.

The split in this pull still helps, because it removes the cause rather than waiting for a quiet run.

  • What changed: the "a snapshot's uploads" tests moved unchanged into test/snapshot-uploads.test.ts. They were about 9.5 s of that file here, so each file now has far more room under the budget.
  • What I did not do: I did not add the file to SLOW in scripts/gate.ts.
  • Checks: bun x tsc --noEmit and bun scripts/gate.ts are clean, and test/snapshot.test.ts, test/snapshot-uploads.test.ts and test/check-tiers.test.ts pass together (76 tests). The forge runs the full check on the push.
  • To try it: bun test ./test/snapshot.test.ts ./test/snapshot-uploads.test.ts.

The preview's "no tests declared, none run" message is not a failure: forge.json has no app.test key, and the tests run under check.

commented

The check on this pull's head fails, and it is not the preview: the deploy log you were shown is a success. These are the failing lines from check run 01m7eq1s2xxhkpj76cnb8t7mfs (ended 2026-11-15T04:22), quoted from its log:

gate: rule "a test does not wait on a real timer": test/snapshot-uploads.test.ts:61 sleeps; inject a clock and step it, or end the line with `// real-timer: <why>`
gate: rule "a test does not wait on a real timer": test/snapshot-uploads.test.ts:211 sleeps; inject a clock and step it, or end the line with `// real-timer: <why>`
gate: rule "a test does not wait on a real timer": test/snapshot-uploads.test.ts:230 sleeps; inject a clock and step it, or end the line with `// real-timer: <why>`
gate: rule "a test does not wait on a real timer": test/snapshot-uploads.test.ts:245 sleeps; inject a clock and step it, or end the line with `// real-timer: <why>`
gate: rule "a test does not wait on a real timer": test/snapshot-uploads.test.ts:247 sleeps; inject a clock and step it, or end the line with `// real-timer: <why>`

Fix exactly these, then push. Nothing else is being asked.

commented

The gate now passes, and the fix is pushed. I ran bun scripts/gate.ts after committing, and it printed nothing. Before the commit it still flagged all five lines, because it only checks lines the commit adds.

The five Bun.sleep lines in test/snapshot-uploads.test.ts (61, 211, 230, 245 and 247) now end with a // real-timer: <why> comment. I did not swap them for an injected clock. These tests check real overlap between uploads, polling of a background snapshot, and the service's catch-up loop. A fake clock would stop them testing what they exist to test, and the gate accepts the comment for this case. If you want a clock injected, say so.

The edit only adds comments, so behaviour is unchanged. bun test test/snapshot-uploads.test.ts gives 10 pass and 0 fail. I did not re-run bun x tsc --noEmit after the edit.

Approved

Test-only split of the uploads describe into test/snapshot-uploads.test.ts. The code moved unchanged, imports are pruned, and the five sleeps carry real-timer justifications for the gate. No production code, security surface, README or dependency is touched. Nit, not blocking: import { dirStore, } from in test/snapshot.test.ts has a stray comma.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs