← Back to Pull requests

fix(teardown): make the workshop sweep name-agnostic and eliminate residue #915

Closed
unknown closed this pull request without merging on Sep 21, 2026 14:14 UTC
View on GitHub
unknown unknown commented on Sep 20, 2026 11:47 UTC
Author

Problem

The Delete-time sweep (workshop/scripts/sweep-workshop-resources.py, run by the ClustersStackDeploy CodeBuild after task destroy) leaves orphaned residue on reused accounts. PR #914 (arbitrary spoke names) widens the gap: several sections key on the hard-coded <prefix>-spoke-dev / <prefix>-spoke-prod names, so a spoke created with an arbitrary name (e.g. oap-test) — and its VPC, IAM roles, secrets and log groups — escapes the sweep entirely. There is also no S3 sweep at all, so the Ray/vLLM model-cache bucket (2+ GB) persists and keeps billing.

Observed leftovers after a full teardown: spoke VPCs, unassociated EIPs, the -ray-models S3 bucket + deploy-staging bucket, arbitrarily-named-spoke IAM roles, and stale log groups.

Changes

  • Name-agnostic spoke discovery. New _discover_spokes() returns the union of the legacy name pattern and every non-hub EKS cluster carrying the #914 ownership tag platform.gitops.io/prefix=<prefix>. All downstream sections consume this list, so arbitrarily-named spokes are reaped too. Fully backwards-compatible — on pre-#914 environments the tag is simply absent and the legacy names are used.

  • New S3 section (8c). Reaps imperatively-created, unowned buckets under the resource prefix — the Ray/vLLM <prefix>-ray-models-<acct> (and <hub>-ray-models-<acct>) model cache and the self-serve <prefix>-workshop- deploy-staging bucket — the same unowned class as the ECR repo already handled in 8b. Empties all object versions + delete markers first. Prefix-scoped and region-checked, so shared bootstrap buckets (cdk-hnb659fds-, ws-assets-) are never matched.

  • IAM (7). Also reap roles/policies named after any discovered spoke (oap-test-cluster-role etc. do not start with the prefix); policies are now paginated.

  • Secrets Manager (8). Include discovered spoke names so an arbitrary spoke's <cluster>/config secret is force-deleted.

  • CloudWatch Logs (9). Broaden to /aws/eks/ and /aws/containerinsights/ for the hub and all discovered spokes, plus /aws/lambda/<prefix>- custom-resource log groups.

  • Elastic IPs (13). Also match the ownership tag and tag keys (not only tag values); still only releases UNASSOCIATED addresses.

  • Orphan VPC reaper (14). Add the platform.gitops.io/prefix tag to VPC discovery (catches any owned VPC regardless of name) and extend the ENI-detach retry budget from ~2 min to ~4 min (Auto Mode / KRO ENIs occasionally take longer than the old budget, which was leaving spoke VPCs behind).
  • Safety

  • Every deletion stays scoped to the resource prefix or a discovered owned spoke; the sweep still swallows all exceptions and exits 0 (never blocks the CFN delete).

  • S3 matching is prefix-scoped + region-scoped and explicitly cannot hit cdk-hnb659fds- / ws-assets-*.

  • EIP release remains guarded to UNASSOCIATED addresses only.
  • Testing

  • python3 -m py_compile workshop/scripts/sweep-workshop-resources.py passes.

  • Motivated by a real end-to-end teardown where an arbitrarily-named 3rd spoke plus the ray-models bucket / EIPs / spoke VPCs had to be cleaned by hand. Recommend a full provision → arbitrary-name spoke → destroy loop with an AWS residue check before merge.
  • Diff: 407 lines (+305 / -102) across 5 files Reviewer: shapirov103 Review duration: 1586m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 407 lines diff across 5 files
    0.50
    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.360
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #915"
    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: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    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: 19.7% · Safe to merge
    19.7%