Repository navigation
Describe batch-write, event and collision docs without naming the sync daemon - #3408
Conversation
Pragmatic code review (medium)Review Type: Initial Review. Run on the branch's first commit before the PR was opened (now Requirements Check (core#3364)
Accuracy checks against the code (all confirmed)
Code Review Findings: no Critical or Important issues.
Recommendation: APPROVE |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment, since GitHub blocks self-approval). The full findings are in the review comment above: no Critical or Important issues, 5 nits.
Address reviewCommit ✅ Addressed (2)
⏭️ Skipped (3)
Tests: Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The review had no Critical or Important findings. The two changes are comment wording and a reflow, with no logic, signature or test change. |
…c daemon Reword the docs of bulk_add_to_collections_notify, DOMAIN_EVENT_CHANNEL_CAPACITY, bulk_create_has_child_edges, the store's bulk member_of/has_child paths and their guards, and the local-first collection-collision rule so they state the contract (every event subscriber must see each new membership; any caller applying another device's writes through create_node must not stall on a benign duplicate) instead of naming one sync implementation's functions. Move the bulk_add_to_collections doc off collection_typed_ids, where rustdoc merged the two, onto the function it documents. Replace the stale "128 slots" and "128 subscriber capacity" channel comments with DOMAIN_EVENT_CHANNEL_CAPACITY. Rename the notify test to bulk_add_to_collections_notify_emits_relationship_events. Align the frontend's empty database_id event docs with the proto convention, and point the Tauri sync listener's header at the watcher's WatchNodes stream instead of the removed DomainEventForwarder. Comments, docs and one test-function name only; no behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- relationship.rs: "far more edges than that" overstated the burst against a 4096-event buffer; say "more edges than the buffer holds". - bulk.rs: reflow a long comment line. Skipped: renaming the store's own private DOMAIN_EVENT_CHANNEL_CAPACITY (128) constant is a code change outside this comment-only issue; the generic "sync pull" wording is the allowed ADR-060 term; the hierarchy doc's repeated "genuinely-unparented" is the pre-existing sentence the issue said to keep. Co-Authored-By: Claude Opus 5.5 <[email protected]>
4ec84bb to
2e8bf08
Compare
Summary
Rewords core's batch-write, event-emission and collection-collision docs so they describe the contract instead of the sync code that happens to call them (ADR-081). Comments and docs only, plus one test-function rename and one assertion message. No behaviour, signature or public-name change.
Event emission
DOMAIN_EVENT_CHANNEL_CAPACITY(node_service/mod.rs): a subscriber doing slow per-event work (for example, forwarding eachmember_ofedge over the network) lags and drops edges when a burst exceeds the buffer. The 128 → 4096 sizing history is kept.bulk_add_to_collections_notify(relationship.rs): the raw store insert emits nothing, so without this no subscriber learns of the edges (other windows, CLI watchers, a host that mirrors changes). Its chunk-yield comment said the channel was "bounded (128 slots)"; it is bounded byDOMAIN_EVENT_CHANNEL_CAPACITY(4096).NodeService.event_txfield doc said "128 subscriber capacity"; it now says the channel buffersDOMAIN_EVENT_CHANNEL_CAPACITYevents.import_service.rs) says the event reaches every subscriber, not "PUSHES to cloud".bulk_add_to_collections_notify_emits_push_eventsis renamed tobulk_add_to_collections_notify_emits_relationship_events; its doc, assertion message ("so it pushes to cloud" dropped) and "no spurious re-emit" comment follow. The burst test's doc says "drop edges for a lagging subscriber".Batch-write APIs and bulk store paths
bulk_create_has_child_edges(hierarchy.rs),bulk_create_has_child,assert_root_only_membership(sqlite_store/relationships.rs),assert_may_gain_parent(sqlite_store/nodes.rs), the bulk-path parity test comments (sqlite_store/mod.rs), thehas_childwriter list (schema.rs, the Rust comment outsideSCHEMA_SQL), the twobulk.rstitle comments and thebulk_create/bulk_updatetitle test docs (node_service/mod.rs) now say "the bulk path", "a batched caller applying writes made elsewhere" or "a from-scratch batch".bulk_add_to_collectionsdoc sat on top ofcollection_typed_ids, where rustdoc merged it into that function's doc. It now sits directly abovepub async fn bulk_add_to_collections, reworded: it emits no events, and callers whose writes must reach event subscribers useNodeService::bulk_add_to_collections_notify.scheduler_grants_immediately_when_no_active_database(embedding_processor.rs): "the single-database path is unaffected".reverse_relationship_name_test.rs: "The bulk attach path (bulk_create_has_child_edges)."Local-first collision rule (ADR-065, ADR-068)
create_node's collision comment (sqlite_store/nodes.rs) states the rule itself: two offline devices can each validly create the same name, and a hard rejection would propagate out of any caller applying another device's writes throughcreate_node, stalling it permanently on a benign duplicate. The marker-write comment drops themark_possible_duplicateprovenance.collection_membership_test.rs,collection_name_convergence_test.rsandperson_duplicate_convergence_test.rsrestate the same rule ("replicated apply", "a replicated rename — an apply whose node already exists locally") without naming a sync function, repository or cursor contract.Leftovers from #3363's sweep that fall under event docs (included at the coordinator's direction)
event-types.ts(NodeEventData.databaseId) anddatabase.svelte.ts(isActiveDatabaseEvent, which said "single-database / Pro daemon"): the emptydatabase_idnow reads "the serving impl was not opened through the registry", matching theNodeEvent.database_idcomment innode_service.protothat Describe core's access gate and daemon seams without naming the Pro daemon #3363 settled.tauri-sync-listener.tsand its test header named aDomainEventForwarderthat no longer exists. They now describe the real path: the desktop watcher (app-lib/src/watcher.rs) opens the daemon'sWatchNodesstream and forwards each event as a Tauri event.Deviations from the issue
BASELINESis not lowered, per the coordinator's standing rule for the Pro-boundary epic (parallel PRs collide on those lines; Drive every Pro-boundary ratchet count to zero and make the check a hard ban #3371 tightens everything). The ratchet exits 0 with no count raised. This overrides the issue's acceptance criterion about lowering it.get_multi_membership_edgesdoc, the embedding test insqlite_store/mod.rs, the SQL comments inschema.rs, the push-channel docs andsubtree_access_gateinnode_service/mod.rs) are already gone on main through sibling PRs, so the grep now prints nothing.bulk_create_has_child's "safe for a from-scratch sweep" became "from-scratch batch", to match the rewordedbulk_create_has_child_edgesdoc.NodeService.event_txfield doc ("128 subscriber capacity") wasn't listed in the issue, but the acceptance criterion forbids any other comment saying the event channel holds 128, so it's fixed here.node_service/mod.rsedits sit on top of its wording.crud.rsneeded no change for this issue.Ratchet delta
bun run scripts/check-pro-boundary.ts,origin/main(066fac4) vs this branch (tenantWordingand every other marker unchanged):cloudWordingeditionBranchingproWordingNo count rises, so no baseline edit is needed and none of the three CLAUDE.md "may add Pro lines" classes applies.
Verification
git diff -U0 origin/main...HEAD | grep '^[+-]' | grep -v '^[+-][+-]' | grep -vE '^[+-]\s*(//|\*|/\*\*|\*/)'prints only the test-function rename and the assertion message string.DOMAIN_EVENT_CHANNEL_CAPACITYsizing history and the 128 → 4096 burst test. The store module's own privateDOMAIN_EVENT_CHANNEL_CAPACITY = 128constant (sqlite_store/mod.rs) is code, so it's out of scope here.SqliteStore::bulk_add_to_collectionswith the new doc, and its link resolves toNodeService#method.bulk_add_to_collections_notify. In the source,collection_typed_idscarries only its own three lines.RUSTDOCFLAGS='-D rustdoc::broken_intra_doc_links' cargo doc -p nodespace-core --no-deps --no-default-featuresfails to compile onmain:ops/context_ops.rsimportsNodeEmbeddingService, which that feature set configures out. Run with default features,-D rustdoc::broken_intra_doc_linksreports pre-existing broken links onmainin files this PR doesn't touch (schema_node.rs,rel_ops.rs,playbook/validation.rs,extends_chain.rs,schema/mod.rs,query_service/mod.rs,markdown/mod.rs,connections.rs). None is on a changed line, and no diagnostic mentions the moved doc's link.cargo fmt -p nodespace-core -p nodespace-daemon --check: clean.cargo clippy -p nodespace-core -p nodespace-daemon --all-targets -- -D warnings -D clippy::unused-async: clean.bun run --cwd packages/desktop-app quality:fix: 0 errors, 0 warnings, no file changes.bun run scripts/check-code-references.ts: 71 / 71 issue references, 0 doc-path references (unchanged).bun run test:changed: frontend, scripts, browser and Rust tiers pass. Nextest ran 4147 tests with 4147 passing, includingbulk_add_to_collections_notify_emits_relationship_events,bulk_membership_burst_does_not_overflow_the_event_channel,test_bulk_root_only_membership_is_enforced, the collection-name and person-duplicate convergence tests, andno_write_path_leaves_the_reverse_name_unpopulated.node_service/mod.rs, but its hunks (around lines 1644, 1991 and 9675) don't overlap this PR's, so either merge order applies cleanly.Closes #3364
🤖 Generated with Claude Code