Commit fb2e136
fix: nightly update checker never detected an update, at all
Root cause: when I consolidated the Android-only release-android.yml into
release-latest.yml (covering all 4 platforms), I rewrote every job's
release-body text and dropped the explicit "commit: <sha>" line the
original had — the new body just said "Rebuilt from `<sha>`,". That line
is exactly what UpdateChecker.extractCommitSha's regex requires
("commit:" literal + hex chars); without it, every fetched release parsed
with commitSha = null, and isUpdateAvailable short-circuits to false
whenever the fetched commitSha is null. So the checker silently always
reported "no update available," with no error anywhere — it looked
completely broken from the user's side, confirmed live against the actual
GitHub Release body (`gh release view latest`).
Two fixes, layered so this class of regression can't silently recur:
1. Restored the explicit "commit: <sha>" line in all 4 platform jobs'
release bodies in release-latest.yml.
2. Made extractCommitSha resilient on its own: falls back to matching a
bare 40-hex-char sha anywhere in the body (unambiguous enough to be
safe unlabeled, unlike a short sha) if no "commit:"-labeled line is
found, so a future body-text wording tweak can't quietly break parsing
again the same way.
Also: versionCode/versionName were hardcoded to 1/"1.0" forever, so every
nightly build was indistinguishable from any other to Android itself (and
to a user checking Settings > App Info) — addressing the "needs to be
based on a build/commit number" ask directly. versionCode now derives from
`git rev-list --count HEAD` (monotonically increasing across this repo's
history by construction); versionName includes it plus the short commit
sha (e.g. "1.0.138-g188c156"). Had to also set `fetch-depth: 0` on
build-android's checkout step — actions/checkout@v4 defaults to a shallow
clone, under which `git rev-list --count HEAD` only ever sees 1 commit and
versionCode would've silently stayed 1 forever in CI regardless of this
fix. Verified locally: a real build now produces
versionCode='138' versionName='1.0.138-g188c156' via aapt2 dump badging,
matching this checkout's actual `git log --oneline | wc -l` and HEAD sha.
3 new tests covering the bare-sha fallback and the labeled-line-still-wins
precedence; 74 tests total, 0 failures.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 8d6ea57 commit fb2e136
4 files changed
Lines changed: 75 additions & 4 deletions
File tree
- .github/workflows
- mobile/app
- src
- main/java/com/bytecats/metanoia/update
- test/java/com/bytecats/metanoia
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
99 | 105 | | |
100 | 106 | | |
101 | 107 | | |
| |||
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| 127 | + | |
| 128 | + | |
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
| |||
163 | 171 | | |
164 | 172 | | |
165 | 173 | | |
| 174 | + | |
| 175 | + | |
166 | 176 | | |
167 | 177 | | |
168 | 178 | | |
| |||
210 | 220 | | |
211 | 221 | | |
212 | 222 | | |
| 223 | + | |
| 224 | + | |
213 | 225 | | |
214 | 226 | | |
215 | 227 | | |
| |||
277 | 289 | | |
278 | 290 | | |
279 | 291 | | |
| 292 | + | |
| 293 | + | |
280 | 294 | | |
281 | 295 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| |||
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
40 | 51 | | |
41 | 52 | | |
42 | 53 | | |
| |||
79 | 90 | | |
80 | 91 | | |
81 | 92 | | |
82 | | - | |
83 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
84 | 97 | | |
85 | 98 | | |
86 | 99 | | |
| 100 | + | |
87 | 101 | | |
88 | 102 | | |
89 | 103 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
150 | 178 | | |
151 | 179 | | |
152 | 180 | | |
| |||
0 commit comments