Repository navigation
fix(android): finish the account sign-in when its return is in the fragment - #4215
Conversation
…agment The account service sends state and code or error in the fragment of ovis://account/callback. OvisAuthPlugin read only the query, so the waiting sign-in never settled and the page stayed busy. Read a non-empty fragment, else the query, as native.ts does; keep the exact scheme/host/path match and the original-state check, and settle only a matching return that carries a code or an error.
Assert that the fragment is read before the query, an empty fragment falls back to the query, an address with no fields is ignored, the first state named wins, names and values are percent-decoded, and a malformed escape is ignored.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
Merged through Lane reviews at 9f67372: fresh omo reviewer CLEAR (JVM 65/0, emulator checks) and Codex gpt-6.2-sol-fast CLEAR; e2ceba1 adds only JVM asserts for the reviewer's LOW (5/5 mutations caught); CodeRabbit reviewed this head; merged by the relay owner on the owner's word ("둘다해"). |
…4219) ## Summary Records the Android store build that carries the sign-in fix #4215, so the next build does not reuse a version code Play already holds (as #4205 did for 1.0.3). - **Android:** `app/android/app/build.gradle` raises `versionCode` 10 -> 11 and `versionName` 1.0.3 -> 1.0.4. 1.0.4 (11) is the bundle built from `main` at `7ea0e00c` (#4215) with only this bump on top. It was published to the internal testing track and sent to Google Play's production review on 2026-11-19. - **Docs:** the version rows in `app/store/android.md` show these numbers and name the last upload. - **iOS:** unchanged. Why 1.0.4 needed an Android build: #4215 (the app finishes the account sign-in when the account service returns its result in the callback's fragment) is Android native code (`OvisAuthPlugin.java`). Between v0.5.5 and `7ea0e00c` it is the only native change under `app/`; the 1.0.3 record (#4205) is the other commit there. Nothing here builds or uploads. The next upload raises Android to `versionCode` 12. ## Validation - The 1.0.4 (11) bundle: `bundleRelease` with the upload key and google-services.json (the four Firebase values are in the bundle's resources); `keytool -printcert` shows the upload key; the merged manifest reads versionCode 11 / versionName 1.0.4; `testReleaseUnitTest` passed (97 tests, 0 failures, including `OvisAuthReturnTest` from #4215). - No emulator launch this time: the web shell and every other native file are the same as 1.0.3, which passed that check. - `bun run check fast` (this PC): workflow syntax, generated types and themes, typecheck and build passed. Unit tests: 19286 pass, 1 fail. The failure is `scripts/conventions.test.ts` "the tools typecheck > excludes no more files than at the ratchets' base", which came from the checkout, not this change: the checkout's `origin/main` is another repository's main, so the ratchet base was `0a91d143`, 272 commits back, whose `tsconfig.tools.json` has no exclude list. Re-run with the public base, `RATCHET_BASE=7ea0e00c bun test scripts/conventions.test.ts`: 33 pass, 0 fail. The change is two gradle numbers and a doc table; no test reads `versionCode` or `versionName`.
Summary
Signing in to the account from the Android app never finished: after the browser came back, the
page kept its sign-in button busy forever.
The account service returns to
ovis://account/callbackwithstateandcode(orerror) inthe URL fragment (
#code=...&state=...,#error=access_denied&state=...).OvisAuthPlugin.handleOnNewIntentread only the query, so it found no state, returned early,and the pending
authenticatecall never settled.native.tsalready accepts either form, but itnever received the URL. iOS forwards the whole URL and is not affected.
Change
OvisAuthPlugin.isOwnReturn(url, expectedState)is a new pure static method in the same file.It reads a non-empty fragment, else the query, matching
nativeSignIninsrc/lib/account/native.ts.ovis/account//callbackmatch.codeor anerrorsettles the call. A return naminga different state, or another address, still leaves the sign-in waiting.
handleOnNewIntentnow calls this method; resolving and releasing the call is unchanged.changelog.d/android-signin-callback-fragment.md.Validation
./gradlew :app:testDebugUnitTest(inapp/android, JDK 21): 71 tests, 0 failures, includingthe new
OvisAuthReturnTest(12 tests):statenamed wins, as withURLSearchParams.getEach parse rule was broken once in a scratch copy, and
OvisAuthReturnTestwent red everytime:
statewinThe settle-once guards in
handleOnNewIntent(no waiting call; the call is cleared before itresolves) need a Capacitor bridge, so the JVM tests do not reach them. The emulator run below
covers them instead.
The
IllegalArgumentExceptioncatch inisOwnReturnstays. On the JDK,new URI(...)rejectsa malformed
%escape beforeURLDecodersees it: removing the catch kept every test green,including the malformed-escape test. The device's own
java.net.URIwas not checked for thesame behaviour, and the catch makes a hostile link fail closed instead of crashing the app.
./gradlew :app:assembleDebug: OK.Emulator (Android API image, debug build): the test called
OvisAuth.authenticatefrom theapp's WebView with a dummy https address and a known state. It then sent intents with
adb shell am start -a android.intent.action.VIEW -d ...:#error=access_deniedwith another state: still waiting.ovis://account/elsewhere#...with the right state: still waiting.#error=access_deniedwith the right state: resolved with that URL.#code=...with the right state, in a new call: resolved with that URL.The test did not drive the hosted account page itself (the app opens it only from a PC's link),
and it did not complete a real GitHub sign-in.
Not run:
bun run check fast(no web, server or shared code changed). The iOS app is unchanged.Installed Android builds still need this update. The account service is unchanged.