Repository navigation
WearOSとversionCodeが衝突しないようAndroidの採番を2刻みに修正 - #6634
Conversation
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0145tm9VphAhum81bRpfoNQi
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0145tm9VphAhum81bRpfoNQi
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0145tm9VphAhum81bRpfoNQi
📝 WalkthroughWalkthroughAndroid app の ChangesAndroid version code sequencing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant bump-version.js
participant AndroidApp
participant Wearable
bump-version.js->>AndroidApp: versionCode を +2
bump-version.js->>Wearable: versionCode を app +1 に更新
bump-version.js->>AndroidApp: Wearable 以下の場合は失敗
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/bump-version.test.js (1)
137-141: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
afterEachでモック状態をリセットしてください。このテストが現在モックを使用しない場合でも、
afterEachの先頭でjest.clearAllMocks()を呼び出してください。後続のモック追加時にテスト間の状態漏れを防止できます。修正例
afterEach(() => { + jest.clearAllMocks(); while (workspaces.length > 0) {As per coding guidelines,
afterEachではjest.clearAllMocks()を呼び出すこと。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/bump-version.test.js` around lines 137 - 141, Update the afterEach hook to call jest.clearAllMocks() as its first operation, before workspace cleanup, while preserving the existing workspaces removal logic.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@scripts/bump-version.test.js`:
- Around line 137-141: Update the afterEach hook to call jest.clearAllMocks() as
its first operation, before workspace cleanup, while preserving the existing
workspaces removal logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2f03a59e-b4db-4c60-8497-d4d51e317d00
📒 Files selected for processing (7)
android/app/build.gradleandroid/wearable/build.gradle.ktsapp.config.tsdocs/android-build-workflows.mddocs/bump-version-on-canary-pr.mdscripts/bump-version.jsscripts/bump-version.test.js
概要
Android の canary ビルドが Google Play へのアップロードで
Version code 100000587 has already been used.を返して失敗していた問題(Actions run 31345700721)を、versionCode 採番の根本原因から修正します。:appと:wearableはapplicationIdを共有するため Play 上で versionCode の名前空間がひとつです。#6616 で:wearableを:app+ 1 に追従させた一方、:appの増分は +1 のままでした。その結果 1 リリースで versionCode を 2 つ消費するのに 1 しか進まず、毎回「前回の:wearable」と「今回の:app」が同値になって衝突します。実際に直近で 2 回発生しています。
:app:wearable#6627 は現在値を手で飛ばしただけで採番ロジックは直っていなかったため、同じ失敗を繰り返していました。
変更の種類
変更内容
scripts/bump-version.jsにANDROID_VERSION_CODE_STEP = 2を導入し、:appの versionCode を 2 ずつ進めるよう変更(:wearableが:app+ 1 を恒久的に占有するため)。--android-versionの明示指定が現在の Wear OS versionCode 以下になる場合にエラー終了するガードを追加。人力採番でも Play へ投げる前に気付けるようにする。据え置き(--no-android-increment)時は:app < :wearableが正常な状態なので検査対象から除外。:app100000587 を是正し、:appを 100000589 /:wearableを 100000590 へ更新(app.config.tsも追従)。100000588 は失敗ランで AAB がビルドだけされている番号のため、artifact の取り違えを避けて跨いでいます。scripts/bump-version.test.jsを新規追加。スクリプトを一時ディレクトリの擬似リポジトリへ複製して実行する方式で 5 ケースを検証し、うち 1 件は「連続 5 回 bump しても消費済み versionCode が重複しない」ことを直接確認する回帰テストです。docs/android-build-workflows.mdの versionCode ordering 節に「1 リリースで 2 消費・:appは +2」を追記し、docs/bump-version-on-canary-pr.mdの「versionCode のみ +1」という実態と異なる記述を修正。回帰リスクと緩和策
-表示)ことから確認済みです。:appが:wearable以下に落ちる採番になった場合は Play へ投げる前にスクリプトが失敗します。回帰テストで採番ロジック自体も CI で保護されます。--no-ios-incrementを指定して据え置き(2824 のまま)です。テスト
ローカルで以下を実行し、すべて成功することを確認しました。
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit
新機能
ドキュメント
品質改善