Skip to content

Ignore failures from a connection the store has moved off of - #2

Merged
sleeper-luke merged 2 commits into
mainfrom
claude/stale-surface-failure-84t1
Oct 14, 2026
Merged

sleeper-luke merged 2 commits into
mainfrom
claude/stale-surface-failure-84t1

Conversation

@claude

@claude claude Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Requested via Slack thread

Before: When a store falls back to its in-memory database, the fallback reopens the in-memory database under the same name. A write still in flight from before the fallback then lands on the new, empty database, which has none of its TEMP tables, and fails. That failure is treated as the live store's own, so it unbinds the healthy store, which reads empty until the next retry.

After: A failure on a surface the store has already moved off of no longer moves the store or reports. The live store stays bound.

How: buildGuarded remembers the surface it built, and its failure, contention and statement-error handlers check that this surface is still the running one before acting. onSqliteFailure makes the same check, and again inside its deferred microtask in case the store moves in between. New src/tests/superseded_connection.test.ts has 3 cases: 2 fail without the change and pass with it, and the third confirms that a failure on the running in-memory connection still unbinds the store.

Tests: superseded_connection.test.ts and define_sqlite_store.test.ts pass under both jest and jest.config.prod.js.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J5R4szy5V6TVSutrikAztt

…the store

A write still in flight on a superseded surface (such as the in-memory fallback, after retrySqliteStores binds the
store back onto its file) resumes on a connection nothing reads from, and since nitro addresses a handle by name, may
resume on the connection that replaced it, where none of its TEMP tables exist. Its guard used to report that as a
statement error (SLEEPER-PROD-84T1) and, for a write, unbind the live store (SLEEPER-PROD-84GX). Both are now ignored
once the surface is no longer the running one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J5R4szy5V6TVSutrikAztt
@claude
claude Bot requested a review from sleeper-luke October 9, 2026 21:15
Co-authored-by: Cursor <cursoragent@cursor.com>
@sleeper-luke
sleeper-luke marked this pull request as ready for review October 14, 2026 16:36
@sleeper-luke
sleeper-luke merged commit 6f37b4a into main Oct 14, 2026
2 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.

2 participants