refactor(db): extract domain stores from database runtime - #6987
Draft
TheSentinel454 wants to merge 25 commits into
Draft
refactor(db): extract domain stores from database runtime#6987TheSentinel454 wants to merge 25 commits into
TheSentinel454 wants to merge 25 commits into
Conversation
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: OpenAI Codex <codex@openai.com>
Signed-off-by: tornquist <tornquist@squareup.com>
Signed-off-by: tornquist <tornquist@squareup.com>
🔐 Codex Security Review
|
This was referenced Aug 28, 2026
This was referenced Aug 28, 2026
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.
Summary
Finish the remaining database-store extraction tracked by TheSentinel454/buzz#2 in one reviewable PR.
This consolidates the previously stacked, patch-equivalent domain slices after #6782 merged. It preserves the runtime/store boundary established by #6660, #6668, #6700, and #6782 while separating database runtime infrastructure from domain-owned persistence:
runtime/owns pool construction and sizing, writer/reader routing, read sessions and route proofs, transaction infrastructure, observability primitives, replica fencing, health support, migrations, and cross-cutting runtime tests.store/owns domain records, SQL, row parsing, locks and invariants,Dbdomain methods, focused tests, and logical-operation datastore spans.lib.rsremains a 56-line compatibility facade that preserves existing crate-root paths andDbmethod signatures through re-exports.Domain coverage includes API tokens, authentication allowlists, reminders, event queries, threads, reactions, feeds, users and DMs, push, workflows/runs/approvals, relay membership and invites, product feedback, moderation/admin moderation, git repositories, archived identities, usage, partition maintenance, deletion, channel membership inherited from merged #6782, and the final runtime/store layout.
The cumulative branch is patch-equivalent to the 24 remaining reviewed stack commits. The only integration-only change is updating two compile-time fixture paths after moving
migration.rsunderruntime/.Exact base and head
mainate76c81968b65b0755b83efdd59dc3375c59ddf40(merged refactor(db): split channel membership store #6782)codex/issue-2-store-extractionatcc14bc9d81ded60c30ec64c84234d37c9278b572Related issue
This supersedes #6783, #6784, #6787, #6788, #6789, #6792, #6820, #6794, #6796, #6797, #6798, #6799, #6804, #6805, #6806, #6808, #6809, #6811, #6812, #6813, #6814, #6815, and #6890. Their discussions remain available for review history.
#17 / #19 acceptance
has_admin_or_ownerreceives the one previously missing wrapper span; its pool-level helper remains uninstrumented, so there is no nested duplicate.store_ownership.rs; physical ownership and focused source guards now enforce the boundary directly.impl Db, domain SQL, focused domain test group, or datastore span inlib.rs.buzz_db::channel,buzz_db::event, andbuzz_db::workflowthrough crate-root re-exports while keeping internalruntimeandstorenamespaces private.Non-goals
PgExecutormigration, new store crate, raw pool accessor, or broader directory reorganization.Risk
The cumulative diff is large but structural. Risk is primarily module-path or ownership drift; it is mitigated by patch-equivalence checks against the prior reviewed commits, preserved public re-exports, source guards, touched-crate compilation, full moved PostgreSQL test coverage, and an independent exact-head review on a separate clean Blox workstation.
Testing
Author workstation
buzz-tornquist-issue-2-consolidate, exact headcc14bc9d81ded60c30ec64c84234d37c9278b572:cargo fmt --all --checkcargo clippy -p buzz-db -p buzz-relay --all-targets -- -D warningscargo test -p buzz-db --lib— 112 passed, 200 PostgreSQL tests intentionally ignoredcargo test -p buzz-db --lib -- --ignored --test-threads=1— 195 passed in the shared serial run; the five shared-state/config-sensitive tests all passed as exact reruns against fresh databases with their required bootstrap modecargo test -p buzz-db --test observability_source— 1 passedcargo test -p buzz-relay --lib --no-runcargo test -p buzz-relay --lib -- --test-threads=1with native PostgreSQL/Redis and the reconciled schema — 922 passed, 49 infrastructure-marked tests ignoredgit diff --checklib.rsis 56 lines; zeroimpl Db; zero datastore spans; nostore_ownership.rs; no external references to privatebuzz_db::runtimeorbuzz_db::storepathshas_admin_or_ownerwrapper addedIndependent clean review workstation
buzz-tornquist-issue-2-consolidated-review, detached at exact headcc14bc9d81ded60c30ec64c84234d37c9278b572:cargo fmt --all --checkcargo clippy -p buzz-db -p buzz-relay --all-targets -- -D warningscargo test -p buzz-db --lib— 112 passed, 200 ignoredcargo test -p buzz-db --test observability_source— 1 passedcargo test -p buzz-relay --lib --no-run