Skip to content

Describe the access gate and daemon seams without naming the Pro daemon - #3401

Merged
mstomar125 merged 2 commits into
mainfrom
issue-3363-seam-docs
Oct 1, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-3363-seam-docs

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Summary

Rewords the docs of core's daemon extension points, and of the host conventions around them, so they describe the hook and name no product or repository (ADR-081 section 2a, ADR-082 section 4). Comments and docs only: no behaviour, signature, test or proto field change.

Covered:

  • the subtree access gate (ADR-041): access_gate.rs, plus the NodeService.subtree_access_gate field doc, the access-gated delete test comment and DenyIfPresentGate doc in node_service/mod.rs, and the delete_node doc in crud.rs;
  • the shared router factory (ADR-043): router.rs, including the rust,ignore example (ExtraServiceServer, with_message_limits! advice kept);
  • DbManagerLayer and the per-database gate factory (ADR-053): db_routing.rs, SharedContext.subtree_gate_factory and the per-database open-path comment in assembly.rs, and the spawn_idle_reaper doc;
  • NodeServiceImpl's registry id and accessor docs, and the two "not tenant-scoped" comments;
  • the empty database_id convention: the NodeEvent comments in node_service.proto, watcher.rs and window_routing.rs in app-lib. The non_empty doc in watcher.rs pointed at "NodeIdPayload::database_id's doc comment", which does not exist (that field has no doc), so it now points at the NodeEvent.database_id comment in node_service.proto, which states the convention;
  • the status-bar degrade for a daemon without EmbeddingsService (commands/embeddings.rs);
  • the run_installer_with_runtimes doc in skill_setup.rs now states the constraint (a test that narrows a process-global setting races every other test in the process) instead of an anecdote;
  • the five GitHub issue citations in node_service.proto are gone.

Two of these docs were stale and now say what the code does:

  • db_routing.rs claimed a daemon skips DbManagerLayer. nodespaced installs it in all four serve paths in main.rs; the single-database fallback it describes is still real (handlers find no manager and serve their own service set, as directly-constructed test impls do).
  • commands/embeddings.rs named a specific daemon as the one without EmbeddingsService. The real reason is shared.has_model.then(..) in assembly.rs: a daemon registers the service only when an embedding model was present at startup (BaseServices::embeddings is an Option). The Unimplemented to Ok(0) match arm and its test are untouched.

Deviations from the issue

  • The Tauri files are in packages/desktop-app/app-lib/src/ (crate nodespace-app-lib) after the crate split, so the issue's <desktop>/ paths resolve there.
  • ADR-082 (and ADR-081) are still proposed (NodeSpaceAI/nodespace-docs#89 to NodeSpaceAI/nodespace-docs#97), not on docs main; the docs cite ADR-082 ahead of its merge, as the epic's standing decision allows. ADR-041, ADR-043 and ADR-053 are on docs main.
  • BASELINES is 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.
  • The assembly.rs origin comment naming is_sync_originated is untouched (left to the origin-rename issue, as the issue says).

Ratchet delta

Counts at origin/main vs this branch (bun run scripts/check-pro-boundary.ts), matching the decreases the issue measured:

marker before after
cloudWording 72 50 (-22)
proWording 274 245 (-29)
tenantWording 453 440 (-13)
editionBranching 104 96 (-8)
proProtocol 95 93 (-2)

No count rises, so no baseline edit and none of the three CLAUDE.md "may add Pro lines" classes applies.

Verification

  • git diff origin/main -- '*.rs' '*.proto' | grep '^[+-]' | grep -v '^[+-]\s*//' | grep -v '^[+-][+-]' prints nothing: only comment lines changed.
  • The acceptance grep (nodespaced-pro|nodespace-sync|pro daemon|tenant|supabase|cloud-?sync|community|CloudSync|RLS|Pro) over the edited files prints nothing; the listed symbols in node_service/mod.rs and crud.rs are clean (other, out-of-scope mod.rs comments still carry sync wording and belong to sibling issues).
  • node_service.proto has no core#, issue # or #NNNN citation left.
  • bun run scripts/check-code-references.ts: 71 / 71 issue references, 0 doc-path references (unchanged).
  • cargo fmt -p nodespace-core -p nodespace-daemon -p nodespace-proto -p nodespace-app-lib --check clean.
  • cargo clippy -p nodespace-core -p nodespace-daemon -p nodespace-proto -p nodespace-app-lib --all-targets -- -D warnings -D clippy::unused-async clean (re-run for nodespace-app-lib after the watcher.rs pointer fix).
  • bun run test:changed (Rust and scripts tiers) green.
  • No test is added or removed, so there is nothing to mutation-test.

Closes #3363

🤖 Generated with Claude Code

@mstomar125

Copy link
Copy Markdown
Contributor Author

Automated pragmatic-code-review (medium) — commit d0b63a3

Review Type: Initial Review

Requirements Check:

  • ✅ access_gate.rs: module doc keeps the first line and the OCC rationale through "being destroyed", then adds the neutral default-gate and extension-point text (ADR-082) plus the advisory sentence. The AlwaysAllowGate, set_subtree_access_gate and subtree_access_gate docs match the Scope text. "No restricted collections" is not claimed.
  • ✅ node_service/mod.rs: field doc, access-gated delete test comment and DenyIfPresentGate doc are rewritten as specified. crud.rs delete_node doc is rewritten as specified.
  • ✅ router.rs: module doc, BaseServices doc and build_base_router doc are rewritten. The example uses ExtraServiceServer::new(extra) and keeps the with_message_limits! advice.
  • ✅ db_routing.rs: module doc, routed_database_services doc and DbManagerLayer doc are rewritten. No daemon is claimed to skip the layer.
  • ✅ assembly.rs: subtree_gate_factory doc and the per-database open-path comment match Scope. The out-of-scope ADR-073 origin comment is untouched.
  • ✅ Daemon services/node_service.rs: database_id doc, with_database_id doc, node_service() accessor doc, both "not database-scoped" comments and the accessor test comment match Scope.
  • ✅ database_manager.rs spawn_idle_reaper doc is done.
  • ✅ node_service.proto: relationship-variant comment and NodeEvent.database_id comment are rewritten, and all five issue citations are gone. The relationship-viewer comment reads "Relationship viewer: list…". grep -nE 'core#|issue #|#[0-9]{3,}' on the file prints nothing.
  • ✅ watcher.rs, window_routing.rs, commands/embeddings.rs (reason is no model at startup; match arm and test untouched) and skill_setup.rs (anecdote replaced by the constraint).
  • ✅ Acceptance grep over all 13 edited files prints nothing.
  • ✅ Non-comment diff check (git diff origin/main -- '*.rs' '*.proto' | grep …) prints nothing. The branch is one commit on top of origin/main.
  • ✅ bun run scripts/check-code-references.ts reports 71 (baseline 71) issue references and 0 doc-path references. The diff adds no issue-number text.
  • ✅ bun run scripts/check-pro-boundary.ts exits OK ("No count is above its baseline").
  • ⚠️ Authorized deviations, not defects: BASELINES is not lowered (standing rule for the Pro-boundary epic), and ADR-082 is cited while still proposed.

Truthfulness verification (every new sentence checked against code at HEAD):

  • db_routing.rs: DbManagerLayer::new(manager) is installed in all four serve paths in packages/daemon/src/main.rs. The no-manager fallback is true: routed_database_services returns Ok(None) with no manager and no header, and route_or_self then serves this. A header without a manager returns UNIMPLEMENTED, which the doc still says.
  • router.rs: build_base_router is called from all four serve paths in main.rs. The compile-error claim holds for struct-literal construction of BaseServices.
  • commands/embeddings.rs: shared.has_model.then(…) in assembly.rs, match services.embeddings { Some(emb) => …, None => router } in router.rs, and BaseServices::embeddings: Option<…> together support the no-model reason.
  • watcher.rs: the NodeEvent.database_id comment exists in node_service.proto and states the empty-id case, so the pointer resolves.
  • crud.rs: SubtreeAccessDenied is produced only through the injected-gate path.
  • assembly.rs: subtree_gate_factory defaults to an empty OnceLock and is read with .get() at the open path.
  • Intra-doc links: no new links were added, and the retained ones resolve.

Code Review Findings

Critical Issues: None.

Suggested Improvements: None.

Nitpicks (all optional, prose only):

  • 🟢 Nit: 📁 packages/daemon/src/services/node_service.rs:119-122 (and :177-179). The doc names DbManagerLayer as a cause of an empty database_id, but build_database_services stamps the id when a database is opened through the registry; the layer plays no part. The with_database_id doc is also tautological. Name the real condition instead: an impl the host builds itself rather than through DatabaseManager, or a test.
  • 🟢 Nit: 📁 packages/desktop-app/app-lib/src/skill_setup.rs:917-921. "races every other test in the same process" overclaims, since only tests that read the setting concurrently race. "Narrows" also fits $PATH better than umask.
  • 🟢 Nit: 📁 packages/core/src/services/node_service/mod.rs:1385-1386. In "so it can be set once it is ready", the second "it" is ambiguous.
  • 🟢 Nit: 📁 packages/proto/proto/node_service.proto:567-573 (mirrored in watcher.rs). "in-process writer" is undefined, and the same comment uses "in-process" in a different sense.

FYI, out of scope and not blocking. These untouched comments still carry the old wording or now disagree with the new convention, so they belong to sibling issues: packages/desktop-app/src/lib/types/event-types.ts:32, packages/desktop-app/src/lib/stores/database.svelte.ts:685 (the isActiveDatabaseEvent doc) and packages/core/src/services/embedding_processor.rs:547.

Recommendation: APPROVE. The change is comment-only, every Scope item is covered, and the rewritten sentences are true at HEAD. The nits are optional.

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above: 0 critical, 0 improvements, 4 optional prose nits.

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address-review — commit 2893008

The review returned APPROVE with 0 critical and 0 important findings and 4 optional prose nits. I checked each nit against the code before acting, and all four are addressed (4/4 addressed, 0 skipped). The commit changes comments only.

  • ✅ Nit 1: daemon services/node_service.rs, database_id and with_database_id docs. Confirmed: with_database_id has one production caller, build_database_services in assembly.rs, and only DatabaseManager calls that. DbManagerLayer does not stamp the id. The database_id doc now names the real cause of an empty id: an impl a host builds itself rather than through DatabaseManager, or one a test constructs directly. The with_database_id doc no longer restates itself.
  • ✅ Nit 2: skill_setup.rs. Now reads "a test that changes a process-global setting ($PATH, umask), even if restored afterward, can race any other test in the process that reads it concurrently". This also reflows a short orphan line.
  • ✅ Nit 3: node_service/mod.rs. "so the gate can be set once it is ready."
  • ✅ Nit 4: node_service.proto and watcher.rs. "an in-process writer" becomes "a writer inside the daemon" in both. While checking this nit I found that the proto comment's last sentence ("Mirrors the in-process DomainEventForwarder's relationship:* Tauri events"), carried over unchanged from the original, names a component that no longer exists: there is no DomainEventForwarder in any Rust crate, because the in-process forwarder went away when the app moved to an external daemon. The sentence now says what happens today: the desktop watcher forwards these as the relationship:* Tauri events (watcher.rs emits relationship:created, relationship:updated and relationship:deleted).
  • ⏭️ FYI items (event-types.ts, database.svelte.ts isActiveDatabaseEvent, embedding_processor.rs): out of scope for this issue, as the review notes; they belong to the sibling Pro-boundary issues.

Verification after the fixes:

  • Only comment lines changed (the git diff origin/main -- '*.rs' '*.proto' | grep … check prints nothing).
  • The issue's acceptance grep over the scoped files prints nothing.
  • node_service.proto has no issue citation.
  • check-pro-boundary.ts: no count above its baseline.
  • check-code-references.ts: 71/71.
  • cargo fmt --check passes, and cargo clippy -p nodespace-core -p nodespace-daemon -p nodespace-proto -p nodespace-app-lib --all-targets -- -D warnings -D clippy::unused-async is clean.
  • bun run test:changed (scripts and Rust tiers) is green.

Re-Review Decision

Decision: RE-REVIEW NEEDED. The address-review criteria alone would not require one, but core's merge policy does. The diff is comments only and small, but one sentence changes what it claims (the proto relationship comment now describes the watcher rather than a removed forwarder), so a second reviewer should check it against the code.

@mstomar125

Copy link
Copy Markdown
Contributor Author

Automated pragmatic-code-review (medium) — Re-Review of commit 2893008

Previous Review Summary: 4 previous recommendations, 4 addressed, 0 not addressed, 0 new issues (one optional nit below).

Per-nit status

  1. ✅ Daemon database_id / with_database_id docs (node_service.rs:119-122, :176-178).
    • with_database_id has one production caller (assembly.rs:332), inside build_database_services.
    • build_database_services has two production callers, database_manager.rs:479 and :956, both in DatabaseManager. The :2243 caller is a test.
    • The other with_database_id callers, and every other NodeServiceImpl::new caller, are tests.
    • DbManagerLayer is no longer named as a cause.
  2. ✅ skill_setup.rs:917-922: "a test that changes a process-global setting … can race any other test in the process that reads it concurrently." The claim is accurate and the paragraph wraps cleanly.
  3. ✅ node_service/mod.rs:1385-1386: "so the gate can be set once it is ready." This matches set_subtree_access_gate, which calls self.subtree_access_gate.set(gate).
  4. ✅ Proto and watcher.rs relationship comments: "a writer inside the daemon" is used in both.
    • (a) git grep DomainEventForwarder -- '*.rs' is empty.
    • (b) watcher.rs forward() emits relationship:created, relationship:updated and relationship:deleted.
    • The daemon's WatchNodes maps DomainEvent::Relationship{Created,Updated,Deleted} to those variants.
    • So "The desktop watcher forwards them as the relationship:* Tauri events" is true at HEAD.

Mechanical checks:

  • The non-comment-line check on the commit prints nothing.
  • The added lines contain no issue-number text and no Pro or product wording, and none exceeds 100 columns.

Code Review Findings

Critical Issues: None.

Suggested Improvements: None.

Nitpicks (optional):

  • 🟢 Nit: 📁 packages/daemon/src/services/node_service.rs:176-178. "an impl built any other way keeps the empty default" is a shade broader than the code. build_database_services and with_database_id are both pub, so a caller that uses either directly gets a stamped id without going through DatabaseManager, as the test at database_manager.rs:2243 does. Not worth blocking.

FYI, out of scope: tauri-sync-listener.ts:5 and tauri-sync-listener.test.ts:26 still name the removed DomainEventForwarder in TS comments. The earlier FYI items are untouched.

Recommendation: APPROVE. All four nits are addressed. The commit is comments only, and every new sentence is true at HEAD.

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Automated pragmatic-code-review re-review: APPROVE (posted as a comment — GitHub blocks self-approval). 4/4 previous nits addressed, 0 new issues; one optional nit. Full report in the comment above.

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address-review — re-review round (no new commit)

The re-review returned APPROVE: 4/4 previous nits addressed, 0 new issues, and one optional nit. I made no code change in this round.

  • ⏭️ Skipped: the optional nit on the with_database_id doc (packages/daemon/src/services/node_service.rs:176-178). The suggested rewording ("Set by build_database_services when a database is opened; an impl constructed without it keeps the empty default") has the same kind of edge case it is meant to fix. The test at node_service.rs:5180-5186 builds the impl with NodeServiceImpl::new(...), not build_database_services, then calls .with_database_id("db-a") directly, so it gets an id. Because both functions are pub, the only fully precise wording is "empty unless this method is called", which is the tautology the first review asked us to remove. The current text describes every production path in the repo: with_database_id's only production caller is build_database_services, and that is called only from DatabaseManager. Revisit if a host outside DatabaseManager starts calling build_database_services.
  • ⏭️ FYI items (TS comments still naming DomainEventForwarder, plus the earlier event-types.ts, database.svelte.ts and embedding_processor.rs items): out of scope for this issue and left to the sibling Pro-boundary issues.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED. Nothing changed in this round, and the PR head (28930088) is the commit the re-review approved. Two APPROVE reviews are now on record: the initial review of d0b63a32 and the re-review of 28930088. The PR is ready for the merge gate (bun run merge 3401), which is the coordinator's call.

mstomar125 and others added 2 commits October 1, 2026 09:01
Reword the docs of the subtree access gate, the shared router factory,
DbManagerLayer and the per-database gate factory, NodeServiceImpl's
registry id and accessor, the empty database_id event convention (daemon
through proto to the Tauri watcher and window router), and the
EmbeddingsService status-bar degrade so each describes the hook and names
no product or repository. Two docs were also stale (db_routing's claim
that a daemon skips DbManagerLayer, and the embeddings degrade reason)
and now state what the code does. The watcher's empty-id note pointed at
a NodeIdPayload::database_id doc that does not exist; it now points at
the NodeEvent.database_id comment in node_service.proto, which states the
convention. Drop the issue citations from node_service.proto.

Comments and docs only; no behaviour, signature or wire change.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- NodeServiceImpl.database_id / with_database_id: name the real cause of
  an empty id (an impl built outside DatabaseManager, or a test) instead
  of DbManagerLayer, which does not stamp the id.
- NodeEvent relationship comment (proto) and the watcher's matching
  comment: "a writer inside the daemon" replaces the undefined
  "in-process writer", and the proto no longer cites the removed
  in-process DomainEventForwarder; it says the desktop watcher forwards
  these as the relationship:* Tauri events.
- NodeService.subtree_access_gate: disambiguate "it" (the gate).
- run_installer_with_runtimes: a changed process-global setting can race
  tests that read it concurrently, not every test.

Comments only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

Describe core's access gate and daemon seams without naming the Pro daemon

1 participant