← Back to Pull requests

teardown.sh: read multi-line 404s and deleted service accounts as already gone; quiet revokes #123

Merged
aditya-shantanu merged 3 files (233 lines) on Nov 03, 2026 22:46 UTC
View on GitHub
aditya-shantanu aditya-shantanu commented on Nov 03, 2026 21:21 UTC
Author

Seen on a real teardown (friction #30–#32): a re-run after everything was deleted, and a run with the wrong CLUSTER_LOCATION, ended with FAILED: delete cluster / FAILED: delete node service account and "Resources from these steps may still exist (and bill)" when nothing did; every revoke printed the project's whole IAM policy.

already_gone now reads gcloud's whole error block from its ERROR: line on, not just that line. gcloud container clusters delete prints Some requests did not succeed: and puts the code=404 on the next line. This also lets the existing "cluster exists in another location" check run.
Service account deletes: IAM answers an account deleted in the last 30 days with PERMISSION_DENIED ... (or it may not exist), the same words as a denied delete of an existing account (verified read-only: describe gets the same answer, so it cannot tell the cases apart; list omits deleted accounts). The step now lists the project's accounts: absent counts as deleted, present fails the step and says the delete was denied, a denied listing warns and counts it as deleted, as the cluster step already does for a denied clusters list.

  • remove-iam-policy-binding (project and bucket) passes --format=none (verified with gcloud 583.0.0; Updated IAM policy for project [...] still prints).
  • Tests: the fake gcloud can return multi-line errors; new tests use the texts gcloud printed, cover the four outcomes of the service account check, a plain denial, and that every revoke passes --format=none. go test ./tools/setup-gcp/... passes; bash -n and shellcheck show nothing new.

    tools/cleanup-gcp runs this repository's teardown.sh directly, so nothing to bump there.

    Fixes #117

    Diff: 233 lines (+199 / -34) across 3 files Reviewer: annapendleton Review duration: 85m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.39) × (1 − Review Confidence (0.48)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 233 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.00 · 1 substantive comment(s)
    0.00
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    48%
    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
    Shallow Review Depth shallow_review_depth
    0.350
    Diff Size diff_size
    0.326
    Real PR Conversation Timeline
    2 items
    annapendleton annapendleton approved these changes on Nov 03, 2026 22:46 UTC
    Approved Reviewer

    LGTM

    Reviewers
    Assignees
    aditya-shantanu aditya-shantanu
    Labels
    risk: low confidence: 48.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: 38.6% (MEDIUM) · Higher = larger blast radius
    38.6%
    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: 48.5% · Lower = rushed or shallow review
    48.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.9% · Safe to merge
    19.9%