Repository navigation
fix(cloud): let the same-cap roll isolate Asia cells - #18811
Conversation
The same-cap wave validator approves 19 cells (c7-c26 plus the Asia cells c27-c29), but the canary script it drives hard-rejected anything outside the 16 US capacity cells, so the first Asia same-cap canary failed closed at isolate. Give the canary an explicit --approved-cells switch that selects the same-cap allowlist, and pass it from the four same-cap job invocations. With no switch the behaviour is unchanged, so the US-only capacity workflow keeps its scope.
📝 WalkthroughWalkthroughThe canary preparation script now supports the Merge Risk: 🔵 Low · up to Same-cap production targeting is wired correctly, but malformed approved-cell list names such as inherited property names can make the canary parser fail with an unexpected error rather than a clear invalid-option rejection. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 2e546d47-1e28-4756-9710-ed7c217f3ec9
📒 Files selected for processing (5)
.github/workflows/cloud-deploy-relay-production-same-cap-job.ymlcloud/dev/scripts/prepare-relay-production-capacity-canary.mjscloud/dev/scripts/prepare-relay-production-capacity-canary.test.mjscloud/dev/scripts/relay-same-cap-script-census.test.mjscloud/package.json
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| throw new Error('--mode must be isolate, drain, or activate') | ||
| } | ||
| const approvedList = values['approved-cells'] | ||
| if (approvedList !== undefined && !APPROVED_CELL_LISTS[approvedList]) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject inherited property names as unknown allowlists.
Line 50 accepts values such as constructor and toString because they resolve through Object.prototype. Line 57 then throws TypeError on .includes instead of rejecting the invalid allowlist. Use an own-property check and add a regression test.
Proposed fix
- if (approvedList !== undefined && !APPROVED_CELL_LISTS[approvedList]) {
+ if (approvedList !== undefined && !Object.hasOwn(APPROVED_CELL_LISTS, approvedList)) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (approvedList !== undefined && !APPROVED_CELL_LISTS[approvedList]) { | |
| if (approvedList !== undefined && !Object.hasOwn(APPROVED_CELL_LISTS, approvedList)) { |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
--approved-cellsswitch —parseProductionCapacityCellArgumentsnow takes an optional allowlist selector; absent it falls back toPRODUCTION_CAPACITY_CELL_IDSunchanged,same-capresolves toSAME_CAP_CELLS, and unrecognised values throw before any HTTP call.- Same-cap job wiring — all four canary invocations (isolate, drain, activate, failsafe isolate) now pass
--approved-cells same-cap; the US capacity job stays on the default list. - Tests — unit assertions for Asia-cell admission/rejection and the unknown-allowlist path, plus a census test that runs the workflow's own bash case block and asserts every
SAME_CAP_CELLSmember resolves a cap/region whilec17/c30still exit 1.
I verified the import chain (canary → same-cap-wave → relay-evidence-code-provenance → relay-repository) is acyclic, both scripts are already in TRUSTED_EVIDENCE_CODE_PATHS (no new trusted surface), the same-cap job has exactly 4 canary invocations, and the two affected test files pass locally (12/12). The fail-closed semantics are preserved: the default allowlist is untouched and an unrecognised --approved-cells value throws during argument parsing, before any mutation.
ℹ️ Deferred probe-relay-rehome-trust allowlist
The author's follow-up note is accurate: probe-relay-rehome-trust.mjs:4 still gates on a US-only PRODUCTION_CELL regex (c7-c26). That step runs only at rehome protocol 1, which the Asia cells don't reach today, so it's skipped for this rollout — but it would abort a future protocol-1 Asia roll after the mutation has already started. Correctly scoped out of this PR; worth tracking as its own change.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
The same-cap wave validator approves 19 cells (c7-c26 plus the Asia cells c27-c29), but the canary script it drives hard-rejected anything outside the 16 US capacity cells, so the first Asia same-cap canary failed closed at isolate. Give the canary an explicit --approved-cells switch that selects the same-cap allowlist, and pass it from the four same-cap job invocations. With no switch the behaviour is unchanged, so the US-only capacity workflow keeps its scope.

What failed
Run 33955359385, the first Asia same-cap canary (
production-gce-c27), passed every preflight and then threw at the isolate step during argument parsing. The failsafe isolate step calls the same script and threw identically. No HTTP call was made and nothing in production was mutated: the failure was fail-closed and left no damage.Root cause
Two allowlists drifted apart.
relay-production-same-cap-wave.mjsexportsSAME_CAP_CELLS, 19 cells:c7-c26plus the Asia cellsc27,c28,c29. This is what the wave validator approves, so an Asia cell reaches the job.prepare-relay-production-capacity-canary.mjsexportsPRODUCTION_CAPACITY_CELL_IDS, the 16 US capacity cells, and rejected anything outside it withproduction capacity target is not approved.The same-cap job shells out to the canary script for
--mode isolate|drain|activate, so every Asia same-cap roll was unreachable.The fix
parseProductionCapacityCellArgumentstakes an optional--approved-cellsswitch that selects a named allowlist. The only named list issame-cap, which resolves toSAME_CAP_CELLS. An unrecognised value throws. The four canary invocations incloud-deploy-relay-production-same-cap-job.yml(isolate, drain, activate, and the failsafe isolate) now pass--approved-cells same-cap.Why the US capacity workflow is unchanged
With the switch absent the parser falls back to
PRODUCTION_CAPACITY_CELL_IDS, exactly as before.cloud-deploy-relay-production-capacity-job.ymlis untouched and passes no switch, andrelay-production-capacity-wave.mjsstill imports the US list directly. A test asserts the capacity job yml contains no--approved-cellsat all.The new import runs canary -> same-cap-wave -> relay-evidence-code-provenance, which is acyclic. Both files were already in
TRUSTED_EVIDENCE_CODE_PATHS, so no new file enters the trusted-evidence surface.Census test
cloud/dev/scripts/relay-same-cap-script-census.test.mjsasserts, for everySAME_CAP_CELLSmember:isolate,drain, andactivate;c17andc30;Both drift directions were verified to fail the census before being restored: dropping the switch from the activate invocation, and adding an unknown cell to
SAME_CAP_CELLS.Also checked
probe-relay-rehome-trust.mjs:4has an independent US-only allowlist, thePRODUCTION_CELLregex coveringc7-c26. That step only runs at rehome protocol 1 and the Asia cells run protocol 0, so it is skipped today. It is left unchanged here and flagged as a follow-up, because it would abort a future protocol-1 Asia roll after the mutation has already started.operate-relay-regional-rehome.mjs:14acceptsc1-c29and is fine.validate-relay-capacity-plan.mjs,verify-relay-capacity-transition.mjs,relay-monitor-evidence.mjs, andinfra.mjscarry no cell allowlist. The job yml's isolate, drain, activate, and verify paths all readEXPECTED_REGIONandEXPECTED_HARD_CAPfrom the case block, which already handlesasia-east2at cap 3000; the onlyus-central1literal outside it gates a rehome-source-cell check that is deliberately US-only.Tests
Full
cloudscript suites: 525 pass / 0 fail, and the pretest set 148 pass / 0 fail.