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.

feat(android): prepare Play Store package and Firebase releases (#7806)

Peter Chinman9d06e08e2b91
diff --git a/.github/workflows/release-production.yml b/.github/workflows/release-production.yml
index 425691a641..f5d2071c1c 100644
--- a/.github/workflows/release-production.yml
+++ b/.github/workflows/release-production.yml
@@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
release_tag:
- description: Existing published production release to rebuild Android for (vYYYY.M.D.N)
+ description: Existing published production release to rebuild Android for (vYYYY.M.D or vYYYY.M.D.N)
required: true
type: string
publish_android:
@@ -38,7 +38,7 @@ jobs:
shell: bash
run: |
set -euo pipefail
- [[ "$RELEASE_TAG" =~ ^v20[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]
+ [[ "$RELEASE_TAG" =~ ^v20[0-9]{2}\.[0-9]{1,2}\.[0-9]{1,2}(\.[0-9]{1,2})?$ ]]
gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" --json isDraft,isPrerelease \
| jq -e '.isDraft == false and .isPrerelease == false'
- name: Checkout release
@@ -236,6 +236,8 @@ jobs:
working-directory: apps/web
run: just build-prod
env:
+ MIN_NATIVE_BUILD_ANDROID: "1"
+ MIN_NATIVE_BUILD_IOS: "185"
VITE_SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_PRODUCTION }}
VITE_POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
VITE_OTEL_EXPORTER_URL: https://macro-prox-prod.macroverse.workers.dev/i/otlp/v1/traces
diff --git a/apps/web/.gitignore b/apps/web/.gitignore
index 34629f871d..a28393174b 100644
--- a/apps/web/.gitignore
+++ b/apps/web/.gitignore
@@ -13,6 +13,7 @@ node_modules/**/*
.bundle-smoke/
# Environments
+/firebase/**/google-services.json
.venv
env/
venv/
diff --git a/apps/web/justfile b/apps/web/justfile
index af00c8ad3d..ff7d46300b 100644
--- a/apps/web/justfile
+++ b/apps/web/justfile
@@ -7,6 +7,10 @@ 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
+
# 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
# beforeDevCommand's environment, and the --config merge points the webview's
diff --git a/apps/web/scripts/android-assetlinks.ts b/apps/web/scripts/android-assetlinks.ts
index 21c2d3b363..df97d36bd2 100644
--- a/apps/web/scripts/android-assetlinks.ts
+++ b/apps/web/scripts/android-assetlinks.ts
@@ -10,7 +10,7 @@ console.log(JSON.stringify([{
relation: ['delegate_permission/common.handle_all_urls'],
target: {
namespace: 'android_app',
- package_name: 'com.macro.app.prod',
+ package_name: 'com.macro.workspace.mobile',
sha256_cert_fingerprints: [...new Set(fingerprints)],
},
}], null, 2));
diff --git a/apps/web/scripts/android-firebase.lock.json b/apps/web/scripts/android-firebase.lock.json
index de01472508..2740337dea 100644
--- a/apps/web/scripts/android-firebase.lock.json
+++ b/apps/web/scripts/android-firebase.lock.json
@@ -2,13 +2,13 @@
"dev": {
"project": "android-release",
"config": "dev",
- "secret": "GOOGLE_SERVICES_JSON_V1",
- "sha256": "2462d00a44657518daad1da298f57e108811ebc2e6dea00673696a30dd8dbbae"
+ "secret": "GOOGLE_SERVICES_JSON_V2",
+ "sha256": "e2391d4bbfb3c511ab45321aa510ce9abcd4c4018851353ed09d035ad5b5a381"
},
"build": {
"project": "android-release",
"config": "prd",
- "secret": "GOOGLE_SERVICES_JSON_V1",
- "sha256": "8d16839be88a544f205edfbf25e9561f20fd5016bcc0c0fdf3f8a313d29b780a"
+ "secret": "GOOGLE_SERVICES_JSON_V2",
+ "sha256": "6fd0b408ae4cb3ab4f2f8b0abdbcc51b798ccdc56fbbbde76aa6e449a10d879e"
}
}
diff --git a/apps/web/scripts/android-firebase.test.ts b/apps/web/scripts/android-firebase.test.ts
index 21d83ddc7e..8c9ec32eb2 100644
--- a/apps/web/scripts/android-firebase.test.ts
+++ b/apps/web/scripts/android-firebase.test.ts
@@ -18,7 +18,7 @@ vi.mock('node:child_process', async (importOriginal) => ({
afterEach(() => vi.mocked(execFileSync).mockReset());
-const config = (project: string, packageName = 'com.macro.app.prod') => ({
+const config = (project: string, packageName = 'com.macro.workspace.mobile') => ({
project_info: { project_id: project, project_number: '123456789' },
client: [
{
@@ -37,16 +37,16 @@ describe('Android Firebase environment selection', () => {
validateAndroidFirebase(config('macro-app-dev-12ae0'), 'dev')
).not.toThrow();
expect(() =>
- validateAndroidFirebase(config('macro-app-955f1'), 'build')
+ validateAndroidFirebase(config('macro-app-prod'), 'build')
).not.toThrow();
});
it('rejects crossed environments even with the correct package', () => {
expect(() =>
validateAndroidFirebase(config('macro-app-dev-12ae0'), 'build')
- ).toThrow('must use macro-app-955f1');
+ ).toThrow('must use macro-app-prod');
expect(() =>
- validateAndroidFirebase(config('macro-app-955f1'), 'dev')
+ validateAndroidFirebase(config('macro-app-prod'), 'dev')
).toThrow('must use macro-app-dev-12ae0');
});
@@ -56,10 +56,10 @@ describe('Android Firebase environment selection', () => {
expect(() => validateAndroidFirebase(fork, 'build', true)).not.toThrow();
expect(() =>
validateAndroidFirebase(config('macro-app-dev-12ae0'), 'build', true)
- ).toThrow('must use macro-app-955f1');
+ ).toThrow('must use macro-app-prod');
expect(() =>
validateAndroidFirebase(config('my-fork', 'wrong.package'), 'build', true)
- ).toThrow('must contain com.macro.app.prod');
+ ).toThrow('must contain com.macro.workspace.mobile');
});
it.each([undefined, ''])(
@@ -121,15 +121,27 @@ describe('Android Firebase environment selection', () => {
config('macro-app-dev-12ae0', 'com.tauri.dev'),
'dev'
)
- ).toThrow('must contain com.macro.app.prod');
+ ).toThrow('must contain com.macro.workspace.mobile');
expect(() => validateAndroidFirebase(null, 'dev')).toThrow(
'Invalid Android Firebase configuration'
);
});
+
+ it('rejects the previous package and production project', () => {
+ expect(() =>
+ validateAndroidFirebase(
+ config('macro-app-prod', 'com.macro.app.prod'),
+ 'build'
+ )
+ ).toThrow('must contain com.macro.workspace.mobile');
+ expect(() =>
+ validateAndroidFirebase(config('macro-app-955f1'), 'build')
+ ).toThrow('must use macro-app-prod');
+ });
});
describe('Pinned Android Firebase download', () => {
- const contents = JSON.stringify(config('macro-app-955f1'));
+ const contents = JSON.stringify(config('macro-app-prod'));
const pin = {
project: 'android-release',
config: 'prd',
diff --git a/apps/web/scripts/android-firebase.ts b/apps/web/scripts/android-firebase.ts
index be5740cdb4..48e3c9c091 100644
--- a/apps/web/scripts/android-firebase.ts
+++ b/apps/web/scripts/android-firebase.ts
@@ -12,8 +12,8 @@ import { dirname, join } from 'node:path';
import { z } from 'zod';
import pins from './android-firebase.lock.json';
-// These projects match the dev/prod FCM credentials used by notification-service.
-const projects = { dev: 'macro-app-dev-12ae0', build: 'macro-app-955f1' };
+// The notification service must use FCM credentials from the matching project.
+const projects = { dev: 'macro-app-dev-12ae0', build: 'macro-app-prod' };
const configSchema = z.object({
project_info: z.object({
project_id: z.string().min(1),
@@ -42,10 +42,10 @@ export function validateAndroidFirebase(
!parsed.data.client.some(
(client) =>
client.client_info.android_client_info.package_name ===
- 'com.macro.app.prod'
+ 'com.macro.workspace.mobile'
)
)
- throw new Error('Firebase config must contain com.macro.app.prod');
+ throw new Error('Firebase config must contain com.macro.workspace.mobile');
const project = parsed.data.project_info.project_id;
if (
project !== projects[action] &&
diff --git a/apps/web/scripts/android-release.test.ts b/apps/web/scripts/android-release.test.ts
index 3fcf762473..89aa7881b3 100644
--- a/apps/web/scripts/android-release.test.ts
+++ b/apps/web/scripts/android-release.test.ts
@@ -16,6 +16,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import {
androidPackage,
androidReleaseMetadata,
+ bumpAndroidVersionCode,
ensureAndroidSigning,
parseAndroidSigning,
propertyValue,
@@ -37,35 +38,91 @@ const signing = {
store_password: 'test-store-password',
};
+const releaseConfig = {
+ version: '2.5.0',
+ bundle: { android: { versionCode: 7 } },
+};
+
describe('Android release versions', () => {
- it('assigns deterministic increasing codes across revisions, days, and years', () => {
- const tags = [
- 'v2026.9.28.0',
- 'v2026.9.28.99',
- 'v2026.9.29.0',
- 'v2027.1.1.0',
- ];
- const codes = tags.map((tag) => androidReleaseMetadata(tag).versionCode);
- expect(codes).toEqual([2026092800, 2026092899, 2026092900, 2027010100]);
- expect(androidReleaseMetadata(tags[0])).toEqual({
- version: '2026.9.28-0',
- versionCode: 2026092800,
- filename: 'macro-v2026.9.28.0-android-arm64.apk',
- });
- expect(androidReleaseMetadata('v2099.12.31.99').versionCode).toBeLessThan(
- 2100000000
- );
- });
+ it.each(['v2026.10.7', 'v2026.10.6.2', 'v2027.1.1.0'])(
+ 'uses the native config independently of tag %s',
+ (tag) => {
+ expect(androidReleaseMetadata(tag, releaseConfig)).toEqual({
+ version: '2.5.0',
+ versionCode: 7,
+ filename: `macro-${tag}-android-arm64.apk`,
+ });
+ }
+ );
it.each([
'main',
'v2026.2.29.0',
- 'v2026.13.1.0',
+ 'v2026.13.1',
'v2026.9.28.100',
'v2100.1.1.0',
'v2026.9.28.0\n',
])('rejects invalid tag %j', (tag) => {
- expect(() => androidReleaseMetadata(tag)).toThrow();
+ expect(() => androidReleaseMetadata(tag, releaseConfig)).toThrow();
+ });
+
+ it.each([undefined, 0, -1, 1.5, '7', 2_100_000_001])(
+ 'rejects invalid native build %j',
+ (versionCode) => {
+ expect(() =>
+ androidReleaseMetadata('v2026.10.7', {
+ ...releaseConfig,
+ bundle: { android: { versionCode } },
+ })
+ ).toThrow();
+ }
+ );
+
+ it('increments the native counter without changing the marketing version or platform settings', async () => {
+ const root = await mkdtemp(join(tmpdir(), 'android-version-test-'));
+ try {
+ const path = join(root, 'tauri.android.conf.json');
+ const config = {
+ ...releaseConfig,
+ bundle: {
+ android: { versionCode: 7, minSdkVersion: 24 },
+ icon: ['icon.png'],
+ },
+ plugins: { 'deep-link': { mobile: [] } },
+ };
+ await writeFile(path, JSON.stringify(config));
+ expect(await bumpAndroidVersionCode(path)).toBe(8);
+ expect(await bumpAndroidVersionCode(path)).toBe(9);
+ const updated = JSON.parse(await readFile(path, 'utf8'));
+ expect(updated).toEqual({
+ ...config,
+ bundle: {
+ ...config.bundle,
+ android: { ...config.bundle.android, versionCode: 9 },
+ },
+ });
+ expect(androidReleaseMetadata('v2026.10.7', updated).versionCode).toBe(9);
+ } 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 {
+ const path = join(root, 'tauri.android.conf.json');
+ const contents = JSON.stringify({
+ ...releaseConfig,
+ bundle: { android: { versionCode: 2_100_000_000 } },
+ });
+ await writeFile(path, contents);
+ await expect(bumpAndroidVersionCode(path)).rejects.toThrow(
+ 'Google Play limit'
+ );
+ expect(await readFile(path, 'utf8')).toBe(contents);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
});
});
@@ -84,7 +141,7 @@ describe('Android signing provisioning', () => {
expect(execFileSync).toHaveBeenCalledWith(
'doppler',
expect.arrayContaining([
- 'ANDROID_UPLOAD_SIGNING_JSON',
+ 'ANDROID_UPLOAD_SIGNING_JSON_V2',
'android-release',
'prd',
]),
@@ -122,9 +179,9 @@ describe('Android signing provisioning', () => {
const properties = join(root, 'keystore.properties');
const missing = join(root, 'missing.properties');
await symlink(missing, properties);
- await expect(
- ensureAndroidSigning(directory, properties)
- ).rejects.toThrow(/broken symlink/);
+ await expect(ensureAndroidSigning(directory, properties)).rejects.toThrow(
+ /broken symlink/
+ );
expect(await readlink(properties)).toBe(missing);
await mkdir(directory);
await expect(
@@ -144,9 +201,7 @@ describe('Android signing provisioning', () => {
vi.mocked(execFileSync).mockImplementation(() => {
throw new Error('secret-password');
});
- await expect(
- ensureAndroidSigning(directory, properties)
- ).rejects.toThrow(
+ await expect(ensureAndroidSigning(directory, properties)).rejects.toThrow(
'Unable to fetch Android signing credentials. Install the Doppler CLI and authenticate with read access to android-release/prd (CI: DOPPLER_TOKEN). See docs/ANDROID_DEVELOPMENT.md.'
);
await expect(stat(directory)).rejects.toMatchObject({ code: 'ENOENT' });
@@ -220,7 +275,7 @@ describe('Android signing provisioning', () => {
});
describe('APK verification', () => {
- const metadata = androidReleaseMetadata('v2026.9.28.0');
+ const metadata = androidReleaseMetadata('v2026.9.28.0', releaseConfig);
const badging = `package: name='${androidPackage}' versionCode='${metadata.versionCode}' versionName='${metadata.version}' platformBuildVersionName='16'\nnative-code: 'arm64-v8a'\n`;
function mockTools(
diff --git a/apps/web/scripts/android-release.ts b/apps/web/scripts/android-release.ts
index 2ae56be2df..0f73628bef 100644
--- a/apps/web/scripts/android-release.ts
+++ b/apps/web/scripts/android-release.ts
@@ -5,12 +5,33 @@ import { mkdir, readFile, symlink, writeFile } from 'node:fs/promises';
import { join, resolve } from 'node:path';
import { z } from 'zod';
-export const androidPackage = 'com.macro.app.prod';
+export const androidPackage = 'com.macro.workspace.mobile';
-export function androidReleaseMetadata(tag: string) {
- const match = /^v(20\d{2})\.(\d{1,2})\.(\d{1,2})\.(\d{1,2})$/.exec(tag);
- if (!match) throw new Error('Expected release tag vYYYY.M.D.N (N: 0–99)');
- const [year, month, day, revision] = match.slice(1).map(Number);
+const androidConfigPath = new URL(
+ '../tauri/src-tauri/tauri.android.conf.json',
+ import.meta.url
+);
+const maxVersionCode = 2_100_000_000;
+const releaseConfigSchema = z
+ .object({
+ version: z.string().regex(/^\d+\.\d+\.\d+$/),
+ bundle: z
+ .object({
+ android: z
+ .object({
+ versionCode: z.number().int().min(1).max(maxVersionCode),
+ })
+ .passthrough(),
+ })
+ .passthrough(),
+ })
+ .passthrough();
+
+export function androidReleaseMetadata(tag: string, config: unknown) {
+ const match = /^v(20\d{2})\.(\d{1,2})\.(\d{1,2})(?:\.(\d{1,2}))?$/.exec(tag);
+ if (!match || match[0] !== tag)
+ throw new Error('Expected release tag vYYYY.M.D or vYYYY.M.D.N (N: 0–99)');
+ const [year, month, day] = match.slice(1, 4).map(Number);
const date = new Date(Date.UTC(year, month - 1, day));
if (
date.getUTCFullYear() !== year ||
@@ -18,16 +39,28 @@ export function androidReleaseMetadata(tag: string) {
date.getUTCDate() !== day
)
throw new Error('Release tag must contain a valid calendar date');
- // YYYYMMDDNN stays below Android's 2,100,000,000 limit through 2099.
- // Rebuilding a tag keeps its code; later dated releases always increase it.
- const versionCode = (year * 10000 + month * 100 + day) * 100 + revision;
+ const release = releaseConfigSchema.parse(config);
return {
- version: `${year}.${month}.${day}-${revision}`,
- versionCode,
+ version: release.version,
+ versionCode: release.bundle.android.versionCode,
filename: `macro-${tag}-android-arm64.apk`,
};
}
+export async function bumpAndroidVersionCode(
+ path: string | URL = androidConfigPath
+) {
+ const config = releaseConfigSchema.parse(
+ JSON.parse(await readFile(path, 'utf8'))
+ );
+ if (config.bundle.android.versionCode === maxVersionCode) {
+ throw new Error('Android versionCode has reached the Google Play limit');
+ }
+ config.bundle.android.versionCode += 1;
+ await writeFile(path, `${JSON.stringify(config, null, 2)}\n`);
+ return config.bundle.android.versionCode;
+}
+
const signingSchema = z.object({
package_name: z.literal(androidPackage),
keystore_base64: z
@@ -108,7 +141,7 @@ function fetchSigning() {
[
'secrets',
'get',
- 'ANDROID_UPLOAD_SIGNING_JSON',
+ 'ANDROID_UPLOAD_SIGNING_JSON_V2',
'--project',
'android-release',
'--config',
@@ -201,9 +234,14 @@ export function verifyAndroidApk(
if (import.meta.main) {
const [command, ...args] = process.argv.slice(2);
try {
- if (command === 'metadata' && args.length === 2) {
+ if (command === 'bump' && args.length === 0) {
+ console.log(await bumpAndroidVersionCode());
+ } else if (command === 'metadata' && args.length === 2) {
const [tag, destination] = args;
- const metadata = androidReleaseMetadata(tag);
+ const metadata = androidReleaseMetadata(
+ tag,
+ JSON.parse(await readFile(androidConfigPath, 'utf8'))
+ );
await writeFile(
destination,
JSON.stringify({
@@ -222,11 +260,14 @@ if (import.meta.main) {
apk,
buildTools,
await readFile(certificateFile, 'utf8'),
- androidReleaseMetadata(tag)
+ androidReleaseMetadata(
+ tag,
+ JSON.parse(await readFile(androidConfigPath, 'utf8'))
+ )
);
} else {
throw new Error(
- 'Usage: android-release.ts metadata TAG CONFIG | signing DIRECTORY PROPERTIES | ensure-signing DIRECTORY PROPERTIES | verify TAG APK BUILD_TOOLS CERTIFICATE_FILE'
+ 'Usage: android-release.ts bump | metadata TAG CONFIG | signing DIRECTORY PROPERTIES | ensure-signing DIRECTORY PROPERTIES | verify TAG APK BUILD_TOOLS CERTIFICATE_FILE'
);
}
} catch (error) {
diff --git a/apps/web/src/lib/core/mobile/native-update-link.test.ts b/apps/web/src/lib/core/mobile/native-update-link.test.ts
index 51b942de99..fd4aa78eda 100644
--- a/apps/web/src/lib/core/mobile/native-update-link.test.ts
+++ b/apps/web/src/lib/core/mobile/native-update-link.test.ts
@@ -9,7 +9,7 @@ describe('native update destination', () => {
const url = new URL(nativeUpdateLink('android'));
expect(url.protocol).toBe('https:');
expect(url.hostname).toBe('play.google.com');
- expect(url.searchParams.get('id')).toBe('com.macro.app.prod');
+ expect(url.searchParams.get('id')).toBe('com.macro.workspace.mobile');
expect(nativeUpdateLink('ios')).toContain('id6743133649');
});
diff --git a/apps/web/src/lib/core/mobile/native-update-link.ts b/apps/web/src/lib/core/mobile/native-update-link.ts
index dc027ba8e6..b70e654f46 100644
--- a/apps/web/src/lib/core/mobile/native-update-link.ts
+++ b/apps/web/src/lib/core/mobile/native-update-link.ts
@@ -3,7 +3,7 @@ import { invoke } from '@tauri-apps/api/core';
/** HTTPS works even when the Play Store app is absent. */
export function nativeUpdateLink(platform: 'ios' | 'android'): string {
return platform === 'android'
- ? 'https://play.google.com/store/apps/details?id=com.macro.app.prod'
+ ? 'https://play.google.com/store/apps/details?id=com.macro.workspace.mobile'
: 'https://apps.apple.com/us/app/macro-app/id6743133649';
}
diff --git a/apps/web/tauri/src-tauri/.well-known/assetlinks.dev.json b/apps/web/tauri/src-tauri/.well-known/assetlinks.dev.json
index 8e18710ac4..2ea159458d 100644
--- a/apps/web/tauri/src-tauri/.well-known/assetlinks.dev.json
+++ b/apps/web/tauri/src-tauri/.well-known/assetlinks.dev.json
@@ -5,7 +5,7 @@
],
"target": {
"namespace": "android_app",
- "package_name": "com.macro.app.prod",
+ "package_name": "com.macro.workspace.mobile",
"sha256_cert_fingerprints": [
"1F:E1:30:45:EE:64:BD:02:DA:24:F7:E8:D5:08:8B:1A:B2:88:4E:DB:E3:CB:AE:00:A1:E1:F6:87:E3:0A:3E:06",
"89:D3:D8:C4:BB:61:96:DE:43:B3:C9:11:4B:FC:74:49:E1:A5:F3:3E:D2:B0:99:9A:E5:97:C5:DF:B8:F5:85:47"
diff --git a/apps/web/tauri/src-tauri/gen/android/app/.gitignore b/apps/web/tauri/src-tauri/gen/android/app/.gitignore
index fb889a35e4..0889fc77e6 100644
--- a/apps/web/tauri/src-tauri/gen/android/app/.gitignore
+++ b/apps/web/tauri/src-tauri/gen/android/app/.gitignore
@@ -1,6 +1,7 @@
/src/main/java/com/macro/app/prod/generated
+/src/main/java/com/macro/workspace/mobile/generated
/src/main/jniLibs/**/*.so
/src/main/assets/tauri.conf.json
/tauri.build.gradle.kts
/proguard-tauri.pro
-/tauri.properties
\ No newline at end of file
+/tauri.properties
diff --git a/apps/web/tauri/src-tauri/gen/android/app/build.gradle.kts b/apps/web/tauri/src-tauri/gen/android/app/build.gradle.kts
index 8882b56de7..bc05825817 100644
--- a/apps/web/tauri/src-tauri/gen/android/app/build.gradle.kts
+++ b/apps/web/tauri/src-tauri/gen/android/app/build.gradle.kts
@@ -35,7 +35,7 @@ if (firebaseConfigured) {
}
gradle.taskGraph.whenReady {
if (!firebaseConfigured && allTasks.any { it.name.contains("Release") }) {
- throw GradleException("Release builds require app/google-services.json for com.macro.app.prod; see docs/ANDROID_DEVELOPMENT.md")
+ throw GradleException("Release builds require app/google-services.json for com.macro.workspace.mobile; see docs/ANDROID_DEVELOPMENT.md")
}
if (allTasks.any { it.name.contains("Release") }) {
releaseSigningProperties.getOrThrow()
@@ -51,10 +51,10 @@ val tauriProperties = Properties().apply {
android {
compileSdk = 36
- namespace = "com.macro.app.prod"
+ namespace = "com.macro.workspace.mobile"
defaultConfig {
manifestPlaceholders["usesCleartextTraffic"] = "false"
- applicationId = "com.macro.app.prod"
+ applicationId = "com.macro.workspace.mobile"
minSdk = 24
targetSdk = 36
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
diff --git a/apps/web/tauri/src-tauri/gen/android/app/src/main/java/com/macro/app/prod/MainActivity.kt b/apps/web/tauri/src-tauri/gen/android/app/src/main/java/com/macro/workspace/mobile/MainActivity.kt
similarity index 95%
rename from apps/web/tauri/src-tauri/gen/android/app/src/main/java/com/macro/app/prod/MainActivity.kt
rename to apps/web/tauri/src-tauri/gen/android/app/src/main/java/com/macro/workspace/mobile/MainActivity.kt
index eae8581aa2..43f8e64b01 100644
--- a/apps/web/tauri/src-tauri/gen/android/app/src/main/java/com/macro/app/prod/MainActivity.kt
+++ b/apps/web/tauri/src-tauri/gen/android/app/src/main/java/com/macro/workspace/mobile/MainActivity.kt
@@ -1,4 +1,4 @@
-package com.macro.app.prod
+package com.macro.workspace.mobile
import android.os.Bundle
import android.content.Context
diff --git a/apps/web/tauri/src-tauri/src/android_tls.rs b/apps/web/tauri/src-tauri/src/android_tls.rs
index 9fee401905..67bda24cd7 100644
--- a/apps/web/tauri/src-tauri/src/android_tls.rs
+++ b/apps/web/tauri/src-tauri/src/android_tls.rs
@@ -3,7 +3,7 @@
use jni::{JNIEnv, objects::JObject, sys::jboolean};
#[unsafe(no_mangle)]
-extern "system" fn Java_com_macro_app_prod_MainActivity_initializeCertificateVerifier(
+extern "system" fn Java_com_macro_workspace_mobile_MainActivity_initializeCertificateVerifier(
mut env: JNIEnv,
_activity: JObject,
context: JObject,
diff --git a/apps/web/tauri/src-tauri/tauri.android.conf.json b/apps/web/tauri/src-tauri/tauri.android.conf.json
index abbcd53729..e1c004e5e6 100644
--- a/apps/web/tauri/src-tauri/tauri.android.conf.json
+++ b/apps/web/tauri/src-tauri/tauri.android.conf.json
@@ -1,6 +1,13 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "macro",
+ "identifier": "com.macro.workspace.mobile",
+ "version": "2.5.0",
+ "bundle": {
+ "android": {
+ "versionCode": 1
+ }
+ },
"plugins": {
"deep-link": {
"mobile": [
diff --git a/apps/web/tests/native/android/smoke-utils.test.ts b/apps/web/tests/native/android/smoke-utils.test.ts
index 1d8c00bfab..c27a7d963c 100644
--- a/apps/web/tests/native/android/smoke-utils.test.ts
+++ b/apps/web/tests/native/android/smoke-utils.test.ts
@@ -5,9 +5,9 @@ describe('Android smoke fixture isolation', () => {
test.each([1, 1.5, 2.625])(
'maps CSS input bounds at scale %s with a window offset',
(scale) => {
- const hierarchy = `<node class="android.webkit.WebView" package="com.macro.app.prod" bounds="[30,60][${30 + 400 * scale},${60 + 800 * scale}]"/>`;
+ const hierarchy = `<node class="android.webkit.WebView" package="com.macro.workspace.mobile" bounds="[30,60][${30 + 400 * scale},${60 + 800 * scale}]"/>`;
expect(
- screenPointForInput(hierarchy, 'com.macro.app.prod', {
+ screenPointForInput(hierarchy, 'com.macro.workspace.mobile', {
rect: { left: 20, top: 100, width: 300, height: 80 },
viewport: { left: 10, top: 20, width: 400, height: 800 },
})
@@ -21,8 +21,8 @@ describe('Android smoke fixture isolation', () => {
test('refuses to tap when the input is outside the visible viewport', () => {
expect(() =>
screenPointForInput(
- '<node class="android.webkit.WebView" package="com.macro.app.prod" bounds="[0,0][1080,2400]"/>',
- 'com.macro.app.prod',
+ '<node class="android.webkit.WebView" package="com.macro.workspace.mobile" bounds="[0,0][1080,2400]"/>',
+ 'com.macro.workspace.mobile',
{
rect: { left: 500, top: 100, width: 100, height: 80 },
viewport: { left: 0, top: 0, width: 400, height: 800 },
@@ -33,9 +33,9 @@ describe('Android smoke fixture isolation', () => {
test('uses native container bounds when Chromium exposes a nested WebView', () => {
const hierarchy =
- '<node class="android.webkit.WebView" package="com.macro.app.prod" bounds="[30,60][830,1660]"><node class="android.webkit.WebView" package="com.macro.app.prod" bounds="[30,80][830,1640]"/></node>';
+ '<node class="android.webkit.WebView" package="com.macro.workspace.mobile" bounds="[30,60][830,1660]"><node class="android.webkit.WebView" package="com.macro.workspace.mobile" bounds="[30,80][830,1640]"/></node>';
expect(
- screenPointForInput(hierarchy, 'com.macro.app.prod', {
+ screenPointForInput(hierarchy, 'com.macro.workspace.mobile', {
rect: { left: 20, top: 100, width: 300, height: 80 },
viewport: { left: 0, top: 0, width: 400, height: 800 },
})
diff --git a/apps/web/tests/native/android/smoke.mjs b/apps/web/tests/native/android/smoke.mjs
index f6345dec96..d46621ff8d 100644
--- a/apps/web/tests/native/android/smoke.mjs
+++ b/apps/web/tests/native/android/smoke.mjs
@@ -11,7 +11,7 @@ const adb =
process.env.ADB ??
`${process.env.HOME}/Library/Android/sdk/platform-tools/adb`;
const output = process.env.ANDROID_SMOKE_OUTPUT ?? '/tmp/macro-task03-smoke';
-const packageName = 'com.macro.app.prod';
+const packageName = 'com.macro.workspace.mobile';
const port = 9236;
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function adbRun(...args) {
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index 196f365388..f105aed2e4 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -896,7 +896,7 @@ The Move to folder picker uses the Drive sidebar’s folder rows: neutral icons,
When newer frontend JS requires a newer native app, the mobile shell offers
**Update app** and **OK**. Update app uses the native opener; Android targets the
-HTTPS Play listing for `com.macro.app.prod`, allowing a browser when the Store app
+HTTPS Play listing for `com.macro.workspace.mobile`, allowing a browser when the Store app
is absent. An opener failure displays an inline error and the dialog stays
dismissible. A missing listing is handled in the external store/browser: return
to Macro, dismiss, and retry later. Task 07 verifies the live listing.
diff --git a/docs/ANDROID_DEVELOPMENT.md b/docs/ANDROID_DEVELOPMENT.md
index ac1f5aec59..cc188a553b 100644
--- a/docs/ANDROID_DEVELOPMENT.md
+++ b/docs/ANDROID_DEVELOPMENT.md
@@ -1,9 +1,16 @@
# Android development
-Macro's Android package is `com.macro.app.prod`. Its Gradle project lives in
+Macro's Android package is `com.macro.workspace.mobile`. Its Gradle project lives in
`apps/web/tauri/src-tauri/gen/android`. Keep the project and wrapper in source
control; do not regenerate them to repair a build error.
+The Android-specific Tauri config overrides the shared identifier. iOS and desktop
+retain `com.macro.app.prod`. The Android activity package and native certificate
+verifier's JNI symbol must match the Android identifier.
+When switching an existing checkout, remove the obsolete ignored
+`gen/android/app/src/main/java/com/macro/app/prod/generated` directory. Tauri
+generates classes for the new package during the build; keep the Gradle project.
+
## Prerequisites
- Use the repository's Bun version (`packageManager` in the root `package.json`)
@@ -55,12 +62,13 @@ signed artifacts. Debug builds do not fetch release signing credentials.
## Release signing
The existing upload keystore and signing credentials are stored in Doppler
-`android-release/prd`, secret `ANDROID_UPLOAD_SIGNING_JSON`. It contains
+`android-release/prd`, secret `ANDROID_UPLOAD_SIGNING_JSON_V2`. It contains
`keystore_base64`, `keystore_sha256`, `certificate_sha256`, `package_name`,
`key_alias`, `key_password`, and `store_password`. Keep them outside the checkout
and provision them securely for CI.
-Coordinate key replacement with Play Console; do not generate a new key for
-routine builds.
+The V2 signing metadata names the new Android package and retains the existing
+upload key. Keep the unversioned metadata for builds of older commits. Coordinate
+key replacement with Play Console; do not generate a new key for routine builds.
`just android-build` preserves existing `gen/android/keystore.properties`
configuration, including CI-provisioned signing. When it is missing, the launcher
@@ -133,11 +141,50 @@ and are removed even when the build fails. Only APK/checksum files are attached
to the release; the separate `android-build-log` Actions artifact is retained for
seven days, including on failed builds.
-Release tags must follow `vYYYY.M.D.N`, with a valid date, years 2000–2099, and a
-daily revision from 0–99. Android's `versionCode` is `YYYYMMDDNN` (for example,
-`v2026.9.28.1` becomes `2026092801`), and `versionName` is `2026.9.28-1`.
-New releases must increase the date/revision; a rerun retains the same version.
-Always keep the signing key to allow upgrades over earlier distributed APKs.
+Android's native release identity lives in
+`apps/web/tauri/src-tauri/tauri.android.conf.json`: `version` is the user-visible
+versionName, and `bundle.android.versionCode` is an independent positive integer
+counter. Local Tauri builds and CI use the same values. Release tags may be
+`vYYYY.M.D` or `vYYYY.M.D.N` (valid dates, years 2000–2099, revision 0–99); they
+identify source and artifact filenames, and do not determine either Android
+version field.
+
+The first release using this counter is build **1**. Before each subsequent
+native release (including a new binary with the same marketing version), run
+from `apps/web`:
+
+```sh
+just android-bump
+```
+
+Commit the changed config before tagging the release. This increments only
+`versionCode`; edit `version` separately when changing the marketing version.
+Builds never increment the counter implicitly, so retries of the same release
+retain its identity. Never distribute different releases with the same code or
+reuse a code already uploaded to Google Play. Keep the signing key for upgrades.
+The counter may not exceed [Google Play's 2,100,000,000 limit](https://developer.android.com/studio/publish/versioning).
+
+This deliberately resets the former date-based/test codes. The new Android package
+is a separate installation from the former `com.macro.app.prod` test APK; it does
+not update that app or inherit its local data. Do not carry the old test APK into
+the Play rollout. Uninstall the old app when moving testers to the new package:
+both apps claim the same `macro://` authentication and navigation callbacks.
+
+`MIN_NATIVE_BUILD_ANDROID` remains a separate compatibility floor. For the first
+build with runtime GraphQL SDL and schema 3 OTA support (#7724 and #7303), it is
+**1**. Set it alongside `MIN_NATIVE_BUILD_IOS` when building the OTA frontend.
+Retain the floor as the native counter increases; raise it only when the frontend
+requires newer native capabilities. Older date-coded test APKs exceed this floor,
+so retire them rather than relying on it to exclude those test installs.
+
+When moving to Google Play, keep this same counter for AAB builds across all
+tracks (internal testing, closed testing, and production). Promote the same
+uploaded artifact between tracks; allocate a new code for a new binary. The
+existing `just android-build --aab` path uses the same Tauri config. The workflow
+below still publishes APKs; Play upload, signing enrollment, and track promotion
+are a separate setup. Use [Play App Signing](https://developer.android.com/studio/publish/app-signing) and preserve its app-signing key once
+Play distribution starts; the upload key and installed-app signing key are
+separate roles.
Before upload, CI verifies the signing certificate, package/version, ARM64 ABI,
non-debuggable manifest, and 16 KiB ZIP alignment. Publishing waits for the web,
@@ -185,19 +232,19 @@ payload's recipient against the registered account to reject delayed pushes
from an earlier session.
For verification, test foreground, background, and ordinary process death
-separately. Background the app, then use `adb shell am kill com.macro.app.prod`
+separately. Background the app, then use `adb shell am kill com.macro.workspace.mobile`
for the process-dead case. Android force-stop is a different state that prevents
FCM delivery until the user opens the app again. Also test permission and channel
revocation, logout/account switching, repeated delivery, notification taps, and
read/done clearing. Silent clearing uses normal-priority FCM and may be delayed
by Doze. A local display test alone does not verify backend event delivery.
-The launcher requires package **com.macro.app.prod** and validates these projects:
+The launcher requires package **com.macro.workspace.mobile** and validates these projects:
| Build command | Firebase project |
| --- | --- |
| `android-dev` | `macro-app-dev-12ae0` |
-| `android-build` (including `--debug`) | `macro-app-955f1` |
+| `android-build` (including `--debug`) | `macro-app-prod` |
### Reproducible configuration
@@ -215,7 +262,7 @@ of the UTF-8 value with leading/trailing whitespace removed. It validates the
Firebase project and Android package before atomically writing the ignored
`tauri/src-tauri/gen/android/app/google-services.json` consumed by Gradle.
-Each config has a versioned key, initially `GOOGLE_SERVICES_JSON_V1`. Missing
+Each config has a versioned key, currently `GOOGLE_SERVICES_JSON_V2`. Missing
authentication, a missing key, a checksum mismatch, or an invalid config stops
the build before Cargo starts. Existing local config files are not a fallback:
they cannot silently change which Firebase configuration a commit builds with.
@@ -241,7 +288,7 @@ just android-build --firebase-config /absolute/path/google-services.json
```
An explicit file bypasses the Doppler fetch and checksum pin. It still must
-contain `com.macro.app.prod`, the current Android package. Other Firebase project
+contain `com.macro.workspace.mobile`, the current Android package. Other Firebase project
IDs are allowed for forks; Macro's known dev/prod projects are still rejected
when used with the opposite build command. Forks changing the Android package
must also update the package validation in `scripts/android-firebase.ts` and
@@ -257,12 +304,12 @@ their own Firebase resources.
1. Download the updated Android config from the intended Firebase project and
validate its package and project ID.
2. Store it under a **new** key in the matching `android-release` Doppler config
- (for example, `GOOGLE_SERVICES_JSON_V2`). Keep every older pinned key unchanged
+ (for example, `GOOGLE_SERVICES_JSON_V3`). Keep every older pinned key unchanged
so older commits remain buildable. Pass the value through stdin, not a command
argument, and suppress command output to avoid printing it:
```sh
- doppler secrets set GOOGLE_SERVICES_JSON_V2 --project android-release --config prd < /path/google-services.json > /dev/null
+ doppler secrets set GOOGLE_SERVICES_JSON_V3 --project android-release --config prd < /path/google-services.json > /dev/null
```
3. Update that environment's key and SHA-256 in `scripts/android-firebase.lock.json`.
@@ -277,6 +324,26 @@ their own Firebase resources.
(use `dev` for development). Review and commit the lock-file change; never
replace the checksum just to silence an unexpected mismatch.
+### Production Firebase project setup
+
+The production Android app is registered as `com.macro.workspace.mobile` in
+`macro-app-prod`; development uses `macro-app-dev-12ae0`. The Google services
+Gradle plugin and Firebase Messaging SDK are already integrated. The console's
+generic SDK snippets do not need to be added again.
+
+The downloaded `google-services.json` configures the Android client only. The
+notification backend delivers Android pushes through an AWS SNS platform
+application, whose FCM credential must belong to the same Firebase project.
+For production, store the new project's service-account JSON securely in the
+AWS Secrets Manager secret selected by `notification-service:fcm_secret_key`
+(`fcm-credential-prod` in `Pulumi.prod.yaml`), then update the notification-service
+stack so its SNS platform application receives the credential. Do not deploy a
+credential replacement until existing Android installations using the former
+Firebase project have been accounted for; their tokens belong to that project.
+Verify real push delivery after the change. The client config alone cannot prove
+the backend is configured or that delivery works. Never commit or print a
+service-account private key.
+
## Browser authentication
Android uses `android_auth_plugin` and AndroidX Auth Tab, with a Custom Tabs
@@ -387,7 +454,7 @@ physical-device matrix.
## App Links
-App Links require a domain association for `com.macro.app.prod` and the certificate
+App Links require a domain association for `com.macro.workspace.mobile` and the certificate
that signed the installed APK. From `apps/web`, generate a candidate association:
```sh
@@ -408,12 +475,12 @@ re-verifying. Do not force a domain to `approved` or `verified` to claim success
After installing an APK signed with an associated certificate:
```sh
-adb shell pm verify-app-links --re-verify com.macro.app.prod
-adb shell pm get-app-links com.macro.app.prod
+adb shell pm verify-app-links --re-verify com.macro.workspace.mobile
+adb shell pm get-app-links com.macro.workspace.mobile
adb shell am start -W -a android.intent.action.VIEW -c android.intent.category.DEFAULT -c android.intent.category.BROWSABLE -d 'https://dev.macro.com/app/task/TASK_ID'
```
-Adding `-p com.macro.app.prod` tests routing but does not prove domain verification.
+Adding `-p com.macro.workspace.mobile` tests routing but does not prove domain verification.
Test cold/warm links, auth cancellation/retry, email-code login, relaunch with a
session, logout/account switching, and entity links through login. Repeat with
signed release builds and actual provider sign-in.
@@ -426,7 +493,7 @@ Publication procedure for the hosting owner:
`/.well-known/*` origin. Confirm the endpoint returns HTTP 200 with JSON
directly, without a redirect or an HTML fallback.
2. Obtain the SHA-256 **app-signing** fingerprint from Play Console for
- `com.macro.app.prod`. The upload certificate is only suitable for testing
+ `com.macro.workspace.mobile`. The upload certificate is only suitable for testing
locally signed builds. If staging is used for such a test, explicitly select
the local-release certificate; keep debug certificates confined to dev.
3. Download and retain the existing association JSON, S3 ETag and object metadata.
@@ -503,10 +570,10 @@ build, and these results for locally installed release builds:
| Revocation, apply on resume, unavailable store handler/listing | Embedded fallback; correct generation acknowledgment; dismissible update dialog |
| Lower-end physical hardware | Cold/warm launch and hydration times, large lists/documents, peak PSS, background CPU/battery and Doze |
-Background then use `adb shell am kill com.macro.app.prod` and verify the PID
+Background then use `adb shell am kill com.macro.workspace.mobile` and verify the PID
has disappeared for normal process death. Force-stop/relaunch is a separate case.
-Use `adb shell am start -W -n com.macro.app.prod/.MainActivity` for launch timings,
-`adb shell dumpsys meminfo com.macro.app.prod` for PSS, and Perfetto/Android Studio
+Use `adb shell am start -W -n com.macro.workspace.mobile/.MainActivity` for launch timings,
+`adb shell dumpsys meminfo com.macro.workspace.mobile` for PSS, and Perfetto/Android Studio
for rendering/CPU/battery evidence. A VM emulator cannot qualify physical battery,
cellular handoffs, OEM memory pressure, or lower-end hardware. Do not reset shared
device statistics or account data. Keep evidence free of credentials/content.