← Back to Pull requests

feat(api): add delete_namespace rpc for empty namespaces #377

Closed
unknown closed this pull request without merging on Nov 13, 2026 06:40 UTC
View on GitHub
unknown unknown commented on Nov 12, 2026 18:46 UTC
Author

Adds DeleteNamespace and the delete_namespace MCP tool. They remove a namespace from the registry, and the namespace then leaves ListNamespaces. Empty namespaces stay listed until someone deletes them.

Rules:

  • Admin role only, like MoveNamespace. A caller bound to an owner can only delete inside its own owner.

  • Refused with FAILED_PRECONDITION unless the namespace has no entity on baseline and on every branch. The check reads the full snapshot, not the caller's view. It refuses when a snapshot is truncated.

  • Refused while a source registration names the namespace as administration or destination.

  • Protections block deletion, because protected entities count as entities.

  • Refused for a legacy namespace whose id is its name. A later write could re-adopt its history under another owner.
  • Example: acme-probe is empty, so delete_namespace removes it. acme-orders holds one entity on a branch, so it is refused.

    Closes #112

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Medium Risk

    Admin-only registry mutation with cross-tenant visibility checks and grant lifecycle ordering; mistakes could remove namespace metadata or leave grants inconsistent if behavior regresses.

    > Overview

    Adds DeleteNamespace on the Event Model API and the admin-only MCP tool delete_namespace, so callers can remove a namespace from the registry when it is truly unused.

    > Deletion is refused unless the namespace has no entities on baseline and on every branch (full-store view, not the caller's lens), snapshots are not truncated, the id is not a legacy namespace whose id equals its name, and no source registration names it as administration or destination. Admins bound to an owner may only delete within their subtree; writers cannot call it. Grants are revoked before the registry row is removed so a failed revoke leaves the row for safe retry.

    > Docs list delete_namespace alongside other administration tools with no MCP profile.

    > <sup>Reviewed by Cursor Bugbot for commit 712eec05a14f675056d8c73bb0d46f14870a7198. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    Diff: 283 lines (+212 / -71) across 3 files Reviewer: yordis Review duration: 713m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 283 lines diff across 3 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.338
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #377"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.7% (MEDIUM) · Higher = larger blast radius
    44.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%