feat: stamp release version into Android config at release build#19
Conversation
fcp codepush release --build now writes the resolved release version into android/app/src/main/assets/codepush.yaml before flutter build and restores the file afterwards, mirroring the iOS Info.plist baseline stamp. The shipped APK's config asset therefore always records the version it was released as, which the engine compares against an installed patch's recorded version to discard stale patches after a store update.
Code Review — feat: stamp release version into Android config at release buildThe feature intent is sound and the stamp-then-restore pattern mirrors the iOS path correctly. Three correctness issues need fixing before merge, one of which can leave the working tree permanently dirty. CriticalNo
Medium
Version string is not YAML-safe (line 19). Minor
CI Workflow (
|
…rsion validation - writeReleaseVersionToAndroidYaml restores the original content and rethrows if the stamped write fails, so the caller is never left without a backup of a corrupted file. - A restore failure in the finally block no longer masks an in-flight build error; it logs the dirty state and manual recovery step. - Version strings containing quotes or newlines are rejected before they can produce malformed YAML. - Dropped the redundant releaseVersion alias.
|
Fixes in 982af50; one pushback:
|
Code Review — feat: stamp release version into Android config at release buildThe approach is sound and mirrors the existing iOS stamp-and-restore pattern well. Four issues to address before merging. Bugs / correctness1. YAML injection via backslash ( 2. Error-recovery catch can swallow the original exception ( 3. No Security4. 5. Mutable What looks good
|
Code ReviewWhat this PR doesStamps the resolved release version into The approach is sound and the PR is small. Three issues need addressing before merge. Issues1. Broken catch-rescue in 2. Incomplete input validation — backslash and 3. Restore not guaranteed on uncaught build exception (correctness) Minor observationThe CI workflow (
|
…tion - The stamped write now goes to a temp file renamed over the original, so a failed write can never corrupt the config and never needs an in-place rescue that would fail for the same reason and mask the original error. - Version validation switched from a quote/newline block-list to an allow-list ([A-Za-z0-9._+-]), closing the YAML escape-sequence gap.
|
Round-2 fixes in 24bdd46, plus one refutation:
|
Code Review —
|
|
Round-3 triage under the new review policy (only Critical blocks merge):
Merging. |
These files predate the formatter check running against this lineage; no functional changes.
Code Review — feat: stamp release version into Android config at release buildMost of the diff is mechanical reformatting; the substantive work is in Bugs / correctness (must fix)
Security (should fix)
Missing tests
The formatting-only changes to the other files are fine. The |
Code Review — feat: stamp release version into Android configOverall: The stamp-and-restore pattern is sound and the atomic write in Correctness bugs1.
2. Stamped YAML is not restored when The restore block runs sequentially after 3.
Test coverageNo tests are added for
Minor
|
Code Review — Android Config StampThe core idea is sound: stamping 🔴 CriticalNo In try {
// stamp iOS plist and/or Android YAML here
final buildOk = await buildService.buildRelease(...);
// handle buildOk result
} finally {
if (originalIosInfoPlist != null) restoreIosInfoPlist(originalIosInfoPlist);
if (originalAndroidYaml != null) {
try { restoreAndroidYaml(originalAndroidYaml); }
on FileSystemException catch (e) { /* existing error log */ }
}
}🟡 Moderate
An invalid version string (e.g. one containing a space or No tests for The new stamp/restore logic is the only functionally new code in this PR, and it has no test coverage. Edge cases worth testing: missing file returns null, append vs. replace behaviour, newline handling, invalid version string rejection, and that 🔵 Minor (see inline comments for details)
All other changes are whitespace/formatting — no issues there. |
What
fcp codepush release --buildforapk/appbundlenow stamps the resolved release version intoandroid/app/src/main/assets/codepush.yamlbeforeflutter buildand restores the file afterwards — the same stamp-and-restore pattern the iOS path uses for the baseline identity inInfo.plist.Why
Without this, the config asset keeps whatever version
fcp codepush initwrote on day one, so the app on a device can never tell that a store update replaced its baseline. With the stamp in place, the shipped APK always records the version it was released as; on launch, a previously installed patch whose recorded version no longer matches is discarded instead of being loaded against the wrong baseline.Pairs with an engine-side check that performs that comparison before any patch is loaded.
Notes
dart analyzeclean on both touched files. The release command file is left in the branch's existing formatting style to keep the diff minimal.Targets the checkpoint branch since the release command's stamping logic lives in the rc lineage.