Repository navigation
fix(cloud): compare the Asia topology budget gate against the measured 500-connection default - #22386
Conversation
…d 500-connection default The topology workflow's Cloud SQL gate carried a hard-coded 400 for the instance's tier default while the consumer contract records the value measured on the live instance (SHOW max_connections = 500, 2026-09-16, #21163). The gate compares the two and the first production plan run (35815654836) failed silently on that mismatch before Terraform ran. The verified default now lives beside the tier and version it is verified for, as VERIFIED_DEFAULT_MAX_CONNECTIONS, so the contract and the workflow are two independent records of the same measurement and the gate keeps its cross-check. The test pins the new source and forbids a bare literal. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Budget gate now reads the measured default — the no-flag production branch of
Require the checked Cloud SQL connection budgetuseslive_max="${VERIFIED_DEFAULT_MAX_CONNECTIONS}"('500') instead of a hardcoded400, sotest "${live_max}" = "${checked_max}"passes against the contract'smaxConnections: 500while the tier/version shape checks still fail closed. - Test pins the source and forbids the literal — the workflow test asserts the env var value and interpolation, and rejects a bare numeric
live_max=literal; all three assertions fail against the pre-fix code. - Doc correction — the 250-backends entry no longer calls 400 "verified"; it was the assumption at the time, and the live instance measured 500 on 2026-09-16.
I traced the production path end to end: checked_max comes from relay-cloud-sql-connection-budget.mjs (contract 500), the live instance has no max_connections flag, and the tier (db-custom-4-15360) / version (POSTGRES_17) checks gate the default. The explicit-flag branch and the staging path are unchanged. The added assertions are not theatre — each fails with the old live_max=400. Ran node --test dev/scripts/relay-asia-topology-workflow.test.mjs from cloud/: 10 pass, 0 fail.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe workflow sets Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The workflow uses the recorded 500-connection default for its guarded fallback. The alternate documented shape would increase available capacity rather than make the gate permissive, so no actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

ELI5
The workflow that adds a relay cell in Asia first checks that the shared database has room for the new cell's connections. That check had two copies of the database's connection limit that disagreed (400 in the workflow, 500 in the contract file). The workflow refused to run, even though there is plenty of room. This makes the two copies agree on the measured number.
What Changed
Before: dispatching
Deploy Relay Asia Topologyfor production failed in the step "Require the checked Cloud SQL connection budget" with no output, becausetest 400 = 500exits non-zero silently. Run 35815654836 (modeplan, cellproduction-gce-c30) was the first production run of this workflow and hit it.After: the same step passes when the instance keeps its verified shape (
db-custom-4-15360,POSTGRES_17, nomax_connectionsflag) and the contract says 500.Mechanism: the verified default moves out of the script body into
VERIFIED_DEFAULT_MAX_CONNECTIONS: '500'beside the tier and database version it is verified for. The workflow test pins that source and forbids a bare numericlive_max=literal. One line inrelay-incident-monitor.mdthat called 400 "verified" now says it was the assumption at the time and that the live instance measured 500.Why
The 400 dates from the 2026-09-03 import and was never measured. #21163 measured
SHOW max_connectionson the live instance at 500 and corrected the contract, but not this workflow, and nothing exercised the gate in production until now.Alternatives: making the workflow read the number from the contract would remove the drift but also remove the cross-check, since
checked_maxalready comes from the contract and the comparison would become a tautology. Keeping two named records of one measurement keeps the gate meaningful. Editing the contract back to 400 would record a number the instance does not report.No production resource changes. The budget itself is green (operating 419 of 490 usable).
Linked Issue
N/A — follow-up to #22375 and #21163.
Visual Proof
N/A — CI workflow and test only.
Testing
node --test cloud/dev/scripts/relay-asia-topology-workflow.test.mjs: 10 pass, 0 fail.Read-only
gcloud sql instances describe orca-cloud-auth-db: tierdb-custom-4-15360,POSTGRES_17, flagsmax_wal_size,wal_compressiononly, so the no-flag branch is the one production takes.I manually tested these changes locally
Automated tests added/updated, or explained why not below