Skip to content

AIGS-26 Add stage smoke test, rollback runbook and alert map - #2320

Open
wjames111 wants to merge 8 commits into
mainfrom
AIGS-26
Open

wjames111 wants to merge 8 commits into
mainfrom
AIGS-26

Conversation

@wjames111

Copy link
Copy Markdown
Contributor

Links

Description

R5 safety nets for MPDX React: know when a deploy breaks, who hears about it, and how to undo it.

  • Stage smoke test. A new workflow runs after every staging update. It waits for stage.mpdx.org to serve the new commit, then checks that the login page renders, the build's JavaScript loads, Okta sign-in is offered, and the stage GraphQL API answers. The checks are in scripts/stage-smoke-test.sh so you can run them locally too.
  • Runbook. docs/safety-nets.md lists which alert goes to whom, how Caleb's self-healing agent is hooked up, how to check the alert path in 5 minutes, and how to roll back (Amplify redeploy, or a git revert). It ends with a drill log.
  • Linked the runbook from scripts/safety-nets/README.md.

No app code changes. The workflow runs from workflow_run because update-staging.yml pushes with GITHUB_TOKEN, which never fires a push event.

Testing

  • Run scripts/stage-smoke-test.sh "$(git ls-remote origin refs/heads/staging | cut -f1)" and check it ends with "Smoke test passed".
  • Run WAIT_SECONDS=1 POLL_SECONDS=1 scripts/stage-smoke-test.sh deadbeef and check it fails with "never served deadbeef".
  • After this is on staging, push to staging (or wait for the next staging update) and check the "Stage smoke test" run in the Actions tab passes.

AI review

Findings I did not fix, and why:

Checklist:

  • My PR title is the work item key, then a summary of 80 characters or less (example: MPDX-1234 Add sortable columns)
  • I have applied the appropriate labels (Add the label "Preview Environment" to automatically create a preview environment)
  • I have run the Claude Code /agent-review:review command locally and fixed each finding or listed it above
  • The github-actions bot has approved the PR (it approves once /agent-review:review leaves no open blockers; it never approves a one-way door)
  • I have asked a person to review, if this is a one-way door (it touches a path .github/CODEOWNERS gives an owner)
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

🤖 Generated with Claude Code

@wjames111 wjames111 added On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview labels Nov 30, 2026
@wjames111 wjames111 self-assigned this Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview branch generated at https://AIGS-26.d3dytjb8adxkk5.amplifyapp.com

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against c8a4738

No significant changes found

@wjames111

wjames111 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 agent-review · ✅ no blockers · risk MEDIUM · 👤 needs a person
advisory · 5 agents run (Code Review (/code-review xhigh), Security, Data Integrity, Testing, Standards)

BLOCKERS: fix or dismiss to pass

  • #1 · 7/10 · .github/workflows/stage-smoke-test.yml:12 · Workflow-level concurrency with cancel-in-progress lets a skipped Update staging run cancel a real smoke test in progress, so the new staging build is never checked. · ✅ fixed in fee4a99

👤 Needs a person's approval: PCI path: .github/workflows/stage-smoke-test.yml. The bot will not approve this PR.

OTHER FINDINGS (17)

  • #2 · 4/10 · scripts/stage-smoke-test.sh:19 · curl | grep -q under pipefail can fail when grep exits early and curl gets a write error, so checks can flake on a healthy deploy. · ✅ fixed in fee4a99
  • #3 · 4/10 · scripts/stage-smoke-test.sh:19 · No curl call sets a timeout, so a hung connection runs into the 45-minute job timeout. · ✅ fixed in fee4a99
  • #4 · 4/10 · scripts/stage-smoke-test.sh:19 · The build-live check depends on the commit SHA appearing in /login HTML via the RUM config; if that changes, every run waits 40 minutes and blames Amplify. · 🚫 dismissed by @wjames111 [intentional]: the page embeds the build SHA through the RUM config and the error message now says to check that too
  • #5 · 4/10 · scripts/stage-smoke-test.sh:28 · The Sign In check is a case-insensitive grep that also matches help text, so it passes even if the button is gone. · ✅ fixed in fee4a99
  • #6 · 3/10 · .github/workflows/stage-smoke-test.yml:1 · No permissions: block, so the token gets the repo default scope though the job only reads. · ✅ fixed in fee4a99
  • #7 · 3/10 · .github/workflows/stage-smoke-test.yml:16 · No permissions block; same as Remove ts-node #6. · ✅ fixed in fee4a99
  • #8 · 3/10 · .github/workflows/stage-smoke-test.yml:25 · A git ls-remote failure inside the echo is swallowed, giving a misleading "commit sha required" error. · ✅ fixed in fee4a99
  • #9 · 3/10 · scripts/stage-smoke-test.sh:9 · On busy days the 40-minute wait may be shorter than Amplify's queue. · 🚫 dismissed by @wjames111 [intentional]: WAIT_SECONDS is configurable and 40 minutes is well past normal Amplify build time
  • #10 · 3/10 · scripts/stage-smoke-test.sh:27 · Page checks run on a second /login fetch that is not verified to be the new build. · ✅ fixed in fee4a99
  • #11 · 3/10 · scripts/stage-smoke-test.sh:31 · If the manifest is missing, grep exits 1 under pipefail and set -e kills the script before the fail message prints. · ✅ fixed in fee4a99
  • #12 · 5/10 · scripts/stage-smoke-test.sh:25 · The poll loop keeps partial /login HTML when curl fails (for example a timeout after the head arrives), so a matching SHA can break the loop and later checks fail with a misleading reason. · ✅ fixed in f308347
  • #13 · 4/10 · .github/workflows/stage-smoke-test.yml:21 · A newer non-skipped run still cancels an older run that is checking a real deploy, so the author of the earlier breaking change gets no failure email. · ✅ fixed in f308347
  • #14 · 4/10 · scripts/stage-smoke-test.sh:28 · Because fetch uses curl -f, a /login that returns 5xx yields no body, so the loop waits the full WAIT_SECONDS and blames the Amplify build. · ✅ fixed in f308347
  • #15 · 4/10 · scripts/stage-smoke-test.sh:42 · The post-live checks now have a 30 second timeout with a single try, so one slow cold start or brief 502 fails an otherwise healthy deploy. · ✅ fixed in f308347
  • #16 · 3/10 · .github/workflows/stage-smoke-test.yml:19 · Commit fee4a99 bundles about nine unrelated fixes, which goes against the one-logical-change-per-commit rule. · 🚫 dismissed by @wjames111 [intentional]: one commit per review round keeps the fix commits easy to find
  • #17 · 3/10 · scripts/stage-smoke-test.sh:34 · The exact >Sign In< match fails on non-Okta sites where the button text differs, giving a misleading no-button error. · 🚫 dismissed by @wjames111 [intentional]: stage.mpdx.org always uses Okta and its button text is Sign In
  • #18 · 3/10 · scripts/stage-smoke-test.sh:43 · Network failures on the providers and GraphQL checks become empty strings, so the error annotation describes a content problem instead of a request failure. · ✅ fixed in f308347
🔧 Fix suggestions (0)

No automated fixes for this review.

📦 Dependency impact

Blast radius: 0 files. No app code changed.

📊 Review detail & stats

Generated: 2026-11-30 · Day: Monday · Files changed: 4 (+154 -0 lines)
Risk score: 6 · MEDIUM · Required reviewer: entry

Risk factors detected: unmatched risk paths: scripts/safety-nets/README.md, scripts/stage-smoke-test.sh

Deterministic evidence:

  • AST/static rules: none
  • CI snapshot: unavailable
  • Cross-repo context: none

Agent summary (bands: Critical 9-10 · High 7-8 · Important 5-6 · Suggestions 3-4):

Agent Critical High Important Suggestions Confidence
Code Review (/code-review xhigh) 0 1 0 8 H
Security 0 0 0 1 H
Data Integrity 0 0 0 0 H
Testing 0 0 0 2 H
Standards 0 0 0 0 H
Total 0 1 0 11 -

Per-agent perspectives on blockers:

  • #1 · Code Review (Severity: 7/10): skipped upstream runs cancel the live smoke test

Engine: code-review (from config) · effort xhigh (from config) · model opus (from config)
/code-review findings: found 11 · scored 10 · dropped 1 (first pass); re-review since 0e8505d: found 7 · scored 7 · dropped 0

  • docs/safety-nets.md:67 Stage rollback steps only revert one of possibly many staging merges of the PR: excluded path: docs/**
💬 How to act on this review

Every finding above is numbered. Severity ≥ 7 findings carry a checkbox and must each be fixed or dismissed before this review counts as passed; lower severities are advisory. This repo runs reviews locally only, so work this ledger with /agent-review:address in a Claude Code session. Valid codes: false-positive, intentional, pre-existing, deferred, duplicate, insufficient-evidence, other.

@github-actions github-actions Bot added the needs-human-approval agent-review: a person must approve this PR label Nov 30, 2026
@jbirdjavi

Copy link
Copy Markdown
Contributor

🤖 agent-review · ✅ no blockers · risk CRITICAL · 👤 needs a person
Rollout: advisory · 5 agents run (Code Review (/code-review xhigh), Security Review Agent, Data Integrity Review Agent, Testing & Quality Review Agent, Standards Compliance Review Agent)

BLOCKERS: fix or dismiss to pass

✅ No blockers.

👤 Needs a person's approval: PCI path: .github/workflows/stage-smoke-test.yml. The bot will not approve this PR.

OTHER FINDINGS (6)

  • #1 · 5/10 · scripts/stage-smoke-test.sh:26 · The poll uses curl -f, which drops the body of a 4xx/5xx response, so a new build whose /login errors is never seen as live. The job then waits the full 40 minutes and blames the Amplify build instead of reporting a broken /login. (code-review)
  • #2 · 4/10 · .github/workflows/stage-smoke-test.yml:21 · GitHub keeps only one pending run per concurrency group, so cancel-in-progress: false still lets a newer run cancel an already pending one, and the comment saying every deploy gets checked is wrong. The canceled deploy's author gets no failure email. (code-review)
  • #3 · 4/10 · .github/workflows/stage-smoke-test.yml:29 · Each run pins the staging SHA it reads at start and passes only when /login serves that exact SHA. If that commit's build is skipped or fails but a newer commit deploys fine, the run fails after 40 minutes with a false alarm. (code-review)
  • #4 · 3/10 · .github/workflows/stage-smoke-test.yml:23 · timeout-minutes: 45 is below the script's worst case of about 48 minutes, so the job can be killed before the script prints its own error. The run then shows a generic timeout instead of the failing check. (code-review)
  • #5 · 3/10 · scripts/stage-smoke-test.sh:22 · The poll-and-check logic (SHA match, timeout, each failure branch) has no automated test, so a regression in the script only shows up as a false red or false green on a real stage deploy. (testing)
  • #6 · 2/10 · docs/safety-nets.md:23 · The doc contains an em dash, which the org writing rule forbids. (standards)
🔧 Fix suggestions (0)

No automated fixes for this review.

📦 Dependency impact

Blast radius: 0 files. No changed file is imported by any other file (a CI workflow, a shell script, docs, and agent-review bookkeeping).

📊 Review detail & stats

Generated: 2026-12-01T15:42Z · Day: Tuesday · Files changed: 6 (+189 -0 lines)
Risk score: 12 · CRITICAL · Required reviewer: senior maintainer

Risk factors detected: .github/workflows/** (critical path); unmatched risk paths scripts/safety-nets/README.md, scripts/stage-smoke-test.sh (the risk map does not know scripts/** yet); scope core_infra (x2)

Deterministic evidence:

  • AST/static rules: none (local run, no workflow evidence file)
  • CI snapshot: workflow evidence unavailable on a local run. Read from GitHub at head 7ea39ea: 2 failed, the rest passed. Failed: security / Static security scan (Semgrep github-actions-mutable-action-tag, blocking, on .github/workflows/stage-smoke-test.yml:25 actions/checkout@v7; it flags only this new file because the scan skips findings already in the base, and every other workflow here also uses tags) · update-staging (GitHub returned 409 The rule did not run because of a timeout to the merge into staging; not caused by this diff, a re-run should clear it)
  • Cross-repo context: none

Agent summary (bands: Critical 9-10 · High 7-8 · Important 5-6 · Suggestions 3-4 and below):

Agent Critical High Important Suggestions Confidence
Code Review (/code-review xhigh) 0 0 1 3 M
Security Review Agent 0 0 0 0 H
Data Integrity Review Agent 0 0 0 0 H
Testing & Quality Review Agent 0 0 0 1 M
Standards Compliance Review Agent 0 0 0 1 M
Total 0 0 1 5 -

Per-agent perspectives on blockers: no blockers.

Engine: code-review (from config) · effort xhigh (from config) · model opus (from config)
/code-review findings: found 7 · scored 4 · dropped 3 (scored findings under the
profile's cutoff may not appear in the lists above)

  • docs/safety-nets.md:67 stage-only rollback steps omit that re-merging the branch will not restore reverted changes without reverting the revert: excluded path: docs/**
  • docs/safety-nets.md:19 doc says Rollbar errors reach Datadog, but code sends them to Rollbar only: excluded path: docs/**
  • docs/safety-nets.md:37 doc says the workflow waits then runs the script, but the script itself waits up to 40 minutes, and the trigger description is too broad: excluded path: docs/**

Notes:

  • ignored unknown argument(s): 2320

Review quality:

  • Average agent confidence: Medium · Consensus rate: 0% (6 singletons, no overlapping findings) · Review time: 14 minutes
  • Findings suppressed by approved learnings: 0
💬 How to act on this review

Every finding above is numbered. Severity ≥ 7 findings carry a checkbox and must each be fixed or
dismissed
before this review counts as passed; lower severities are advisory. This repo runs
reviews locally only, so work this ledger with /agent-review:address in a Claude Code session.
It fixes or dismisses findings (a reason code and explanation are required for a dismissal) and
keeps this comment in sync. Valid codes: false-positive, intentional, pre-existing,
deferred, duplicate, insufficient-evidence, other.

@jbirdjavi jbirdjavi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Will. This looks good. The smoke test has passed on every staging push so far, it only reads public pages, and its token can't write to the repo.

A few small things, none of them blocking:

  1. The red Semgrep check comes from the org's shared security scan (CruGlobal/.github, added Nov 12). Its Semgrep pack flags any action used by a tag, but only on lines a PR adds, so this is the first workflow file here to trip it. We use tags everywhere, so no change is needed unless it stops the merge. If it does, pinning actions/checkout in stage-smoke-test.yml to a commit SHA clears it.
  2. The alert-path check in the runbook uses the MPDX React safety-net test [stage] monitor, which comes from cru-terraform#13703. That PR is still open, so the check won't fire until it's applied. Worth a note in the doc, or merge the two together.
  3. The runbook says the monitors and synthetics live in datadog.tf. The monitors do, but I couldn't find MPDX React Production Synthetic Test anywhere in cru-terraform. Can you point the doc at where it lives?
  4. git revert -m 1 <merge commit> only works on merge commits. Some PRs on main are squash merged, and for those it's plain git revert <commit>. For the stage-only steps, it would also help to say that bringing the change back takes a revert of the revert, like your drill did.
  5. The runbook says errors reach Datadog two ways, RUM and Rollbar. Datadog does get Rollbar alerts, but only from the mpdx_api project. I found none from the front end in the last 30 days, so for mpdx.org it's RUM only, and that line should say so.
  6. update-staging failed on your last push with a GitHub timeout (409 from the merge API), so the drill-log commit isn't on staging yet. A re-run should fix it.

The agent-review findings in my report comment are all advisory, none 7 or higher. The one I'd fix while you're in there is finding 1: curl -f throws away the page body on a 500, so a broken /login makes the test wait 40 minutes and then blame Amplify.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human-approval agent-review: a person must approve this PR On Staging Will be merged to the staging branch by Github Actions one-way-door Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants