Skip to content

refactor(db): move event query store ownership - #6788

Draft
TheSentinel454 wants to merge 1 commit into
codex/issue-13-reminder-storefrom
codex/issue-2-event-query-store
Draft

refactor(db): move event query store ownership#6788
TheSentinel454 wants to merge 1 commit into
codex/issue-13-reminder-storefrom
codex/issue-2-event-query-store

Conversation

@TheSentinel454

@TheSentinel454 TheSentinel454 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Current reconstructed head

Exact base: codex/issue-13-reminder-store at 9ca2f893f7c23d972cb90c163672b2e5bbbf5e1b
Exact head: codex/issue-2-event-query-store at 02d75823c301f935d767d15d7c70b031c7a0d35f

This current head removes crates/buzz-db/tests/store_ownership.rs; no replacement path-sensitive ownership test is introduced. Apart from removing that complete test-file diff, the production patch is byte-for-byte identical to the previously reviewed slice. This remains part of tracker #2 and the #17/#19 acceptance work.

Independent exact-head review from a separate clean Blox workstation found no issues. Current-head evidence passed formatting, strict buzz-db clippy, 111 non-PostgreSQL library tests with 200 PostgreSQL tests ignored, the observability source test, relay consumer compilation, exact ownership/unique-span review checks, and 12 event PostgreSQL tests on native PostgreSQL where applicable.

Why

Advance tracker #2 past its five minimum domain slices by making event.rs own the event/query Db facade alongside its records, query builder, SQL, and focused tests. This child stacks on the reminder extraction in #6787 and preserves the runtime/store boundary established by #6660 and #6668.

What

  • Move event insertion, direct/routed query and count, huddle-link lookup, replaceable/event lookup, event soft-deletion, channel last-message, batch hydration, threaded insertion, and discovery-event deletion Db methods/spans into event.rs
  • Move coordinate_delete_spares_head_newer_than_the_deletion beside the coordinate-deletion implementation
  • Preserve every public Db method signature, SQL statement/bind order, mention-index behavior, routing predicate/fallback behavior, and span name
  • Keep ReadSession, route_read, route proofs/predicates, pool/session infrastructure, mention materialization, and cross-cutting routing tests in lib.rs
  • Keep insert_event_with_serving_write_guard with the cross-domain deletion invariant for its later dedicated slice

Stack

Non-goals

  • No SQL, schema, query-shape, routing, retry, timeout, lock, transaction, or client-visible behavior changes
  • No movement or redesign of replica routing infrastructure, route proofs, ReadSession, or cross-cutting routing tests
  • No movement of thread, reaction, feed, deletion-admission, or mention-index ownership in this slice
  • No store traits, domain-handle redesign, broad PgExecutor migration, raw pool accessor, new crate, or directory-wide reorganization
  • No changes to, retargeting of, or merge action on parent PRs or PR Add database pressure observability #6700

Risk Assessment

Moderate review surface, low semantic risk. The diff moves 19 existing Db methods and one focused test without changing their bodies beyond module qualification and use of event.rs's existing test helper name. The routed methods continue calling the same crate-root private routing infrastructure.

Blox Verification

Author workstation: buzz-tornquist-issue-2-store-stack (2046520), exact head a8a0975585d691fff554cae16ee3b1fc811b8366.

  • cargo fmt --all --check — passed
  • cargo clippy -p buzz-db -p buzz-relay --all-targets -- -D warnings — passed
  • Native PostgreSQL event::tests:: ignored suite — 12 passed, including the moved coordinate-deletion test
  • Native PostgreSQL routed-query checks — 5 passed: routed query gate/coverage, bounded count, tenant confinement, head-fetch budget routing, and one-snapshot request routing
  • cargo test -p buzz-relay --lib -- --test-threads=1 — 909 passed, 48 ignored
  • git diff --check and commit-time formatting, sadscan, attribution, and sign-off hooks — passed

Independent exact-head review: buzz-tornquist-pr-6788-review (2050005) checked clean detached head a8a0975585d691fff554cae16ee3b1fc811b8366 over exact merge-base 52b7bb6cba2a0d09877cc8a1b3a561eb537256da. No critical, important, or minor findings. The relay suite passed 908 tests with one known unrelated mesh-demo 504 timing failure; that exact test passed immediately in isolation. Strict rustdoc produced the same 11 pre-existing warnings on parent and head, with no new warning.

Generated with Codex

Superseded pre-comment restack verification

PR #6700 merged before publication completed. This layer was restacked onto current main through the exact parent named above; the final cumulative tip is 2ddcc8a. Cumulative author gates passed: formatting and diff checks; buzz-db and buzz-relay all-target clippy with -D warnings; DB lib 111 passed / 200 ignored; ownership 22/22; observability 1/1; the full isolated PostgreSQL domain matrix; and relay lib 910 passed / 49 ignored.

  • Workstation: buzz-tornquist-pr-6788-final-review (2057616), fresh shallow checkout
  • Base: 35f3b66eae412d4aeea1500c9022681966b14a5f
  • Head: ff7f57fafe20354b1608683edb056f3f6486fdb6
  • Findings: none

Reviewed event/query Db wrappers and focused event tests moving into event.rs. Writer/replica routing still calls the same private runtime routing infrastructure in lib.rs; route predicates, read sessions, query/count SQL, event insertion/materialization, deletion behavior, and public signatures are preserved.

Verification: format and diff checks passed; buzz-db --all-targets clippy passed with -D warnings; DB lib tests passed (111 passed, 200 PostgreSQL tests ignored); ownership (6/6) and observability (1/1) guards passed; all 12 event PostgreSQL tests passed on native PostgreSQL 17 with migrations 1-32 successful; relay lib test target compiled successfully. Final worktree was detached at the exact head and clean.

Complete evidence archive SHA-256: d1d33ccf366ff680d0b747449cfa08b49ee9bea8180a28d00fd7dffb667f43f1.

Comment-addressed restack

Review follow-up on #6777 removed only the low-value replaceable ownership source test. This PR was restacked onto its rewritten parent; its production patch is unchanged.

  • Exact base: 888627a3d41b72c904d1546fe62492f01bdfdd3e
  • Exact head: ce2d9b3d8f599cf1c0dfe4abb8f2a8c116a0d329
  • Final cumulative tip: 6fa2f104d42c6ba85bdf62e7ccb74ceaf4a84f67
  • Per-layer patch-ID and tree audits confirm this PR’s production diff is unchanged from its pre-comment head.
  • Cumulative Blox gate: formatting and diff checks; strict buzz-db/buzz-relay Clippy; DB lib 111 passed / 200 ignored; ownership 21/21; observability 1/1; every moved PostgreSQL test; relay lib 910 passed / 49 ignored.
  • Independent re-review at this exact head: no findings; fresh exact-parent/head Blox review passed fmt/diff, strict Clippy, DB lib 111 passed / 200 ignored, current ownership/observability guards, 12 event PostgreSQL tests, and relay compilation.

@TheSentinel454
TheSentinel454 force-pushed the codex/issue-2-event-query-store branch from a8a0975 to ff7f57f Compare August 25, 2026 20:06
@TheSentinel454
TheSentinel454 force-pushed the codex/issue-2-event-query-store branch from ff7f57f to ce2d9b3 Compare August 25, 2026 20:59
@TheSentinel454 TheSentinel454 changed the title db: move event query store ownership refactor(db): move event query store ownership Aug 26, 2026
@TheSentinel454
TheSentinel454 force-pushed the codex/issue-2-event-query-store branch from ce2d9b3 to 7e1746c Compare August 26, 2026 14:33
Signed-off-by: OpenAI Codex <codex@openai.com>
@TheSentinel454
TheSentinel454 force-pushed the codex/issue-2-event-query-store branch from 7e1746c to 02d7582 Compare August 26, 2026 15:53
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