Skip to content

fix(cloud): let the same-cap roll isolate Asia cells - #18811

Merged
Jinwoo-H merged 1 commit into
mainfrom
relay-same-cap-asia-allowlist
Sep 5, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
relay-same-cap-asia-allowlist

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​116 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​116
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​17 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11

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.mjs exports SAME_CAP_CELLS, 19 cells: c7-c26 plus the Asia cells c27, c28, c29. This is what the wave validator approves, so an Asia cell reaches the job.
  • prepare-relay-production-capacity-canary.mjs exports PRODUCTION_CAPACITY_CELL_IDS, the 16 US capacity cells, and rejected anything outside it with production 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

parseProductionCapacityCellArguments takes an optional --approved-cells switch that selects a named allowlist. The only named list is same-cap, which resolves to SAME_CAP_CELLS. An unrecognised value throws. The four canary invocations in cloud-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.yml is untouched and passes no switch, and relay-production-capacity-wave.mjs still imports the US list directly. A test asserts the capacity job yml contains no --approved-cells at 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.mjs asserts, for every SAME_CAP_CELLS member:

  • it parses through the same-cap canary parser for isolate, drain, and activate;
  • the job yml's cell-shape block resolves a cap and region for it, run as real bash extracted from the workflow, and still exits 1 for c17 and c30;
  • all four canary invocations in the job yml carry the switch.

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:4 has an independent US-only allowlist, the PRODUCTION_CELL regex covering c7-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:14 accepts c1-c29 and is fine. validate-relay-capacity-plan.mjs, verify-relay-capacity-transition.mjs, relay-monitor-evidence.mjs, and infra.mjs carry no cell allowlist. The job yml's isolate, drain, activate, and verify paths all read EXPECTED_REGION and EXPECTED_HARD_CAP from the case block, which already handles asia-east2 at cap 3000; the only us-central1 literal outside it gates a rehome-source-cell check that is deliberately US-only.

Tests

Full cloud script suites: 525 pass / 0 fail, and the pretest set 148 pass / 0 fail.

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.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The canary preparation script now supports the same-cap approved-cell allowlist while retaining the default production capacity list. The same-cap production workflow passes this allowlist for isolate, drain, activate, and failsafe isolate operations. Tests cover allowlist validation, cell resolution, workflow invocation arguments, and preservation of the default capacity workflow. The new census test is included in the cloud test command.

Merge Risk: 🔵 Low · up to d60cc

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary fix: enabling same-cap production rolls for Asia cells. It is concise and specific.
Description check ✅ Passed The description is detailed and explains the failure, root cause, fix, compatibility impact, follow-up risk, and test results. The required Linked Issue is missing, and the Visual Proof section should…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 2e546d47-1e28-4756-9710-ed7c217f3ec9

📥 Commits

Reviewing files that changed from the base of the PR and between 9927edd and d60cc9a.

📒 Files selected for processing (5)
  • .github/workflows/cloud-deploy-relay-production-same-cap-job.yml
  • cloud/dev/scripts/prepare-relay-production-capacity-canary.mjs
  • cloud/dev/scripts/prepare-relay-production-capacity-canary.test.mjs
  • cloud/dev/scripts/relay-same-cap-script-census.test.mjs
  • cloud/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]) {

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.

🎯 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.

Suggested change
if (approvedList !== undefined && !APPROVED_CELL_LISTS[approvedList]) {
if (approvedList !== undefined && !Object.hasOwn(APPROVED_CELL_LISTS, approvedList)) {

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

  • --approved-cells switch — parseProductionCapacityCellArguments now takes an optional allowlist selector; absent it falls back to PRODUCTION_CAPACITY_CELL_IDS unchanged, same-cap resolves to SAME_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_CELLS member resolves a cap/region while c17/c30 still 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.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 12e0520 into main Sep 5, 2026
26 checks passed
@Jinwoo-H
Jinwoo-H deleted the relay-same-cap-asia-allowlist branch September 5, 2026 08:51
Jinwoo-H added a commit that referenced this pull request Sep 5, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant