Skip to content

feat: Android brake stage action to replace a halted rollout - #23030

Merged
Git-on-my-level merged 7 commits into
mainfrom
lane/store-fasttrack
Oct 21, 2026
Merged

Git-on-my-level merged 7 commits into
mainfrom
lane/store-fasttrack

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #22999 (Android rollout brake). Adds BRAKE_ACTION=stage to the manual Codemagic android-rollout-brake workflow, so a fixed build can replace a halted production rollout at an explicit small fraction. Merge after #22999.

Why: David approved halting Android 1.0.568 (1471) and fast-tracking the fixed 1.0.569 (1477), which carries the pendant reconnect audio-loss fix from #22995. mobile-store-promote cannot be used for this: its Android path defaults to status=completed, which is 100% at once.

What stage does:

  • Inputs: BRAKE_VERSION_CODE (new code), BRAKE_SUPERSEDES_VERSION_CODE (halted code), BRAKE_USER_FRACTION, a one-line BRAKE_NOTES_LINE, and CONFIRM=brake. Inputs are validated before any authentication or edit.
  • Refuses unless production holds the superseded code as halted beside completed releases only (no drafts or other staged releases), the new code is not already on production, the new code sits alone on internal or alpha under exactly one marketing version newer than the halted one, the fraction does not exceed the halted fraction, and the halted release has no country targeting.
  • Writes one inProgress release at the requested userFraction in place of the halted one. Completed releases stay byte-identical. The release name carries the daily train's gate receipt (1.0.569 (gate YYYY-MM-DD-HHMM)), so the ladder can advance it later.
  • Notes copy the halted release's What's New and append BRAKE_NOTES_LINE to en-US and to every locale holding the identical English text. Real translations stay unchanged, and Play's 500-character limit is enforced before writing.
  • Uses the existing commit path: exact update-response match, then ERROR_IF_IN_REVIEW commit, then a full-track readback in a fresh edit. Prints BRAKE_RESULT action=stage ....
  • Halt/resume/status behaviour is unchanged. The commit/readback block moved into a shared helper.

The only .github/ change refreshes the two whole-document Codemagic digests in .github/scripts/fixtures/codemagic_workflow_contract/v1.json, under lead ruling 0f4368. A scratch check confirmed every other workflow is semantically identical and only three env vars were added to android-rollout-brake.

Validation: backend/tests/unit/test_mobile_rollout_brake.py now has 24 fake Play tests (11 new), all passing, plus .github/scripts/test_check_release_process_guards.py (121 total passed). Stage tests cover the exact written track, notes, gate-receipt name, call sequence, refusal for every non-halted status, unexpected production or source state, fraction above the halted one, bad inputs before authentication, update/readback mismatches, and a status read of the staged release.

Fixes found during live use (each refused before opening any Play edit):

  • Codemagic rejects an empty env var value, so BRAKE_NOTES_LINE has no yaml default and is passed per build.
  • Play's Android notes are one line of entries joined by "; " (from mobile-changelog android_notes; 1471 held 486 characters). The stage keeps whichever shape Play holds and replaces the last entry when appending would pass 500 characters. The refusal names both lengths.
  • The anonymous GitHub API read from Codemagic's shared runners failed 3 times. The workflow now also loads the existing read-only mobile_release_admission group, and the check sends its GITHUB_TOKEN when present.

Live use (store-fasttrack lane, David-approved fast-track; lead answer 0142bb for the notes):

  • status 6ad88707d7f84e6126bb0274: BRAKE_RESULT action=status versionCode=1471 status_before=halted status_after=halted userFraction=0.1
  • stage 6ad8a05789e6dfa249fca407: BRAKE_RESULT action=stage versionCode=1477 status_before=absent status_after=inProgress userFraction=0.01 supersedes=1471 superseded_status=halted superseded_userFraction=0.1 name='1.0.569 (gate 2026-10-21-1123)'
  • status 6ad8a0d948119fac6ce8b698: BRAKE_RESULT action=status versionCode=1477 status_before=inProgress status_after=inProgress userFraction=0.01

Both GitHub Play writer workflows remain disabled; re-enabling is the release lead's call.

Product invariants affected: INV-AUTH-1, INV-DATA-1, INV-BETA-1 (the shared Codemagic file matches these guards; the change only adds env vars to the Android production brake workflow and preserves all existing desktop auth, routing, signing, and Beta workflows).

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 6 commits October 21, 2026 16:08
BRAKE_ACTION=stage writes one inProgress production release for a fixed
build that sits alone on internal or alpha, replacing a halted release.
It refuses unless production holds the superseded code as halted beside
completed releases only, the new version is newer, and the fraction does
not exceed the halted one. Notes copy the halted release's What's New and
append BRAKE_NOTES_LINE to en-US and to locales holding the identical
English text (translations stay as-is). The name carries the train's gate
receipt so the ladder can advance it. Completed releases stay untouched.

The Codemagic workflow gains three env vars; the two contract fixture
digests are refreshed under lead ruling 0f4368. No other .github edits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codemagic validation refuses an empty env var value, so build
6ad8843e0d853867bad5a999 failed before any script ran. The stage action
already refuses a missing notes line; operators pass it per build.
Contract fixture digests refreshed again under lead ruling 0f4368.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first live stage (Codemagic 6ad887a212a04f1982afdc61) refused before
writing because the halted notes plus the fix line exceed 500 characters.
The refusal now names both lengths so the operator can size the line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s limit

The halted 1471 notes plus the fix line exceed 500 characters. Per lead
answer 2161ae, the fix line now replaces the last bullet when appending
does not fit; it still refuses when neither fits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… line

Play's Android notes come from mobile-changelog android_notes as one line
of entries joined by "; " (1471: 486 characters), so the newline-only
replacement could not fit the fix line. The stage now splits on newlines
when present, otherwise on "; ", and appends or replaces the last entry in
that same shape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…token

Three stage attempts (Codemagic 6ad88c1735ae51bce5312b52,
6ad89a32e0fb3f54e60c379f, 6ad89cf2dae7e5cbee42b247) refused before any
Play edit because the anonymous GitHub API read from Codemagic's shared
runners failed. The brake workflow now loads the existing read-only
mobile_release_admission group and sends its GITHUB_TOKEN when present.
Contract fixture digests refreshed under lead ruling 0f4368.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T13:03:33.058749Z 2833ff2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2dd1679401

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +88 to +91
name = release.get("name")
version = promote.production_release_version(name) if isinstance(name, str) else None
if codes != [version_code] or version is None:
raise BrakeError(f"{track_name} release for the stage code must carry only that code and a version")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject inactive source releases before staging

When the matching internal or alpha release has status draft, halted, or an invalid/missing status, this validation still accepts it because it checks only the code and version name, then publishes that artifact to production. The normal train deliberately limits candidates to completed or inProgress; apply the same status check here so a build that was never active on a test track cannot be exposed to production users.

Useful? React with 👍 / 👎.

raise BrakeError("stage version must be newer than the halted release")
release = {
"name": train._staged_name_with_receipt(version),
"versionCodes": [version_code],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Refuse multi-code halted releases before replacing them

When the halted release contains multiple version codes, this singleton assignment silently removes every variant other than the newly supplied code from production. The normal promotion path explicitly retains extra codes for multi-APK rollouts, so this emergency path should either require the halted release to contain only BRAKE_SUPERSEDES_VERSION_CODE or handle all variants explicitly rather than dropping them.

Useful? React with 👍 / 👎.

Comment on lines +153 to +154
if halted_version is None or promote.version_parts(version) <= promote.version_parts(halted_version):
raise BrakeError("stage version must be newer than the halted release")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Check the fix against every production version

When production also contains a completed release whose marketing version is newer than the halted release, this comparison permits a fix that is newer than the halted version but older than the version already serving users. Because Play update eligibility is governed by version code rather than this release-name version, a higher-code build can commit successfully while regressing the displayed app version; compare the candidate against every parseable production release, as the normal promotion path does.

Useful? React with 👍 / 👎.

Comment on lines +155 to +159
release = {
"name": train._staged_name_with_receipt(version),
"versionCodes": [version_code],
"status": "inProgress",
"userFraction": fraction,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the halted release's update priority

When the halted release has a non-default inAppUpdatePriority, constructing this replacement from a fresh mapping silently drops that setting, so the fixed build reverts to the default update priority. The standard promotion path deliberately preserves this metadata from its base release; seed the replacement from the halted release and overwrite the controlled fields, while retaining the existing country-targeting refusal.

Useful? React with 👍 / 👎.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Review round 1 (Grok, head 2dd1679): SHIP, two P2s. Responses:

P2 codemagic.yaml — BRAKE_NOTES_LINE not declared. Rebutted for this PR: live stage build 6ad8a05789e6dfa249fca407 started through POST /builds with environment.variables received the line and wrote it (verified by readback and independent status build 6ad8a0d948119fac6ce8b698), so Codemagic injects the undeclared name for this workflow. A missing value fails closed before play_edit. Declaring it needs a non-empty sentinel because Codemagic rejects "" (build 6ad8843e0d853867bad5a999). Deferred to the follow-up issue: declare BRAKE_NOTES_LINE: "unset" and treat the sentinel as missing.

P2 mobile_rollout_brake.py — "; " replace-last splits inside an entry. Accepted as a limitation. mobile-changelog android_notes joins entries with "; ", so an entry that itself contains "; " is indistinguishable in Play's stored text. Replacement only runs when appending would pass 500 characters. The operator sees the written name and readback, and the one live use replaced a whole entry (lead answer 0142bb). Deferred to the follow-up issue: refuse replace-last on "; " text unless the operator opts in, or print the before/after en-US text in BRAKE_RESULT.

Follow-up issue: #23032

Base automatically changed from lane/play-halt to main October 21, 2026 13:20
@Git-on-my-level
Git-on-my-level merged commit 08c5b50 into main Oct 21, 2026
28 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/store-fasttrack branch October 21, 2026 13:23
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