Skip to content

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

Closed

Description

@mstomar125

Summary

Reword 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. This covers:

  • the subtree access gate (ADR-041);
  • the shared router factory (ADR-043);
  • DbManagerLayer and the per-database gate factory (ADR-053);
  • NodeServiceImpl's registry id and accessor;
  • the "empty database_id" event convention that runs from the daemon through the proto to the Tauri watcher and window router;
  • the status-bar degrade for a daemon without EmbeddingsService.

Also drop the five GitHub issue citations in node_service.proto.

Comments and docs only. No behaviour, signature or wire change.

Context

  • ADR-081 (proposed) §2a says an extension point is named and documented for what it does, and its doc comments don't name nodespace-sync, Supabase, tenants or RLS. ADR-082 (proposed) §4 lists build_base_router and SubtreeAccessGate as the daemon seams.

  • Two of these docs are also stale:

    • The db_routing.rs module doc says the Pro daemon does not install DbManagerLayer, but nodespace-sync's nodespaced-pro/src/main.rs now wraps its server in DbManagerLayer::new(manager).
    • The desktop crate's commands/embeddings.rs says nodespaced-pro never registers EmbeddingsService, but it now passes one in BaseServices.

    The behaviour both docs describe is still correct and still needed:

    • Handlers fall back to their own single-database service set when no manager was injected. Directly-constructed test impls rely on this.
    • build_base_router takes embeddings: Option<..>. packages/daemon/src/services/assembly.rs only builds it when a model exists (shared.has_model.then(..), line 339 at af8ddb6), so any daemon started without a model answers Unimplemented.
  • The empty-id case. nodespaced installs DbManagerLayer in all four serve paths in packages/daemon/src/main.rs. An empty database_id therefore now comes only from an impl not opened through the registry, such as a test or a single-database host.

  • Proto comments are not checked today. scripts/check-code-references.ts scans only .rs, .ts, .svelte and .js, so the issue citations in packages/proto/proto/node_service.proto were never counted. Drive every Pro-boundary ratchet count to zero and make the check a hard ban #3371 adds .proto to that scan, and this PR removes the citations it would otherwise flag.

Locating the code

Each item is named by its symbol. Line numbers are hints at af8ddb6; re-locate with git grep -n '<symbol>'.

If #3322 has already split the desktop crate into a library and a thin app (ADR-082 §3), the Tauri files below live in the library package, not in src-tauri/src/. Find them with:

git ls-files -- 'packages/desktop-app/*/src/watcher.rs' 'packages/desktop-app/*/src/window_routing.rs' 'packages/desktop-app/*/src/commands/embeddings.rs' 'packages/desktop-app/*/src/skill_setup.rs'

That glob matches exactly those four files at af8ddb6. Below, <desktop>/ means whichever of packages/desktop-app/src-tauri/src/ or the library's src/ holds them.

Scope

packages/core/src/services/node_service/access_gate.rs

  • Module doc (lines 1-12).
    • Keep the first line and the OCC rationale, up to "being destroyed."
    • Replace the rest, from "Community installs" through the architecture/tenant-isolation-rls.md path. That covers community installs, the Pro daemon in nodespace-sync and "the Pro tenant schema (Postgres RLS)".
    • The new text: core has no actor or access model of its own, so its default gate allows everything. A host that enforces access elsewhere injects its own gate through NodeService::set_subtree_access_gate, an extension point (ADR-082). The gate is advisory: the host's own enforcement stays the authority, and the gate only lets the host refuse a local delete before it commits instead of after.
  • AlwaysAllowGate doc (39-43). Call it "core's default gate": core has no actor whose read access differs from the local user's, so there is nothing to check. Don't claim there are "no restricted collections", because embedding_roots.rs uses them.
  • set_subtree_access_gate doc (54-57). A host calls it once its gate is ready. Keep the "ignored if called more than once" and Arc notes.
  • subtree_access_gate doc (62-63). "The injected gate if one has been set, otherwise [AlwaysAllowGate] (core's default)."

packages/core/src/services/node_service/mod.rs

  • The NodeService.subtree_access_gate field doc (1366-1371).
    • Replace "community installs", "A Pro daemon (nodespaced-pro)" and "the Pro tenant connection".
    • The new text: the default keeps the unconditional cascade, and a host injects its own gate after construction (ADR-082). The gate is held in a OnceLock so it can be set once it is ready.
  • The comment above the access-gated delete tests (7757-7763) and the DenyIfPresentGate doc (7765-7767).
    • "Core's default is AlwaysAllowGate; these tests inject a stub gate that denies part of a subtree, since core has no access model of its own to exercise."
    • The stub "stands in for an injected gate reporting a descendant the actor may not read".

packages/core/src/services/node_service/crud.rs

  • The delete_node doc (1996-1999). "With core's default gate (AlwaysAllowGate) there is never a refusal here; only an injected gate can deny."

packages/daemon/src/router.rs

  • Module doc (1-7). "Shared gRPC router factory (ADR-043), one of core's daemon extension points (ADR-082)."
    • nodespaced calls it, and any other daemon built on this crate calls it and chains its own services on top.
    • Adding a BaseServices field is a compile error for every caller until it supplies the implementation, so no daemon silently falls behind the base set.
  • BaseServices doc (21-25). "Every daemon built on this crate constructs this and passes it to [build_base_router]; extra services are added after."
  • build_base_router doc (39-58).
    • "with all base services registered" and "can be extended with more services".
    • In the rust,ignore example, rename the "Pro extension" comment to "Extra service". Replace CloudSyncServiceServer::new(cloud_sync) with a neutral ExtraServiceServer::new(extra). Keep the with_message_limits! advice.

packages/daemon/src/db_routing.rs

  • Module doc (6-10). nodespaced's serve loops install the layer. A host that serves a single database may leave it out: its handlers then find no manager and serve their own single-database service set, which is also how directly-constructed test impls behave.
  • routed_database_services doc (41-43). "…which is how a host without the layer, and directly-constructed test impls, behave."
  • DbManagerLayer doc (93-95). Point at the module doc for what happens when a host leaves the layer out.

packages/daemon/src/services/assembly.rs

  • The SharedContext.subtree_gate_factory doc (61-77).
    • Open with: "Empty by default, so every database keeps NodeService's always-allow gate; a host that enforces access fills it in (ADR-082)."
    • "the wrong tenant" becomes "the wrong database's access rules".
    • "the Pro daemon cannot build this until after its cloud service exists" becomes "a host may only be able to build the factory after the DatabaseManager that holds this context exists".
    • "gated explicitly by the Pro daemon" becomes "gated explicitly by the host".
  • The gate-factory comment in the per-database open path (277-280). "against its own access rules"; "Absent unless a host installed a gate factory."
  • Not here: the ADR-073 origin comment naming is_sync_originated (404-410). Rename the origin-filtered event channel to subscribe_to_events_excluding_origin #3338 rewrites it with the origin rename.

packages/daemon/src/services/node_service.rs

  • The NodeServiceImpl.database_id doc (119-121). "Empty when the impl was not opened through the registry: a host serving one database without DbManagerLayer, or a test constructing the impl directly."
  • The with_database_id doc (175-177). "…left empty when the impl is not opened through the registry."
  • The node_service() accessor doc (191-195). "Lets a host that composes extra services over a registry-opened database reuse the same NodeService…" Keep the single-writer-lock rationale.
  • The two "not tenant-scoped" comments (1357, 1367). Both become "not database-scoped".
  • The accessor test's comment (3185-3187). "…so a host can compose over it without opening a second store on the same file."

packages/daemon/src/services/database_manager.rs

  • The spawn_idle_reaper doc (1052-1053). "the single-database community path is unaffected" becomes "a single-database install is unaffected".

packages/proto/proto/node_service.proto

  • The NodeEvent relationship-variant comment (567-571). Relationship events exist so that hierarchy changes made by another writer reach the frontend's structure tree. That writer can be another window, the CLI, an agent or an in-process writer. Drop "cloud-sync".
  • The NodeEvent.database_id comment (576-579). "Empty when the serving impl was not opened through the registry (a single-database host, or a test that constructs the service directly)."
  • Issue citations.

<desktop>/watcher.rs

  • The non_empty helper doc (46-50). "(a Pro daemon with no registry — …)" becomes "(an event from an impl not opened through the registry)".
  • The empty-id comment in forward (193-198). The same convention, without "(Pro daemon)".
  • The relationship-variant comment (241-242). "Relationship variants — so hierarchy changes made by any other writer (another window, the CLI, an agent, an in-process writer) reach the frontend's reactiveStructureTree."

<desktop>/window_routing.rs

  • The resolve_targets doc (86-87). Drop "e.g. a Pro daemon with no registry".

<desktop>/commands/embeddings.rs

  • The stale_count_from_result doc (224-237).
    • The new text: "Unimplemented collapses to Ok(0): the daemon serves no EmbeddingsService. A daemon registers it only when an embedding model was present at startup (BaseServices::embeddings is an Option), so there is no embedding queue and zero is the honest count."
    • The sentence at 234 becomes "because nodespaced's EmbeddingsService implements it". Keep the rest.
  • The get_stale_root_count doc (253-257). "(e.g. nodespaced-pro)" becomes "(no embedding model at daemon startup)".
  • Keep the match arm. The stale_count_unimplemented_maps_to_zero test already covers it.

<desktop>/skill_setup.rs

  • The run_installer_with_runtimes doc (916-923). Replace the "nodespace-sync hit exactly this class of bug with a mutated umask…" anecdote with the constraint itself: a test that narrows a process-global setting ($PATH, umask) races every other test in the same process.

Out of scope

Steps

  1. Follow CLAUDE.md's startup sequence:
    • pull main;
    • EnterWorktree({name: "issue-<N>-seam-docs"});
    • bun install, then the bun run test baseline;
    • self-assign at pickup and set In Progress.
  2. Confirm ADR-082 has merged, and cite it as ADR-082:
    git -C <docs> fetch origin main && git -C <docs> ls-tree --name-only origin/main decisions/ | grep '^decisions/082-'
  3. Locate each item by symbol (see "Locating the code"), then make the edits under Scope. Check every sentence against the code it documents, not against the old comment.
  4. Run bun run scripts/check-pro-boundary.ts. It fails with "lower BASELINES.<marker> to N" and prints a BASELINES block; paste it into scripts/check-pro-boundary.ts. The decreases measured at af8ddb6 are listed below; use the real output.
    • cloudWording −22
    • proWording −29
    • tenantWording −13
    • editionBranching −8
    • proProtocol −2
  5. Run the verification below, then finish:
    • bun run quality:fix, and commit;
    • git push origin HEAD:issue-<N>-seam-docs (the push check runs lint only);
    • gh pr create --head issue-<N>-seam-docs;
    • review per CLAUDE.md, and merge only with bun run merge <PR#> once approved.

Acceptance criteria

  • None of these edited files contains Pro, community (as an edition), nodespaced-pro, nodespace-sync, CloudSyncService, tenant, Supabase, RLS, cloud-sync or tenant-isolation-rls:

    • access_gate.rs, router.rs, db_routing.rs;
    • assembly.rs, outside the ADR-073 origin comment;
    • the daemon's services/node_service.rs;
    • watcher.rs, window_routing.rs, commands/embeddings.rs, skill_setup.rs;
    • the node_service.proto comments above.

    Neither do the listed symbols in core's node_service/mod.rs and crud.rs.

  • node_service.proto has no core#, issue # or #NNNN citation left.

  • Every new sentence is true of the code at this commit. In particular, db_routing.rs no longer claims that any daemon skips DbManagerLayer, and commands/embeddings.rs gives the no-model reason.

  • BASELINES in scripts/check-pro-boundary.ts is lowered to the counts the CLI prints, and bun run scripts/check-pro-boundary.ts exits 0.

  • bun run scripts/check-code-references.ts still passes, with no new issue or doc-path reference.

  • No code, signature or proto field changed. This shows only comment lines:

    git diff origin/main -- '*.rs' '*.proto' | grep '^[+-]' | grep -v '^[+-]\s*//' | grep -v '^[+-][+-]'

Tests and verification

  • cargo fmt --all --check
  • cargo clippy -p nodespace-core -p nodespace-daemon -p nodespace-proto -p <desktop package> --all-targets -- -D warnings.
  • Optional intra-doc link check: RUSTDOCFLAGS='-D rustdoc::broken_intra_doc_links' cargo doc -p nodespace-daemon --no-deps --no-default-features.
  • bun run test:changed. This runs the Rust tier, which takes the shared machine slot. The doctest in router.rs is rust,ignore.
  • Run bun run scripts/check-pro-boundary.ts --list cloudWording, then --list proWording. None of the files above should appear.
  • This grep prints nothing:
    git grep -n -I -P '(?i:nodespaced-pro|nodespace-sync|pro daemon|tenant|supabase|cloud-?sync|community)|CloudSync|\bRLS\b|\bPro\b' -- packages/core/src/services/node_service/access_gate.rs packages/daemon/src/router.rs packages/daemon/src/db_routing.rs $(git ls-files -- 'packages/desktop-app/*/src/watcher.rs' 'packages/desktop-app/*/src/window_routing.rs' 'packages/desktop-app/*/src/commands/embeddings.rs' 'packages/desktop-app/*/src/skill_setup.rs')
  • No test is added or removed. This PR changes comments only.

Dependencies

Risks and rollback


Plan key: C10.1 (pro-boundary DAG).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

pro-boundary

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions