Skip to content

Pare back #1736 to the generic access-gate seam only (no Pro-only error/UI plumbing in community core) #1870

Closed

Description

@malibio

Overview

#1736 landed the full vertical slice for the access-gated cascade delete: a SubtreeAccessGate trait + AlwaysAllowGate default (PR #1868), plus a complete error-propagation chain — NodeServiceError::InaccessibleDescendants, an OpsError variant, a dedicated gRPC FailedPrecondition status with x-inaccessible-descendants metadata, a CommandError code on the Tauri layer, and a terminal frontend refusal modal.

On review, that's more than nodespace-core (the community codebase) should carry right now. The trait/injection-point is genuinely generic infrastructure — matches the existing embedding_waker pattern for optional host-injected capabilities, has zero Pro-specific knowledge, and community installs are unaffected since AlwaysAllowGate is the only implementation that exists. That part is fine to keep.

The error/gRPC/frontend plumbing is different: it is real product surface (a distinct error type, a wire status code, user-facing copy) built and tested only against a synthetic stub gate, for a state (Denied) that cannot occur anywhere in the actual system today — no caller anywhere produces it. Shipping unreachable error paths and dead UI states in a community codebase for a feature only Pro will ever trigger cuts against this project's greenfield/no-speculative-code stance (see CLAUDE.md: no dead code, no building ahead of a real caller).

Proposed Solution

Pare nodespace-core back to exactly the generic seam:

  • Keep: SubtreeAccessGate trait, SubtreeAccessDecision enum, AlwaysAllowGate, the OnceLock-based injection point (set_subtree_access_gate / subtree_access_gate()) on NodeService, and the refactor that computes the subtree id set once (collect_subtree_ids) and threads it into delete_subtree_atomic. This is the stable extension point a future Pro daemon compiles against.
  • Remove from this repo: NodeServiceError::InaccessibleDescendants, the OpsError::InaccessibleDescendants variant + conversion, the x-inaccessible-descendants gRPC status mapping in packages/daemon/src/services/node_service.rs, the INACCESSIBLE_DESCENDANTS CommandError code path in packages/desktop-app/src-tauri/src/commands/nodes.rs, and the frontend refusal modal state (pendingRefusal in delete-confirmation.svelte.ts, the terminal UI in delete-confirmation-modal.svelte, isInaccessibleDescendants in errors.ts, and the now-unconditional-await change in reactive-node-service.svelte.ts's deleteNode — that non-optimistic-delete behavior was motivated entirely by the refusal case and can revert to the pre-CASCADE delete must abort when the subtree contains nodes the actor cannot read #1736 optimistic-for-leaf-nodes behavior once the refusal path doesn't exist).
  • The SubtreeAccessGate::check_subtree_access call in NodeService::delete_node stays, but its Denied branch becomes dead until the wire-up work below reintroduces it — actually, simplest: also revert the call site itself back to unconditional delete, and leave only the trait/gate machinery unused-but-present (a #[allow(dead_code)]-free, genuinely inert extension point with no caller), OR keep the call site if NodeService::delete_node returning a generic NodeServiceError::hierarchy_violation-style error for Denied is judged acceptable as a placeholder. Needs a decision during implementation — leaning toward keeping the call site (so the trait is provably wired to something real, not just theoretically pluggable) but mapping Denied to a generic existing error variant rather than a new bespoke one, until the real wire-up work (see companion issue below) gives it a proper typed error and UI treatment.

Companion work

The full error/gRPC/frontend wire-up (what's being removed here) should land together with nodespace-cloud#103's RPC, in a follow-up PR, once there's a real Pro-backed gate to test the refusal path against end-to-end instead of a synthetic stub. Tracked as part of nodespace-cloud#103's scope (that issue is being updated to absorb this).

Acceptance Criteria

  • SubtreeAccessGate trait, AlwaysAllowGate, and the NodeService injection point remain, unchanged in shape
  • collect_subtree_ids / delete_subtree_atomic signature refactor remains (no correctness regression, already tested)
  • NodeServiceError::InaccessibleDescendants, OpsError::InaccessibleDescendants, the gRPC status mapping, and the frontend refusal modal are removed
  • reactive-node-service.svelte.ts's deleteNode reverts to optimistic-for-leaf-nodes behavior (no unconditional await), since that change was solely in service of the now-removed refusal UX
  • Existing tests updated: the four Rust gate/OCC-precedence tests in node_service/mod.rs keep exercising Allowed vs. a gate decision, but assertions on the now-removed typed error are removed or adjusted to whatever placeholder behavior is decided
  • bun run test:all passes, bun run quality:fix clean

Related Issues

Activity

  1. malibio commented on Aug 1, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 170 test files passed, 4102 tests passed (49.28s)

  2. self-assigned this
    on Aug 1, 2026
  3. added a commit that references this issue on Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions