← Back to Pull requests

fix(admin): carry namespaceid on appauth delete events #7962

Closed
unknown closed this pull request without merging on Oct 23, 2026 03:18 UTC
View on GitHub
unknown unknown commented on Oct 21, 2026 12:54 UTC
Author

What is the problem

AppAuthServiceImpl#delete built the AppAuthData of a DELETE event without a namespaceId, and published one event for the whole batch.

Data-changed listeners treat a null namespace as SYS_DEFAULT_NAMESPACE_ID:

  • Node-based sync (zookeeper / nacos / etcd / consul / apollo / polaris): AbstractNodeDataChangedListener#onAppAuthChanged builds the key prefix from default, so the key ns-A.<authDataId>.<appKey> is never deleted.

  • Websocket: WebsocketDataChangedListener groups by each item's namespace, so the DELETE message only reaches gateways of the default namespace.
  • Impact: after POST /appAuth/batchDelete in a non-default namespace (e.g. ns-A), gateways of ns-A keep the deleted appKey/secret, and signed requests with it are still accepted. If the default namespace has an app auth with the same appKey, that one is wrongly removed instead.

    What this PR does

  • Set namespaceId on every AppAuthData of the DELETE event. A missing value on a legacy row falls back to SYS_DEFAULT_NAMESPACE_ID, the same default the listeners use, so the delete is never rolled back by an NPE.

  • Group the deleted app auths by namespace and publish one DataChangedEvent(APP_AUTH, DELETE, data, namespaceId) per namespace. A batch spanning several namespaces is no longer routed by its first item only (findFirst() in the node listeners).
  • Delivery timing is unchanged: DataChangedEventDispatcher still defers every event to afterCommit. In cluster mode, ClusterDataChangedEventForwarder already forwards the event's namespaceId to the master.

    Tests

    AppAuthServiceTest:

  • deleting in ns-A and in the default namespace keeps the namespace on both the event and its data

  • a mixed batch (ns-A ×2, ns-B, default) publishes exactly 3 events, each with only its own app auths

  • a row without a namespace falls back to the default namespace

  • no event is published for empty/null ids, missing records, or 0 / -1 affected rows
  • Make sure that:

  • You have read the contribution guidelines.

  • You submit test cases (unit or integration tests) that back your changes.

  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.
  • Diff: 284 lines (+213 / -71) across 3 files Reviewer: Aias00 Review duration: 2304m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.63) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 284 lines diff across 3 files
    0.63
    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
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #7962"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 62.9% (MEDIUM) · Higher = larger blast radius
    62.9%
    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: 24.9% · Safe to merge
    24.9%
    Repository