Skip to content

Read a fixed disk in the resource governor tests - #431

Merged
dillonstreator merged 2 commits into
mainfrom
claude/deterministic-disk-lease-tests
Dec 2, 2026
Merged

dillonstreator merged 2 commits into
mainfrom
claude/deterministic-disk-lease-tests

Conversation

@dillonstreator

Copy link
Copy Markdown
Member

Why

`evicts scratch once for a lease shortfall before waiting` failed intermittently in CI with `asked for the 500 MB gap, got 499 MB`. The disk lease tests staged `MIN_FREE_DISK_MB` from the runner's real free space, then asserted exact gaps against the governor's later `statfs` reads. Server test files run two at a time on the same disk, so free space moved between the probe and the sample.

What

  • `createResourceGovernor` takes an optional `statDisk` (defaults to `fs.statfs`; the app is unchanged).
  • Every governor in `apps/server/test/resources.test.ts` reads a fixed disk via one `fixedDisk` helper: the disk lease suite, the disk shortfall suite and the leases suite.
  • Gaps are asserted exactly (500 MB, the shortfall, the gap to the `reclaimTo` target). The 64 MB tolerance on `reclaimTo` is gone, and the lease tests no longer skip on a small disk.

Test-only behaviour change, so the changeset is empty. The lint baseline drops by the non-null assertions removed.

Test

`node --import tsx --test test/resources.test.ts`: 47 pass, 0 skipped. Server typecheck, `pnpm lint` and `pnpm guards` pass.

The disk lease tests staged their floor from the runner's real free space
and asserted exact gaps against later reads of it. Server test files run
two at a time and write to the same disk, so free space moved between the
probe and the governor's sample and the eviction request came out a MB off
("asked for the 500 MB gap, got 499 MB").

createResourceGovernor now takes an optional statDisk (fs.statfs by
default). Every governor in resources.test.ts reads a fixed disk, so the
gaps are asserted exactly, the reclaimTo tolerance is gone, and the lease
tests no longer skip on a small disk.

Signed-off-by: dillonstreator <dillonstreator@gmail.com>
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
reelsaw-website Ready Ready Preview Dec 2, 2026 6:27am UTC

Request Review

…disk-lease-tests

Signed-off-by: dillonstreator <dillonstreator@gmail.com>

# Conflicts:
#	scripts/lint-baseline.json
@dillonstreator
dillonstreator merged commit 17bb5e7 into main Dec 2, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant