Skip to content

fix(sqlite): join failed reader startup before returning pins - #4890

Merged
ScriptedAlchemy merged 9 commits into
masterfrom
fix/sqlite-reader-startup-ownership
Nov 14, 2026
Merged

ScriptedAlchemy merged 9 commits into
masterfrom
fix/sqlite-reader-startup-ownership

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Problem

Reader startup reports a SQLite open or setup failure before the storage-pool task has finished dropping its owned locator and file pins. The caller currently returns that error immediately, so reserved initialization can race worker teardown and refuse to return the original database and sidecar handles for retry.

The existing repository::attachment::tests::reader_start_failure_returns_idle_initialization_files_for_retry regression exposed this on the #4863 Linux run: the isolated child received the expected SQLite out-of-memory failure, then failed its assertion that the original handles had been returned.

Change

Join the failed reader task before returning either its typed startup error or a closed startup-channel error. Successful startup keeps the same worker handle and behavior. This follows the writer's existing startup ownership boundary.

The validation follow-up reuses one real canonical database across the workflow cancellation sweep. Each case restores the exact published SQL state, digest, and artifact rows before admission, drops raw handles, then verifies the full baseline state. The original cancellation samples, reopen cases, retirement joins, and assertions remain unchanged. This removes repeated baseline creation measured in the same owning test; fresh validation of the combined change is still required.

The combined update integrates the reviewed master changes. An intermediate head temporarily captured synchronous settlement phase timings in the two affected fixtures. After that head passed all 180 Linux targets, the exact capture cleanup was published. Original test bodies, ownership, workloads, and five-second waits are unchanged. The successful run retained no phase output, so no latency cause or separate automation repair is claimed.

Validation before this follow-up

  • The existing regression uses SQLite's real hard heap limit in an isolated subprocess, verifies the out-of-memory cause, recovers the original handles, and retries a healthy initialization. Its assertions and budgets are unchanged.
  • The original reader fix passed the repository-pinned Rust 1.100.0 formatter, commitlint, and git diff --check. The new combined head still requires fresh hosted checks.
  • Independent source review checked task destruction, locator lifetime, and the existing prohibition on synchronous startup from a storage-pool thread.
  • Hosted Linux CI on 01b0ebb6 freshly passed all 489 rusqlite-runtime tests in 20.09 seconds, including the real SQLite out-of-memory handle-return and healthy-retry regression.
  • The overall Linux job finished at 178/180 targets: the separate automation publication deadline and whole global-database target timeout remain under investigation.
  • Windows on 01b0ebb6 passed 467 targets and 26,393 actions. This was build/typecheck validation.

Validation on the prior clean head

Prior clean head 6ae41e2f retains the reader repair, workflow fixture reuse, and reviewed master integration; both temporary capture changes are removed.

  • Linux on e55cf7c8 passed 180/180 targets, with 111 freshly executed. Automation passed freshly in 61.8 seconds, global-db in 124.1 seconds, and runtime acceptance in 112.5 seconds.
  • Rusqlite-runtime's unit target was cached at 20.2 seconds. Its earlier fresh 489-test execution and real handle-return/retry regression remain recorded above.
  • The terminal log was preserved before cleanup. All useful active jobs were terminal and Windows remained queued, so no active Windows run was interrupted.
  • The cleanup restores the independently reviewed clean tree exactly. The finer four-subphase diagnostic stayed unreferenced because this measurement passed.
  • Linux CI on the cleaned head completed at 179/180 targets, with 96 freshly executed. Automation passed freshly in 67.0 seconds and runtime acceptance in 109.3 seconds. The sole failure was the whole global-db target timeout at 300.1 seconds, with 476/533 cases reported complete and no long-running-test notice. This log does not identify an individual stalled test. Windows build/typecheck on the same head passed 467 targets and 26,370 actions, with 232 remote executions in 5,730.778 seconds. Its complete terminal log was preserved before this follow-up. Native Windows tests were not requested by this ordinary CI run.

Current fixture follow-up

The independently reviewed follow-up 5a227736 separates canonical registered schema initialization from opening a raw test connection. At 27 temporal-schema fixture sites, the old code opened a TestConnection, immediately dropped it without using it, and then opened the same database again. The follow-up performs the required registered publication and admission once, then opens only the raw connection the test actually uses.

This removes redundant fixture actor startup and teardown. Registered ownership and release, all used connections, test data, assertions, reopen cases, deadlines, and concurrency settings remain unchanged. It is not an established cause or fix for the whole-target timeout, and no speedup has been measured.

The pinned Rust 1.100.0 formatter, commitlint, and git diff --check passed. Independent source review and an exact reverse-transformation check verified that the four test files differ only at those 27 unused-open/drop sites. No local Rust compilation or test run was performed. The candidate is published on this PR. Final hosted Linux validation on this head passed all 180 targets, with 27 freshly executed. Global-db passed freshly in 208.7 seconds, MCP in 303.4 seconds, runtime acceptance in 128.5 seconds, and transcript in 154.0 seconds. Rusqlite-runtime and automation were cached on this fixture-only follow-up; their earlier fresh owning-test evidence is recorded above. Windows build/typecheck on this head passed 467 targets and 26,370 actions, including 18 remote executions, in 959.120 seconds. The complete terminal Linux and Windows logs were preserved. The ordinary Windows job did not execute native tests.

All ordinary CI gates are successful or legitimately skipped, with no unresolved review threads. An independent merge preview against actual master 6c5599df produces master’s existing tree f82a927d: intervening reviewed merges already incorporated these source changes. The normal merge therefore records this PR’s completion without introducing an additional source change.


Devin Review

@changeset-bot

changeset-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5a22773

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ScriptedAlchemy
ScriptedAlchemy merged commit f7a8a1c into master Nov 14, 2026
16 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