Skip to content

feat(locallibrary): store sync and snapshot reads in the sidecar, one resolver, one progress event - #309

Merged
botandbang merged 8 commits into
mainfrom
bnb/sidecar-rpc
Nov 1, 2026
Merged

botandbang merged 8 commits into
mainfrom
bnb/sidecar-rpc

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

The sidecar gains three methods. store.serve serves the store to another computer until it's cancelled. It sends a serve notification {id, event} for each thing that happens (ready with the share code, connected, refused, done) and answers with how much it sent. store.fetch {code, libraries?, local_only?, dry_run?} copies the snapshots the other store has and this one lacks. Both work like store serve and store fetch. They're in builds with peers, and initialize lists a peers capability. snapshot.library {snapshot, offset?, limit?} reads the library a drive had when a snapshot was taken, paged like drive.library. Plugins with store:read may call it. To support the notification, a method's Call can now send one about its own request. docs/rpc is regenerated and only adds definitions. docs/sidecar.md describes the new methods.

The progress event has one definition, in loclib-plugin's protocol. The sidecar re-exports it, and ProgressEvent::new builds it from a coalesced report in both the sidecar and the plugin SDK. The wire bytes and schema.json are unchanged, and a new test pins the bytes.

opener::web_address parses the address now. It goes through net::public, which returns the parsed URL, and refuses a user name or password. The browser gets the parsed form. Addresses with credentials or on this computer or its network are refused.

There is now one path resolver, loclib_model::paths::resolved, with without_verbatim_prefix beside it. locallibrary's fsutil and device re-export them. The interop plugin drops its copy and its dunce dependency, so it strips Windows' \\?\ prefix the way the host does for drive roots.

loclib-plugin's README now lists the error kinds the host really shows as its own. apps/locallibrary/TODO.md loses two finished items.

Fixes LOC-42
Fixes #142
Fixes LOC-29
Fixes #129
Fixes LOC-31
Fixes #131
Fixes LOC-30
Fixes #130
Fixes LOC-16
Fixes #113
Fixes LOC-19
Fixes #116

How it was tested

  • cargo fmt --check, and cargo clippy --all-targets -- -D warnings for locallibrary, locallibrary-cli, loclib-plugin, locallibrary-plugin-interop and loclib-model.
  • Filtered nextest over the touched areas: 388 of 390 pass. The 2 failures are hegel findings in code this branch doesn't touch (interop write.rs and loclib-plugin's manifest test); bnb/property-fixes fixes both test models.
  • rpc::the_contract_in_docs_is_current passed after the progress change with no bless (the schema didn't change), then was blessed for the new methods and passes.
  • a_store_is_served_and_fetched_through_the_sidecar passed 10 of 10 stress runs, twice.
  • Break checks, each failing its new test: ProgressEvent field order swapped, the user and password check removed, snapshot_library ignoring offset, the notification renamed, resolved not following links, and the cancel_method call removed.
  • Not run: the full suite and Windows clippy (without_verbatim_prefix has a #[cfg(windows)] body).

Checklist

  • Tests cover the change
  • For locallibrary: apps/locallibrary/CHANGELOG.md has a line under Unreleased, if people using it will notice
  • The READMEs, docs/ and --help still say what the code does (apps/locallibrary/docs/rpc/ too, for a sidecar change)

…the sidecar

Planned as these commits, folded into one because they share files:

- fix(locallibrary): parse addresses before the browser gets them
- refactor(loclib-plugin): one definition of the progress events
- feat(locallibrary): read a snapshot's library from the sidecar and plugins
- feat(locallibrary): store.serve and store.fetch in the sidecar
@botandbang
botandbang requested a review from bnb as a code owner October 30, 2026 16:16
@linear-code

linear-code Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

bnb
bnb previously approved these changes Oct 30, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file locallibrary locallibrary and the loclib-* crates locallibrary: cli The locallibrary command line locallibrary: sidecar The JSON-RPC sidecar and the api module it serves locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: interop Libraries for Traktor, Serato and Engine DJ locallibrary: plugins The plugin protocol, its host and the built-in plugins tests Tests, fixtures and test harnesses labels Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Client JavaScript 684.7 KiB 684.7 KiB 0 B (0%)
Client JavaScript, brotli 227.6 KiB 227.6 KiB 0 B (0%)
Client CSS 89.6 KiB 89.6 KiB 0 B (0%)
Client CSS, brotli 12.9 KiB 12.9 KiB 0 B (0%)

bnb
bnb previously approved these changes Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Rust coverage

From run 62. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.4% (84667/86929) 96.52% (13570/14059) 95.67% (186420/194849)
Hegel property tests alone 95.35% (82890/86929) 94.04% (13221/14059) 93.43% (182052/194849)

@botandbang
botandbang added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit c8145d2 Nov 1, 2026
36 checks passed
@botandbang
botandbang deleted the bnb/sidecar-rpc branch November 1, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation locallibrary: cli The locallibrary command line locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: interop Libraries for Traktor, Serato and Engine DJ locallibrary: plugins The plugin protocol, its host and the built-in plugins locallibrary: sidecar The JSON-RPC sidecar and the api module it serves locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses

Projects

None yet

2 participants