Skip to content

fix(nostreamd): serve from the store the settings name instead of an unwired bundle - #1281

Merged
cameri merged 3 commits into
rewrite/mainfrom
fix/1206-daemon-real-stores
Nov 29, 2026
Merged

cameri merged 3 commits into
rewrite/mainfrom
fix/1206-daemon-real-stores

Conversation

@chappie-daemon

Copy link
Copy Markdown
Collaborator

Description

Cherry-picks AgrimTawani's commit from AgrimTawani:fix/1206-daemon-real-stores (bb0b2d9), picked with -x, authorship kept, onto rewrite/main at 090136c.

The defect. nostreamd composed both doors over unavailable::stores(): the relay answered every EVENT unable to process event and the MCP tools answered NotImplemented, so the daemon served the wire and stored nothing. Accepted throughput was 0 at this commit, which is why #868's benchmark gate and 72 h soak rows cannot measure anything until this lands.

The change. nostreamd opens the store its settings name and hands the same nine repository handles to both doors.

  • nostream-storage: Repositories (nine handles over one opened backend, Repositories::over), so no caller matches on the backend per accessor. The CLI's Opened now wraps it.
  • nostream-relay / nostream-services: Stores and ServiceStores are From<&Repositories>.
  • nostreamd: --data-dir <DIR> (the CLI's D8 layout, <DIR>/lmdb) and stores::open, used by serve and by --mcp-stdio alike. LMDB without the flag, or a Postgres that cannot be dialled, refuses to start (exit 1) instead of serving an empty store. The daemon does not run migrations.
  • LMDB: --mcp-stdio beside a running relay is the second process ADR 0012 D9 said would overturn its one-process contract, so open also takes an exclusive flock on <root>/lmdb/search-index.lock across the marker check and rebuild; the ADR is amended with what the lock does and does not cover.
  • Payments: confirm_invoice's three writes are not one transaction on either backend; the limitation is written on the function rather than implied.

Related Issue

Closes #1206

How Has This Been Tested?

On the cherry-picked branch at 1983e17, cargo test --workspace --all-features: 117 test binaries, 1829 passed, 0 failed. The tests that matter here all run and pass:

  • store_wiring::an_event_survives_a_restart_on_lmdb — publishes to one daemon process, stops it, reads the event and its content back from a second.
  • store_wiring::the_lmdb_backend_without_a_data_dir_refuses_to_start and an_unreachable_postgres_refuses_to_start — exit 1, the message names the flag, nothing is served.
  • lmdb::tests::an_open_waits_while_another_holder_has_the_rebuild_lock — a second descriptor contends as another process would.
  • The MCP suite now proves real rows: the_store_backed_tools_read_the_opened_store, the_write_tools_reach_the_opened_store, the_store_family_tools_write_through_to_the_opened_store, the_maintenance_tools_run_against_the_opened_store.
  • cargo fmt --all -- --check clean; cargo clippy --workspace --all-features --all-targets -- -D warnings clean.

The Postgres arm of store_wiring is #[ignore]d and needs PARITY_ADMIN_URL; this PR adds it to the existing Postgres CI job as Daemon store against Postgres, so that arm is proved in CI, not here — the sandbox cannot reach a Docker-published port.

Note for review

The flock serialises the search-index check and rebuild only, not writes; the ADR now states that explicitly, including the one deployment it does not cover (a --mcp-stdio of a newer index version against a running relay of an older one). Reviewing that paragraph is the highest-value thing a second reader can do here.

…unwired bundle

nostreamd built both doors over unavailable::stores(): the relay answered
every EVENT "unable to process event" and the MCP tools answered
NotImplemented, so the daemon served the wire and stored nothing (#1206).

- nostream-storage: Repositories, the nine repository handles of one opened
  backend (Repositories::over), so no caller matches on the backend per
  accessor. The CLI's Opened now wraps it.
- nostream-relay / nostream-services: Stores and ServiceStores are built
  From<&Repositories>.
- nostreamd: --data-dir <DIR> (the CLI's D8 layout, <DIR>/lmdb) and
  stores::open, used by serve and by --mcp-stdio alike. LMDB without the flag,
  or a Postgres that cannot be reached, refuses to start (exit 1) instead of
  serving an empty store. The daemon does not run migrations.
- LMDB: --mcp-stdio beside a running relay is the second process ADR 0012 D9
  said would overturn its one-process contract, so open also takes a flock on
  <root>/lmdb/search-index.lock across the marker check and rebuild; the
  record is amended.
- payments: confirmInvoice's three writes are not one transaction on either
  backend; the limitation is written on the function.

Tests: store_wiring starts the binary twice and reads back the event the
first process accepted, on LMDB and (ignored, PARITY_ADMIN_URL) Postgres; CI
runs the Postgres arm as "Daemon store against Postgres". The two refusals
are covered, the MCP tests now prove the tools read and write the opened
store (a user admitted by one process is read by a second), and the binary
tests that relied on the unwired default run on a scratch LMDB root.

Closes #1206

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit bb0b2d9)
@changeset-bot

changeset-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d567b12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0f1e1e51-919c-49e0-8993-1f1e985b299a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; the previous finding is fixed and no new blocking issue was found.RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; the previous finding is fixed and no new blocking issue was found.

Summary

nostreamd now opens the configured store instead of serving over unavailable repositories.

  • The relay and MCP doors now use the backend named in settings.
  • LMDB opens now serialize search-index checks and rebuilds across processes.
  • Invoice confirmation now spells out its separate storage writes.

No new actionable issues were found in the changes since the previous review. Checks were based on source review; tests were not run.

Reviews (2) · Last reviewed commit: "test(nostreamd): assert each store-famil..." · Reviewed by Greptile

Comment thread crates/nostreamd/tests/mcp_stdio.rs Resolved
…in one change

The ADR's D7 paragraph states the daemon still composes unavailable::stores()
and that wiring the store means wiring both sites in one change. #1206 does
that, so the record carries the amendment rather than a stale present tense.
…e absence of the stub

reports_action, invoices_list, invoices_get and reports_list were only checked
for the unwired bundle's message, so any other error — including tool not
found — passed. Each now asserts isError and its exact empty-store payload.

Raised by Greptile on #1281.
@coveralls

coveralls commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 46272270719

Coverage remained the same at 77.622%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12114
Covered Lines: 9824
Line Coverage: 81.1%
Relevant Branches: 6355
Covered Branches: 4512
Branch Coverage: 71.0%
Branches in Coverage %: Yes
Coverage Strength: 760.17 hits per line

💛 - Coveralls

@cameri
cameri merged commit 1514e7f into rewrite/main Nov 29, 2026
22 checks passed
@cameri
cameri deleted the fix/1206-daemon-real-stores branch November 29, 2026 14:42
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.

4 participants