Skip to content

refactor(relay): backend seams prep for local mode (PR 0/12) - #5506

Open
loganj wants to merge 5 commits into
mainfrom
brother-darryl/local-mode-pr0-seams
Open

refactor(relay): backend seams prep for local mode (PR 0/12)#5506
loganj wants to merge 5 commits into
mainfrom
brother-darryl/local-mode-pr0-seams

Conversation

@loganj

@loganj loganj commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

PR 0 of 12 — Backend seams prep (local-mode graduation stack)

First PR of the local-mode graduation train (source branch wip-experiment-local-mode @ b3f365faf, re-cut as a 12-PR stack; plan in the buzz-experiment-local-mode channel canvas).

What this PR does

Mechanical seams-prep refactor with zero hosted-path behavior change:

  • buzz-db-backend-macro crate (new, standalone): compile-time enforcement that every public Db method carries an explicit #[sqlite_backend(...)] decision marker, with trybuild compile-pass/fail coverage. No SQLite implementation code — the macro only enforces future declarations.
  • Relay pubsub/media/presence/config seams: RelayProfile config enum (BUZZ_PROFILE, defaults to production; single-node fails fast at boot — constructor fence, no local backend installed yet), AppState::new_with_backends injection point, redis_pool becomes Option (always Some on the production path), pubsub/media/search backend selection moved behind startup-selected wrappers.
  • Filesystem media backend hardening (pulled forward from the source branch per review): component-aware cross-platform key rejection (traversal, \\, drive/UNC paths), atomic same-directory temp-file writes/copies, seek + bounded take range reads, regression coverage for the traversal/Windows-separator boundary.

Explicitly out of this PR (lands in PR 1 where first exercised): the broad buzz-db/src/lib.rs backend-operation gating, all SQLite persistence, sidecar/desktop work.

Size

24 files, +1,414/−154 = 1,568 changed lines (stack budget: ≤2k after the PR 1 tracer).

Evidence

  • cargo test -p buzz-media — 111 passed / 1 ignored (MinIO, infra-dependent)
  • cargo test -p buzz-db-backend-macro — green (incl. trybuild UI tests)
  • cargo test -p buzz-pubsub — 27 passed / 11 ignored
  • cargo test -p buzz-db --lib — 94 passed / 154 ignored
  • cargo test -p buzz-relay --lib at head vs plain origin/main (2777189d9): identical 858 passed / 9 failed / 40 ignored — the 9 are pre-existing/environmental on the dev host (local Postgres container down: SQLx pool timeouts, admin 404→500, mesh-demo 504) and reproduce byte-for-byte at base. CI's real-database run is the authoritative gate.
  • Full pre-push hook suite green (rust-tests, desktop check/typecheck/test/tauri, mobile-test).

Review

Blocking review by Larry: initial 6/10 (filesystem media boundary needed the source branch's hardening family), fix round closed it, final 10/10 at exactly this head — no remaining blockers or suggestions.

Builder: Brother Darryl. Verification: Wakko (independent test reruns at exact head 8f29ecb).

npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je and others added 5 commits August 10, 2026 14:22
Signed-off-by: npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Signed-off-by: npub1z3hmzc9ryehxzedl5wzlvpyvja0d483peaja5zt6pd0209f9x2jspe2dxh <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz>
Signed-off-by: npub1z3hmzc9ryehxzedl5wzlvpyvja0d483peaja5zt6pd0209f9x2jspe2dxh <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz>
Signed-off-by: Brother Darryl <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz>
Signed-off-by: Brother Darryl <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz>
@loganj
loganj marked this pull request as ready for review August 10, 2026 20:02
@loganj
loganj requested a review from a team as a code owner August 10, 2026 20:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f29ecbdb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +11 to +12
#[proc_macro_attribute]
pub fn enforce_sqlite_backend_declarations(_args: TokenStream, input: TokenStream) -> TokenStream {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document the public proc-macro entry point

enforce_sqlite_backend_declarations is a newly exported API but has no function-level documentation explaining its attribute syntax, generated inventory, or compile-time behavior. Add a /// comment to comply with the repository requirement that every new public API be documented.

AGENTS.md reference: AGENTS.md:L117-L117

Useful? React with 👍 / 👎.

Comment on lines +452 to +454
let key = path
.strip_prefix(base)
.unwrap()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Propagate filesystem listing errors instead of panicking

The new non-test filesystem listing path calls unwrap() while processing directory entries, and the same function later introduces an expect() when constructing the continuation token. Replace these with normal error propagation through MediaError; production paths are explicitly prohibited from adding unwrap() or expect(), and a violated path invariant should fail the sweep rather than abort the process.

AGENTS.md reference: AGENTS.md:L116-L116

Useful? React with 👍 / 👎.

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