Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(android): raise the OTA floor per release and harden sign-out wipes (#9137)

Peter Chinman3ff0904648bd
diff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.yml
index 7870bc74e2..45a589242f 100644
--- a/.github/workflows/web-app-check-main.yml
+++ b/.github/workflows/web-app-check-main.yml
@@ -110,6 +110,15 @@ jobs:
bun scripts/android-version-check.mjs "$base"
shell: bash
working-directory: apps/web
+ - name: Keep the Android native build floor without a release
+ if: steps.labels.outputs.skip == 'true'
+ run: |
+ set -euo pipefail
+ base=$(git cat-file -p HEAD | sed -n 's/^parent //p' | head -1)
+ git fetch -q --depth=1 origin "$base"
+ bun scripts/android-version-check.mjs --skip-release "$base"
+ shell: bash
+ working-directory: apps/web
- id: auth
name: Authenticate to Google Play
if: steps.android-version.outputs.changed == 'true' && steps.labels.outputs.skip != 'true'
diff --git a/apps/web/docs/ios-releases.md b/apps/web/docs/ios-releases.md
index 94799cfb36..90ab66a892 100644
--- a/apps/web/docs/ios-releases.md
+++ b/apps/web/docs/ios-releases.md
@@ -104,8 +104,8 @@ icon and app-name branding are Android-only.
`minNativeBuilds.ios` = the new build number. Installed apps on older
native builds stop applying OTA bundles and show the "update from the
App Store" prompt instead (`NativeUpdateRequired` in
- `src/lib/tauri/TauriProvider.tsx`). The Android floor is independent; see
- `docs/development/android.md`.
+ `src/lib/tauri/TauriProvider.tsx`). The Android floor is independent:
+ `just android-bump` raises it; see `docs/development/android.md`.
The bump is deliberately a local command rather than something the label
workflow pushes: a `GITHUB_TOKEN` push never re-triggers required checks, so
diff --git a/apps/web/justfile b/apps/web/justfile
index 5c50487acb..669ba24db9 100644
--- a/apps/web/justfile
+++ b/apps/web/justfile
@@ -7,9 +7,13 @@ android-dev *ARGS:
android-build *ARGS:
bash scripts/android.sh build "$@"
-# Increment and commit before preparing the next native APK or Play AAB release.
-android-bump:
- bun scripts/android-release.ts bump
+# Increment the versionCode and commit before preparing the next native APK or
+# Play AAB release. Also raises the Android floor in min-native-build.json to
+# the new versionCode, so the next prod web deploy stops serving shared JS to
+# older Android installs and prompts them to update. --no-min keeps the floor
+# for a release older installs don't need.
+android-bump *ARGS:
+ bun scripts/android-release.ts bump {{ARGS}}
# iOS: dev-facing, for testing in Simulator. Honors PORT like the web dev
# server (`PORT=3001 just ios-dev`): the vite server picks PORT up through
@@ -155,7 +159,8 @@ build-staging: build-wasm
# Production bundles carry the native build floors checked in at
# min-native-build.json (schema 3 manifest, see scripts/write-bundle-manifest.mjs);
-# `just ios-bump` raises the iOS one. Explicit MIN_NATIVE_BUILD_* env still wins.
+# `just ios-bump` raises the iOS one and `just android-bump` the Android one.
+# Explicit MIN_NATIVE_BUILD_* env still wins.
build-prod: build-wasm
#!/usr/bin/env bash
set -euo pipefail
diff --git a/apps/web/scripts/android-release.test.ts b/apps/web/scripts/android-release.test.ts
index 62714cd322..507328a521 100644
--- a/apps/web/scripts/android-release.test.ts
+++ b/apps/web/scripts/android-release.test.ts
@@ -21,6 +21,7 @@ import {
parseAndroidSigning,
propertyValue,
provisionAndroidSigning,
+ raiseAndroidNativeBuildFloor,
verifyAndroidApk,
} from './android-release';
@@ -118,6 +119,20 @@ describe('Android release versions', () => {
}
});
+ it('raises only the Android native build floor', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'android-floor-test-'));
+ try {
+ const path = join(root, 'min-native-build.json');
+ await writeFile(path, JSON.stringify({ android: 1, ios: 191 }));
+ await raiseAndroidNativeBuildFloor(8, path);
+ expect(await readFile(path, 'utf8')).toBe(
+ '{\n "android": 8,\n "ios": 191\n}\n'
+ );
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+ });
+
it('does not write an exhausted counter', async () => {
const root = await mkdtemp(join(tmpdir(), 'android-version-test-'));
try {
diff --git a/apps/web/scripts/android-release.ts b/apps/web/scripts/android-release.ts
index 85b81753b8..fba784262b 100644
--- a/apps/web/scripts/android-release.ts
+++ b/apps/web/scripts/android-release.ts
@@ -11,6 +11,7 @@ const androidConfigPath = new URL(
'../tauri/src-tauri/tauri.android.conf.json',
import.meta.url
);
+const minNativeBuildPath = new URL('../min-native-build.json', import.meta.url);
const maxVersionCode = 2_100_000_000;
const releaseConfigSchema = z
.object({
@@ -78,6 +79,24 @@ export async function bumpAndroidVersionCode(
return config.bundle.android.versionCode;
}
+const nativeBuildFloorsSchema = z
+ .object({ android: z.number().int().min(1) })
+ .passthrough();
+
+/// Raises the Android floor in min-native-build.json to `versionCode`: after
+/// the next production web deploy, older Android installs stop receiving the
+/// shared frontend bundle and are prompted to update from Google Play.
+export async function raiseAndroidNativeBuildFloor(
+ versionCode: number,
+ path: string | URL = minNativeBuildPath
+) {
+ const floors = nativeBuildFloorsSchema.parse(
+ JSON.parse(await readFile(path, 'utf8'))
+ );
+ floors.android = versionCode;
+ await writeFile(path, `${JSON.stringify(floors, null, 2)}\n`);
+}
+
const signingSchema = z.object({
package_name: z.literal(androidPackage),
keystore_base64: z
@@ -251,8 +270,18 @@ export function verifyAndroidApk(
if (import.meta.main) {
const [command, ...args] = process.argv.slice(2);
try {
- if (command === 'bump' && args.length === 0) {
- console.log(await bumpAndroidVersionCode());
+ if (
+ command === 'bump' &&
+ (args.length === 0 || (args.length === 1 && args[0] === '--no-min'))
+ ) {
+ const versionCode = await bumpAndroidVersionCode();
+ if (args.length === 0) {
+ await raiseAndroidNativeBuildFloor(versionCode);
+ console.error(
+ `Raised the Android native build floor to ${versionCode}: after this merges and production deploys, older Android installs are prompted to update.`
+ );
+ }
+ console.log(versionCode);
} else if (command === 'metadata' && args.length === 2) {
const [tag, destination] = args;
const metadata = androidReleaseMetadata(
@@ -284,7 +313,7 @@ if (import.meta.main) {
);
} else {
throw new Error(
- 'Usage: android-release.ts bump | metadata TAG CONFIG | signing DIRECTORY PROPERTIES | ensure-signing DIRECTORY PROPERTIES | verify TAG APK BUILD_TOOLS CERTIFICATE_FILE'
+ 'Usage: android-release.ts bump [--no-min] | metadata TAG CONFIG | signing DIRECTORY PROPERTIES | ensure-signing DIRECTORY PROPERTIES | verify TAG APK BUILD_TOOLS CERTIFICATE_FILE'
);
}
} catch (error) {
diff --git a/apps/web/scripts/android-version-check.mjs b/apps/web/scripts/android-version-check.mjs
index 158fe01656..eea7080973 100644
--- a/apps/web/scripts/android-version-check.mjs
+++ b/apps/web/scripts/android-version-check.mjs
@@ -3,6 +3,17 @@
// base branch. The release workflow applies the same definition when it
// decides whether a production release needs a new App Bundle; catching a
// missing bump here keeps it from failing there, after the deploy.
+//
+// The Android floor in min-native-build.json must then be either the new
+// versionCode (`just android-bump`: the next production web deploy stops
+// serving shared JS to older installs and prompts them to update) or left as
+// the base has it (`just android-bump --no-min`: a release older installs
+// don't need). A PR without Android native changes releases nothing, so it
+// may raise the floor only as far as the base's versionCode, a version that
+// already went through this gate. A PR labelled skip-android-update never
+// releases either, so with --skip-release the floor must not rise above the
+// base's: either would prompt older installs to update to a version Play
+// never published.
import { appendFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
@@ -13,25 +24,31 @@ import {
gitIn,
} from './android-native.mjs';
+const minNativeBuildPath = 'apps/web/min-native-build.json';
+
+/// The Android floor committed in min-native-build.json at a commit, validated.
+function androidNativeBuildFloor(git, commit) {
+ const floor = JSON.parse(git(['show', `${commit}:${minNativeBuildPath}`]))
+ .android;
+ if (!Number.isInteger(floor) || floor < 1)
+ throw new Error(`Invalid Android native build floor at ${commit}`);
+ return floor;
+}
+
+function resolveCommits(git, base, head) {
+ if (!base) throw new Error('Provide the PR base commit');
+ const resolve = (ref) =>
+ git(['rev-parse', '--verify', '--end-of-options', `${ref}^{commit}`]);
+ return { baseCommit: resolve(base), headCommit: resolve(head) };
+}
+
export function checkAndroidVersion({
base,
head = 'HEAD',
cwd = process.cwd(),
}) {
- if (!base) throw new Error('Provide the PR base commit');
const git = gitIn(cwd);
- const baseCommit = git([
- 'rev-parse',
- '--verify',
- '--end-of-options',
- `${base}^{commit}`,
- ]);
- const headCommit = git([
- 'rev-parse',
- '--verify',
- '--end-of-options',
- `${head}^{commit}`,
- ]);
+ const { baseCommit, headCommit } = resolveCommits(git, base, head);
const output = (changed) => {
if (process.env.GITHUB_OUTPUT)
appendFileSync(
@@ -39,8 +56,15 @@ export function checkAndroidVersion({
`changed=${changed}\nversion_code=${androidVersionCode(git, headCommit)}\n`
);
};
+ const previous = androidVersionCode(git, baseCommit);
+ const baseFloor = androidNativeBuildFloor(git, baseCommit);
+ const floor = androidNativeBuildFloor(git, headCommit);
if (androidNativeHash(git, baseCommit) === androidNativeHash(git, headCommit)) {
output(false);
+ if (floor > baseFloor && floor > previous)
+ throw new Error(
+ `min-native-build.json raises the Android native build floor to ${floor}, above the base branch's versionCode ${previous}, but this PR has no Android native changes and releases nothing: after the production deploy, Android installs below it would be prompted to update to a version that was never published. Raise the floor only to a released versionCode.`
+ );
return 'No Android native changes; no Android version bump needed.';
}
output(true);
@@ -48,13 +72,38 @@ export function checkAndroidVersion({
const reason = androidChangeReasons(git, baseCommit, headCommit).join(
' and '
);
- const previous = androidVersionCode(git, baseCommit);
const next = androidVersionCode(git, headCommit);
if (next <= previous)
throw new Error(
`${reason}, but Android versionCode (${next}) must exceed the base branch (${previous}). Run just android-bump in apps/web and commit the result before merging.`
);
- return `${reason}; Android versionCode increased from ${previous} to ${next}.`;
+ if (floor !== next && floor !== baseFloor)
+ throw new Error(
+ `min-native-build.json has android ${floor}; expected the new versionCode ${next}, so older Android installs are prompted to update after the production deploy, or ${baseFloor}, unchanged from the base branch, for a release older installs don't need. Run just android-bump (or just android-bump --no-min) in apps/web.`
+ );
+ const floorNote =
+ floor === next
+ ? `raising the Android native build floor to ${next}`
+ : `keeping the Android native build floor at ${floor}`;
+ return `${reason}; Android versionCode increased from ${previous} to ${next}, ${floorNote}.`;
+}
+
+/// The skip-android-update twin: such a PR never releases to Google Play, so
+/// it must not raise the Android floor above the base's.
+export function checkAndroidFloorKept({
+ base,
+ head = 'HEAD',
+ cwd = process.cwd(),
+}) {
+ const git = gitIn(cwd);
+ const { baseCommit, headCommit } = resolveCommits(git, base, head);
+ const baseFloor = androidNativeBuildFloor(git, baseCommit);
+ const floor = androidNativeBuildFloor(git, headCommit);
+ if (floor > baseFloor)
+ throw new Error(
+ `skip-android-update PRs never release to Google Play, but min-native-build.json raises the Android native build floor from ${baseFloor} to ${floor}: after the production deploy, Android installs below it would be prompted to update to a version that was never published. Restore the base's floor (just android-bump --no-min keeps it), or remove the label and release.`
+ );
+ return `Android native build floor ${floor} does not exceed the base branch's (${baseFloor}).`;
}
if (
@@ -62,7 +111,12 @@ if (
import.meta.url === pathToFileURL(resolve(process.argv[1])).href
) {
try {
- console.log(checkAndroidVersion({ base: process.argv[2] }));
+ const args = process.argv.slice(2);
+ console.log(
+ args[0] === '--skip-release'
+ ? checkAndroidFloorKept({ base: args[1] })
+ : checkAndroidVersion({ base: args[0] })
+ );
} catch (error) {
console.error(
error instanceof Error ? error.message : 'Android version check failed'
diff --git a/apps/web/scripts/android-version-check.test.ts b/apps/web/scripts/android-version-check.test.ts
index 3b12e58eb5..3982b1fa90 100644
--- a/apps/web/scripts/android-version-check.test.ts
+++ b/apps/web/scripts/android-version-check.test.ts
@@ -3,7 +3,10 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { checkAndroidVersion } from './android-version-check.mjs';
+import {
+ checkAndroidFloorKept,
+ checkAndroidVersion,
+} from './android-version-check.mjs';
const nativeConfig = 'apps/web/tauri/src-tauri/tauri.android.conf.json';
let cwd: string;
@@ -29,6 +32,13 @@ function version(code: number) {
);
}
+function floor(android: number) {
+ write(
+ 'apps/web/min-native-build.json',
+ JSON.stringify({ android, ios: 191 })
+ );
+}
+
function commit() {
git('add', '.');
git('commit', '--allow-empty', '-m', 'test release');
@@ -56,6 +66,7 @@ beforeEach(() => {
git('config', 'user.name', 'Release test');
git('config', 'user.email', '[email protected]');
version(1);
+ floor(1);
write('apps/web/tauri/src-tauri/src/lib.rs', '// native');
commit();
});
@@ -95,6 +106,36 @@ describe('PR Android version enforcement', () => {
expect(checkAndroidVersion({ cwd, base })).toContain('from 1 to 2');
});
+ it('accepts a bump that raises the Android floor to the new version code', () => {
+ const base = git('rev-parse', 'HEAD');
+ write('apps/web/tauri/src-tauri/src/lib.rs', '// changed');
+ version(2);
+ floor(2);
+ commit();
+ expect(checkAndroidVersion({ cwd, base })).toContain(
+ 'raising the Android native build floor to 2'
+ );
+ });
+
+ it.each([
+ ['above', 5],
+ ['below', 2],
+ ])(
+ 'rejects an Android floor %s the new version code that the base did not have',
+ (_, android) => {
+ version(2);
+ commit();
+ const base = git('rev-parse', 'HEAD');
+ write('apps/web/tauri/src-tauri/src/lib.rs', '// changed');
+ version(4);
+ floor(android);
+ commit();
+ expect(() => checkAndroidVersion({ cwd, base })).toThrow(
+ /expected the new versionCode 4.*or 1, unchanged/
+ );
+ }
+ );
+
it.each([0, 1.5, 2_100_000_001])(
'rejects invalid version code %s',
(code) => {
@@ -144,6 +185,28 @@ describe('PR Android version enforcement', () => {
expect(checkAndroidVersion({ cwd, base })).toContain('No Android native changes');
});
+ it('lets a PR without native changes raise the Android floor to a released version code', () => {
+ version(3);
+ commit();
+ const base = git('rev-parse', 'HEAD');
+ floor(3);
+ commit();
+ expect(checkAndroidVersion({ cwd, base })).toContain(
+ 'No Android native changes'
+ );
+ });
+
+ it('rejects a PR without native changes that raises the Android floor past the base version code', () => {
+ version(3);
+ commit();
+ const base = git('rev-parse', 'HEAD');
+ floor(4);
+ commit();
+ expect(() => checkAndroidVersion({ cwd, base })).toThrow(
+ /floor to 4, above the base branch's versionCode 3/
+ );
+ });
+
it.each([
'apps/web/tauri/src-tauri/gen/apple/project.yml',
'apps/web/tauri/src-tauri/Info.ios.plist',
@@ -198,6 +261,30 @@ describe('PR Android version enforcement', () => {
);
});
+ it('rejects a raised Android floor on a PR that skips the release', () => {
+ const base = git('rev-parse', 'HEAD');
+ write('apps/web/tauri/src-tauri/src/lib.rs', '// changed');
+ version(2);
+ floor(2);
+ commit();
+ expect(() => checkAndroidFloorKept({ cwd, base })).toThrow(
+ /raises the Android native build floor from 1 to 2/
+ );
+ });
+
+ it('lets a PR that skips the release keep or lower the Android floor', () => {
+ floor(3);
+ commit();
+ const base = git('rev-parse', 'HEAD');
+ write('apps/web/tauri/src-tauri/src/lib.rs', '// changed');
+ version(2);
+ commit();
+ expect(checkAndroidFloorKept({ cwd, base })).toContain('Android native build floor 3');
+ floor(2);
+ commit();
+ expect(checkAndroidFloorKept({ cwd, base })).toContain('Android native build floor 2');
+ });
+
it('fails closed if the base commit is unavailable', () => {
expect(() => checkAndroidVersion({ cwd, base: 'missing-base' })).toThrow();
});
diff --git a/apps/web/src/lib/core/auth/clear-composer-storage.test.ts b/apps/web/src/lib/core/auth/clear-composer-storage.test.ts
index 792835b71d..10b83b47f2 100644
--- a/apps/web/src/lib/core/auth/clear-composer-storage.test.ts
+++ b/apps/web/src/lib/core/auth/clear-composer-storage.test.ts
@@ -13,13 +13,18 @@ it('clears scoped and legacy drafts and attachments while retaining preferences'
'input-value-channel-1',
'task-composer-submission:alice:first',
'task-composer-submission:alice:first:editing',
+ 'task-composer-draft',
+ 'task-composer-draft:channel-1',
+ 'routine-composer-draft',
'attachment-tracker-agents-new-conversation-persist-v0:alice',
];
for (const key of keys) localStorage.setItem(key, 'private draft');
localStorage.setItem('macro-selected-theme', 'dark');
+ localStorage.setItem('task-composer-share-with-team', 'false');
clearComposerStorage();
for (const key of keys) expect(localStorage.getItem(key)).toBeNull();
expect(localStorage.getItem('macro-selected-theme')).toBe('dark');
+ expect(localStorage.getItem('task-composer-share-with-team')).toBe('false');
});
it('retires mounted autosavers before wiping their saved data', () => {
diff --git a/apps/web/src/lib/core/auth/clear-composer-storage.ts b/apps/web/src/lib/core/auth/clear-composer-storage.ts
index c041018d04..3efca16471 100644
--- a/apps/web/src/lib/core/auth/clear-composer-storage.ts
+++ b/apps/web/src/lib/core/auth/clear-composer-storage.ts
@@ -9,6 +9,8 @@ export function clearComposerStorage(): void {
if (
key?.startsWith('input-value-') ||
key?.startsWith('task-composer-submission:') ||
+ key?.startsWith('task-composer-draft') ||
+ key === 'routine-composer-draft' ||
key?.startsWith('attachment-tracker-')
) {
localStorage.removeItem(key);
diff --git a/apps/web/src/lib/graphql-cache/lifecycle.test.ts b/apps/web/src/lib/graphql-cache/lifecycle.test.ts
index 0f8a6f76f8..e11712f3d9 100644
--- a/apps/web/src/lib/graphql-cache/lifecycle.test.ts
+++ b/apps/web/src/lib/graphql-cache/lifecycle.test.ts
@@ -40,6 +40,64 @@ describe('clearRegisteredCaches', () => {
expect(localStorage.getItem('unrelated')).toBe('keep');
});
+ it('rotates the scope when no cache host is registered', async () => {
+ localStorage.setItem('graphql-cache:scope', 'current-scope');
+ localStorage.setItem('graphql-soup-backfill:v7:user-1:email', '{}');
+ vi.spyOn(crypto, 'randomUUID').mockReturnValue(
+ '00000000-0000-4000-8000-000000000003'
+ );
+ const { clearRegisteredCaches } = await import('./lifecycle');
+
+ await clearRegisteredCaches();
+
+ expect(localStorage.getItem('graphql-cache:scope')).toBe(
+ '00000000-0000-4000-8000-000000000003'
+ );
+ expect(localStorage.getItem('graphql-soup-backfill:v7:user-1:email')).toBe(
+ null
+ );
+ });
+
+ it('rotates the scope once the last host unregisters', async () => {
+ localStorage.setItem('graphql-cache:scope', 'current-scope');
+ vi.spyOn(crypto, 'randomUUID').mockReturnValue(
+ '00000000-0000-4000-8000-000000000004'
+ );
+ const clear = vi.fn().mockResolvedValue(undefined);
+ const { clearRegisteredCaches, registerCacheHost } = await import(
+ './lifecycle'
+ );
+ const unregister = registerCacheHost(hostWithClear(clear));
+ unregister();
+
+ await clearRegisteredCaches();
+
+ expect(clear).not.toHaveBeenCalled();
+ expect(localStorage.getItem('graphql-cache:scope')).toBe(
+ '00000000-0000-4000-8000-000000000004'
+ );
+ });
+
+ it('rotates the scope when only a storage-free host is registered', async () => {
+ localStorage.setItem('graphql-cache:scope', 'current-scope');
+ vi.spyOn(crypto, 'randomUUID').mockReturnValue(
+ '00000000-0000-4000-8000-000000000005'
+ );
+ const { clearRegisteredCaches, registerCacheHost } = await import(
+ './lifecycle'
+ );
+ registerCacheHost({
+ clear: vi.fn().mockResolvedValue(undefined),
+ disabled: true,
+ } as unknown as CacheHost);
+
+ await clearRegisteredCaches();
+
+ expect(localStorage.getItem('graphql-cache:scope')).toBe(
+ '00000000-0000-4000-8000-000000000005'
+ );
+ });
+
it('awaits the serialized scope rotation before logout clearing resolves', async () => {
localStorage.setItem('graphql-cache:scope', 'current-scope');
vi.spyOn(crypto, 'randomUUID').mockReturnValue(
diff --git a/apps/web/src/lib/graphql-cache/lifecycle.ts b/apps/web/src/lib/graphql-cache/lifecycle.ts
index ecca90be82..b90a618873 100644
--- a/apps/web/src/lib/graphql-cache/lifecycle.ts
+++ b/apps/web/src/lib/graphql-cache/lifecycle.ts
@@ -27,8 +27,17 @@ export async function clearRegisteredCaches(): Promise<void> {
// Soup cursors live outside the normalized cache. Reset them in the same
// lifecycle operation so no later login resumes past records wiped below.
clearExternalCacheState();
+ // With no storage-backed host this session (cache disabled or unsupported,
+ // startup failed, or not yet started), nothing can wipe the persisted
+ // database or its mutation queue. A new scope makes the next open replace
+ // it instead of replaying the previous account's queued writes.
+ const storageHosts = [...hosts].filter((host) => !host.disabled);
+ if (storageHosts.length === 0) {
+ await rotateCacheScope();
+ return;
+ }
const results = await Promise.allSettled(
- [...hosts].map((host) => host.clear())
+ storageHosts.map((host) => host.clear())
);
if (results.some((result) => result.status === 'rejected')) {
await rotateCacheScope();
diff --git a/apps/web/tauri/src-tauri/README.md b/apps/web/tauri/src-tauri/README.md
index 4b5217e782..f543201a15 100644
--- a/apps/web/tauri/src-tauri/README.md
+++ b/apps/web/tauri/src-tauri/README.md
@@ -334,7 +334,8 @@ versionCode that implements the command and `MIN_NATIVE_BUILD_IOS` to the first
iOS CFBundleVersion that implements it. Set both together: build numbers are
independent. Production builds (`just build-prod`) read both from
`apps/web/min-native-build.json`; `just ios-bump` raises the iOS one (see
-`apps/web/docs/ios-releases.md`). The schema 3 manifest carries
+`apps/web/docs/ios-releases.md`) and `just android-bump` the Android one (see
+`docs/development/android.md`). The schema 3 manifest carries
`minNativeBuilds: { android, ios }`;
the endpoint returns the requesting platform's minimum in its existing response.
The updater checks that minimum during extraction, restore, and application.
diff --git a/docs/development/android.md b/docs/development/android.md
index 25b91a582e..79768bfb24 100644
--- a/docs/development/android.md
+++ b/docs/development/android.md
@@ -150,13 +150,21 @@ Add **`skip-android-update`** instead for native changes that don't break
the native/web contract: it skips the whole gate, bump included, like
`skip-ios-update`. Such a PR never releases, and the bump only feeds the
Play release, which checks it again before building; the next PR that
-releases bumps against whatever `main` has by then. The `Native Check
-Label` workflow re-runs just the gate job when that label is added or
-removed.
+releases bumps against whatever `main` has by then. Because it never
+releases, the gate still refuses a skipped PR that raises the Android floor
+in `apps/web/min-native-build.json`. The `Native Check Label` workflow
+re-runs just the gate job when that label is added or removed.
To release:
-1. Bump and commit: `just android-bump` in `apps/web`.
+1. Bump and commit: `just android-bump` in `apps/web`. It also raises the
+ Android floor in `min-native-build.json` to the new versionCode, so the
+ next prod web deploy (`just build-prod`) stops serving shared JS to older
+ Android installs, which show the update-required prompt instead. Use
+ `just android-bump --no-min` for a release older installs don't need.
+ The gate accepts only those two floors: the new versionCode or the base
+ branch's. A PR without Android native changes may raise the floor only as
+ far as the base branch's versionCode.
2. Add the **`android-update`** label once the PR is ready to merge. The
**`Android Play Release`** workflow (`.github/workflows/android-play-release.yml`)
first refuses drafts, PRs with failing checks (pending ones are waited on,
@@ -729,7 +737,9 @@ never use it for Play uploads. To build an emulator APK, run
`apps/web/tauri/src-tauri` inside the Android Nix shell. ARM64 uses the launcher
above. Keep OTA enabled for update acceptance; `--no-default-features` qualifies
only embedded behavior. Shared OTA builds need both `MIN_NATIVE_BUILD_ANDROID`
-and `MIN_NATIVE_BUILD_IOS`; see the
+and `MIN_NATIVE_BUILD_IOS`; production builds read them from
+`apps/web/min-native-build.json`, whose Android floor `just android-bump`
+raises. See the
[native compatibility contract](../../apps/web/tauri/src-tauri/README.md).
Android ConnectivityManager reports the validated default network and takes a
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs
index 4054e53e85..5aef45975d 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/android_native_check.rs
@@ -24,8 +24,11 @@
//! included, for native changes that don't break the native/web contract,
//! like `skip-ios-update`: the bump only feeds the Play release, which
//! re-checks it before building, and a PR that skips the gate never
-//! releases. Labels are read at run time (a re-run keeps the original event
-//! payload). The job name must stay
+//! releases. Because it never releases, such a PR must not raise the Android
+//! native build floor in `min-native-build.json` either: after the next
+//! production deploy, older installs would be told to update to a version
+//! Play never published. Labels are read at run time (a re-run keeps the
+//! original event payload). The job name must stay
//! stable: the release preconditions, the watcher and the label workflow
//! find it by name.
@@ -54,6 +57,7 @@ pub(super) fn job() -> Job {
.add_step(setup_bun())
.add_step(read_labels())
.add_step(version_check())
+ .add_step(floor_check())
.add_step(play_auth())
.add_step(require_live())
.add_step(skip_notice())
@@ -97,6 +101,21 @@ fn version_check() -> Step<Run> {
.working_directory(xtask_paths::repo_dir!("apps/web"))
}
+/// With the skip label the PR never releases, so the Android floor must not
+/// rise above the base's.
+fn floor_check() -> Step<Run> {
+ Step::new("Keep the Android native build floor without a release")
+ .run(indoc::indoc! {r#"
+ set -euo pipefail
+ base=$(git cat-file -p HEAD | sed -n 's/^parent //p' | head -1)
+ git fetch -q --depth=1 origin "$base"
+ bun scripts/android-version-check.mjs --skip-release "$base"
+ "#})
+ .if_condition(Expression::new(SKIP_LABEL))
+ .shell("bash")
+ .working_directory(xtask_paths::repo_dir!("apps/web"))
+}
+
fn read_labels() -> Step<Run> {
Step::new("Read the PR's current labels")
.run(indoc::indoc! {r#"
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs
index d139919c2c..b0a4fe022e 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/test.rs
@@ -38,6 +38,18 @@ fn android_native_check_is_an_unconditional_required_merge_check() {
version_step.contains("if: steps.labels.outputs.skip != 'true'"),
"the version check runs only without the skip label: {android}"
);
+ // A skipped PR never releases, so it may not raise the Android floor.
+ let floor = android
+ .find("--skip-release")
+ .expect("skip-label floor check step");
+ let floor_step = android[..floor]
+ .rsplit("\n - ")
+ .next()
+ .expect("floor check step body");
+ assert!(
+ floor_step.contains("if: steps.labels.outputs.skip == 'true'"),
+ "the floor check runs only with the skip label: {android}"
+ );
assert!(
!android.contains("!steps.labels"),
"never negate a comparison with a leading `!`: {android}"