feat(mobile): share history as Markdown or original audio and harden the E2E gate

Adds history share (Markdown file / original audio) with 12-locale strings, pins Maestro to
the target device with --udid, allows cleartext only for explicit local E2E artifacts, and
fixes small-screen scroll/keyboard races in the Maestro flows.
Evidence: docs/evidence/2026-11-17-backlog-operations.md.
This commit is contained in:
Yun Chan 2026-11-20 15:16:13 +09:00
parent e0b1ceaa75
commit 8d8aaf5794
29 changed files with 627 additions and 26 deletions

View file

@ -4,6 +4,10 @@ import { resolve } from 'node:path'
const ROOT = resolve(import.meta.dirname, '../..')
const BUILD_GRADLE = resolve(ROOT, 'apps/mobile-rn/android/app/build.gradle')
const ROOT_BUILD_GRADLE = resolve(ROOT, 'apps/mobile-rn/android/build.gradle')
const ANDROID_MANIFEST = resolve(ROOT, 'apps/mobile-rn/android/app/src/main/AndroidManifest.xml')
const IOS_PROJECT = resolve(ROOT, 'apps/mobile-rn/ios/D3ROVoice.xcodeproj/project.pbxproj')
const IOS_PLIST = resolve(ROOT, 'apps/mobile-rn/ios/D3ROVoice/Info.plist')
const AUTH_REDIRECT = resolve(ROOT, 'apps/mobile-rn/src/lib/auth-redirect.ts')
const PRODUCT_VERSION = resolve(ROOT, 'release/product-version.json')
const CONFIG_MODULE = resolve(
ROOT,
@ -60,16 +64,48 @@ function parseIntegerConstant(source, name) {
}
async function readSourceContractFiles() {
const [gradle, rootGradle, configModule, productVersionSource] = await Promise.all([
const [
gradle,
rootGradle,
configModule,
productVersionSource,
androidManifest,
iosProject,
iosPlist,
authRedirect,
] = await Promise.all([
readFile(BUILD_GRADLE, 'utf8'),
readFile(ROOT_BUILD_GRADLE, 'utf8'),
readFile(CONFIG_MODULE, 'utf8'),
readFile(PRODUCT_VERSION, 'utf8'),
readFile(ANDROID_MANIFEST, 'utf8'),
readFile(IOS_PROJECT, 'utf8'),
readFile(IOS_PLIST, 'utf8'),
readFile(AUTH_REDIRECT, 'utf8'),
])
return { gradle, rootGradle, configModule, productVersion: JSON.parse(productVersionSource) }
return {
gradle,
rootGradle,
configModule,
productVersion: JSON.parse(productVersionSource),
androidManifest,
iosProject,
iosPlist,
authRedirect,
}
}
function verifySourceContractSources({ gradle, rootGradle, configModule, productVersion }) {
function verifySourceContractSources(sources) {
const {
gradle,
rootGradle,
configModule,
productVersion,
androidManifest,
iosProject,
iosPlist,
authRedirect,
} = sources
if (/gradle\.startParameter\.taskNames/.test(gradle)) {
fail('variant_gate_must_not_use_requested_task_name_heuristics')
}
@ -78,6 +114,36 @@ function verifySourceContractSources({ gradle, rootGradle, configModule, product
}
const defaultConfigBlock = extractBlock(gradle, /\bdefaultConfig\s*\{/, 'missing_default_config')
requireMatch(
defaultConfigBlock,
/applicationId\s+"com\.d3ro\.voice"/,
'android_application_id_must_be_canonical',
)
const iosBundleIds = [...iosProject.matchAll(/PRODUCT_BUNDLE_IDENTIFIER\s*=\s*([^;]+);/g)]
.map(match => match[1].trim())
if (iosBundleIds.length === 0 || iosBundleIds.some(value => value !== 'com.d3ro.voice')) {
fail('ios_bundle_identifier_must_be_canonical')
}
const iosSchemeBlock = iosPlist.match(
/<key>CFBundleURLSchemes<\/key>\s*<array>([\s\S]*?)<\/array>/,
)?.[1]
if (!iosSchemeBlock) fail('ios_url_schemes_missing')
const iosSchemes = [...iosSchemeBlock.matchAll(/<string>([^<]+)<\/string>/g)].map(match => match[1])
if (iosSchemes.length !== 1 || iosSchemes[0] !== 'd3ro-voice') {
fail('ios_url_scheme_must_be_canonical')
}
requireMatch(
authRedirect,
/AUTH_REDIRECT_URL\s*=\s*'d3ro-voice:\/\/auth-callback'/,
'oauth_callback_scheme_must_be_canonical',
)
for (const host of ['auth-callback', 'accept-invite']) {
requireMatch(
androidManifest,
new RegExp(`android:scheme="d3ro-voice"\\s+android:host="${host}"`),
`android_${host}_deep_link_must_be_canonical`,
)
}
const buildTypesBlock = extractBlock(gradle, /\bbuildTypes\s*\{/, 'missing_build_types')
const e2eBlock = extractBlock(buildTypesBlock, /\be2e\s*\{/, 'missing_e2e_build_type')
const debugBlock = extractBlock(buildTypesBlock, /\bdebug\s*\{/, 'missing_debug_build_type')
@ -269,10 +335,10 @@ async function verifySourceContract() {
verifySourceContractSources(await readSourceContractFiles())
}
function expectSourceContractFailure(sources, mutate, expectedMessage) {
function expectSourceContractFailure(sources, mutate, expectedMessage, field = 'gradle') {
let failedAsExpected = false
try {
verifySourceContractSources({ ...sources, gradle: mutate(sources.gradle) })
verifySourceContractSources({ ...sources, [field]: mutate(sources[field]) })
} catch (error) {
if (!(error instanceof Error) || !error.message.includes(expectedMessage)) throw error
failedAsExpected = true
@ -341,6 +407,35 @@ function verifyVariant(variant, buildConfig) {
if (process.argv.includes('--self-test')) {
const sources = await readSourceContractFiles()
verifySourceContractSources(sources)
expectSourceContractFailure(
sources,
(gradle) => gradle.replace('applicationId "com.d3ro.voice"', 'applicationId "invalid.example"'),
'android_application_id_must_be_canonical',
)
expectSourceContractFailure(
sources,
(iosProject) => iosProject.replaceAll('PRODUCT_BUNDLE_IDENTIFIER = com.d3ro.voice;', 'PRODUCT_BUNDLE_IDENTIFIER = invalid.example;'),
'ios_bundle_identifier_must_be_canonical',
'iosProject',
)
expectSourceContractFailure(
sources,
(iosPlist) => iosPlist.replace('<string>d3ro-voice</string>', '<string>d3ro</string>'),
'ios_url_scheme_must_be_canonical',
'iosPlist',
)
expectSourceContractFailure(
sources,
(authRedirect) => authRedirect.replace('d3ro-voice://auth-callback', 'd3ro://auth-callback'),
'oauth_callback_scheme_must_be_canonical',
'authRedirect',
)
expectSourceContractFailure(
sources,
(androidManifest) => androidManifest.replace('android:scheme="d3ro-voice" android:host="auth-callback"', 'android:scheme="d3ro" android:host="auth-callback"'),
'android_auth-callback_deep_link_must_be_canonical',
'androidManifest',
)
expectSourceContractFailure(
sources,
(gradle) => gradle.replace('candidate.name == "preE2eBuild"', 'candidate.name == "preE2eBuildDisabled"'),