← Back to Pull requests

fix(platform): delete legacy tokens via controller API (AAP-74711) #3550

Closed
unknown closed this pull request without merging on Sep 09, 2026 18:35 UTC
View on GitHub
unknown unknown commented on Sep 08, 2026 21:26 UTC
Author

Summary

Fixes legacy OAuth2 token deletion in the platform UI. useDeleteAAPUserTokens was sending all DELETE requests through gatewayAPI (/api/gateway/v1/tokens/<id>/), which does not own legacy OAuth2AccessToken resources, causing "No OAuth2AccessToken matches the given query."

Deletion is now routed by token.type:

  • Legacy tokens (o_auth2_access_token) → awxAPI (uses the configured controller prefix, e.g. /api/controller/v2/tokens/<id>/)

  • Regular tokens (Access Token) → gatewayAPI (unchanged)
  • Adds regression tests for legacy deletion, gateway deletion, mixed bulk deletion, and type-based routing precedence.

    Cherry-picked from ansible-automation-platform/aap-ui (lgalis/AAP-74711/fix-legacy-token-deletion).

    Type of Change

  • Bug fix

  • Tests
  • Risk Analysis - REQUIRED

  • High — Broad platform impact (e.g., SWR config, shared framework components, authentication, routing, API wrappers, build/bundler config). Changes affect multiple workspaces or could cause widespread regressions.

  • Medium — Scoped but cross-cutting (e.g., shared utility functions, changes to multiple pages within one workspace, component library updates, test infrastructure). Limited blast radius but touches common code paths.

  • Low — Narrowly scoped (e.g., single page fix, styling tweak, documentation, test-only changes, copy/string updates). Minimal risk of unintended side effects.
  • Dependencies

    None.

    Testing

    Ephemeral E2E Tests

    Once PR is ready and preliminary checks pass, trigger tests by posting a comment /run-playwright on this PR.

    Tests run against a fresh AAP instance (version based on branch).

    Manual Testing

  • Delete a legacy OAuth2 token (o_auth2_access_token) and confirm it succeeds without the "No OAuth2AccessToken matches the given query" error

  • Delete a gateway-managed Access Token and confirm it still deletes via the gateway API

  • Bulk-delete a selection containing both legacy and gateway tokens
  • Diff: 251 lines (+188 / -63) across 3 files Reviewer: keithjgrant Review duration: 1268m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.62) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 251 lines diff across 3 files
    0.62
    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.331
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #3550"
    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.2% (MEDIUM) · Higher = larger blast radius
    62.2%
    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.6% · Safe to merge
    24.6%