Skip to content

refactor(storage): storage redesign package and async typed reads - #4118

Merged
ScriptedAlchemy merged 3 commits into
masterfrom
refactor/storage-read-boundary
Oct 16, 2026
Merged

ScriptedAlchemy merged 3 commits into
masterfrom
refactor/storage-read-boundary

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR opens the storage redesign and ships its first step.

  • Design package (docs/plans/storage/). After the 2026-10-16 incidents (153 GB of unmeasured growth, a 6-day ingest freeze, a 229 MB WAL ratchet, native-worker reader waits, a store per clone, writes into unlinked files), TraceDecay storage was redesigned through the architect playbook: grounding, an arena of four whole-shape candidates, a cross-judge, synthesis, and an interrogate pass. The result is per-repository class files (journal, memory, evidence, derived) on one bounded executor, fenced TRUNCATE checkpoints, per-stream dead letters, class budgets, repository identity through aliases, and an eleven-step cutover. decisions.tsv is the decision trail and evidence/ holds the artifacts behind it. The plan index now points at it as the storage authority.
  • Step 1, read boundary (storage: thousands of native-worker reader waits per suite through StoreRuntimeClientLease::dispatch_read #4085). StoreRuntimeClientLease::dispatch_read and its attachment port are now async and take an Arc probe, matching dispatch_submit. The repository attachment runs the read as one job on the native blocking pool, so a native worker that awaits a fact, observation or external-source read no longer parks on reader admission or the reader's reply. All seven production callers await it. The remote exact-observation query port is still synchronous and runs on the blocking pool, so it waits through native_runtime::block_on, which refuses on a native thread; step 5 makes that port async.

Test plan

  • bazel test //crates/tracedecay-rusqlite-runtime:rusqlite_suite. A new test awaits a typed read on a native worker and asserts the native reader-wait counter does not move. Mutating dispatch_read to read inline makes the test fail (left 1, right 0).
  • bazel test --config=clippy for //crates/tracedecay-session-memory:unit_test, //crates/tracedecay-runtime-core:unit_test (504 tests), //crates/tracedecay-store-runtime:unit_test and //crates/tracedecay-global-db:unit_test
  • bazel build --config=clippy //crates/tracedecay:runtime_acceptance_suite //crates/tracedecay-project:unit_test
  • rustfmt_check_2024 for every touched crate
  • //crates/tracedecay:daemon_suite, :mcp_suite, :session_suite, :unit_test in CI

Refs #4085


Devin Review

Records the architect run that redesigned TraceDecay storage after the
2026-10-16 incidents: per-repository class files (journal, memory,
evidence, derived) on one bounded executor, fenced TRUNCATE
checkpoints, per-stream dead letters, class budgets, repository
identity through aliases, and an eleven-step cutover. The trail and
the arena, judge and interrogate evidence ship beside it.
StoreRuntimeClientLease::dispatch_read and its attachment port are now
async and take an Arc probe, matching dispatch_submit. The repository
attachment runs the read as one job on the native blocking pool, so a
native worker awaiting a fact, observation or external-source read no
longer parks on reader admission or the reader's reply.

The seven production callers await the read; the sync remote query
port, which runs on the blocking pool, waits through block_on. A
rusqlite_suite test awaits a typed read on a native worker and asserts
the native reader-wait counter does not move.

Refs #4085
@changeset-bot

changeset-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 37d7b44

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: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

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