Repository navigation
ADR-053: stamp WatchNodes events with the serving database id - #1593
Conversation
Add `database_id` to the proto NodeEvent and stamp it onto every WatchNodes event so a client watching a specific database can attribute events when the daemon serves several. NodeServiceImpl gains a `database_id`, set via a `with_database_id` builder that build_database_services calls with the registry id when a database is opened through the manager. `new()` is unchanged, so the single-database Pro daemon and direct-construction tests keep an empty id (their events carry no database id) — no cross-repo break. convert_domain_event now returns the inner event kind so the id is applied at one construction site. The e2e test opens watch streams on the default and a second database and asserts each stream's events carry its own database id. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
APPROVE — clean additive Stage 6; verified against the code. Verified
Note (not a defect)Per sync#294, the Pro daemon opens its single DB directly (not through the manager, no Merge gateCI This is one of the two remaining #1532 acceptance criteria (event streams carry |
Part of the ADR-053 epic ("One Daemon, Multiple Local Databases", #1532). One of the two remaining acceptance criteria: event streams carry
database_idso a client watching a specific database can attribute the events it receives when the daemon serves several.What changed
NodeEventgains an additivestring database_id = 7;(sibling of the event oneof). Backward-compatible — existing consumers (the tauri watcher, the frontend) ignore it, so the community app is behaviorally unchanged.NodeServiceImplgains adatabase_id, set via awith_database_idbuilder.build_database_servicescalls it with the registry id when a database is opened through the manager.NodeServiceImpl::newis unchanged, so the single-database Pro daemon (nodespaced-proconstructs it directly) and direct-construction unit tests keep an empty id and carry no cross-repo break.this.database_id(the routed database, resolved by the existingroute()) onto every emitted event.convert_domain_eventnow returns the innerNodeEventKindso the id is applied at a single construction site.Header-less/default watch streams carry the default database's id; a stream routed by
x-ns-database-idcarries that database's id.Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings— clean.cargo test -p nodespace-daemon— 51 lib + all integration suites green.database_service_e2e.rs): opens watch streams on the default and a second database over the real transport, then routes a write to each and asserts each stream'sCreatedevent carries its own database id (default id for the header-less stream, the second id for the routed stream).Cross-repo
No constructor or
BaseServiceschange —nodespaced-prois unaffected and inherits the additive proto field transparently on its next pin bump.