Repository navigation
Conversation
A bare-node harness that drives a real SessionDO inside npm test: ctx.storage.sql over in-memory node:sqlite (multi-statement exec and ArrayBuffer BLOBs reproduced), explicit alarm firing, restart over retained storage, and AI via fakeAiRunner behind selectBudgetedAiRunner with call counting and interception. Four tests: hydrate after restart, the expanded:false round trip through real SQL, failed pole embed kicking the pump, and axisCreationsInFlight blocking a second concurrent create at the cap. Each fails when the code it guards is removed. fakeAiRunner takes an optional latencyMs (default unchanged at 250). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011jTqcyCetskFRRENsms9wZ
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
dewpt | 08889bb | Oct 11 2026, 06:28 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Schmug · project thread
Closes #31.
Before:
src/session-do.tshad no direct coverage. DeletingaxisCreationsInFlight, the failed-embed pump kick, or theexpandedwrite left the suite green.After:
test/session-do.test.tsdrives a realSessionDOthrough its own SQL, alarm pump and restarts, inside the normalnpm test, with no network or credentials. Each of those three deletions now fails a test (checked by mutating the code and rerunning).How
test/helpers/do-harness.tsfakes only what the DO touches:ctx.storage.sqlover a real in-memory SQLite (node:sqlite, built into Node 22, which CI already pins). Two runtime behaviours are reproduced on purpose: multi-statementexec(whatmigrate()relies on) and BLOBs reading back asArrayBuffer. Node returnsUint8Array, whichnew Float32Array(...)would silently corrupt.fireAlarm()/drainAlarms().restart()builds a fresh instance over the same database, which is what eviction looks like to a DO.selectBudgetedAiRunnerwith the binding set tofakeAiRunnerfromdev-fake-ai.ts, wrapped so tests can count calls and fail or hold specific ones.fakeAiRunnergained an optionallatencyMs; the default stays 250.The four tests cover the acceptance criteria: construct, persist and hydrate; an axis with
expanded: falsesurviving restart through real SQL; a failed pole embed kicking the pump and a later pass filling it; and a second concurrent create at 2/3 axes spending zero AI calls. They add about 200 ms to the suite.Why not
@cloudflare/vitest-pool-workers: it needs a second vitest pool running inside workerd, and this project'sremote: trueAI binding pulls in the Access-gated proxy that killswrangler devwithout credentials. The approach is documented inCLAUDE.md.Not done:
BoardDOuses key-valueget/putand the stubs intest/board-guards.test.ts. Adding those toFakeStorageis a natural follow-up, and so is updating the "no DO harness (issue #31)" comments in the board files.Gates
npm run typecheck: cleannpm test: 44 files, 892 passing, 0 failing. Node prints an ExperimentalWarning fornode:sqlite; it's harmless.🤖 Generated with Claude Code
https://claude.ai/code/session_011jTqcyCetskFRRENsms9wZ
Generated by Claude Code