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:
parent
e0b1ceaa75
commit
8d8aaf5794
29 changed files with 627 additions and 26 deletions
|
|
@ -86,6 +86,7 @@ function sameFileSnapshot(left, right) {
|
|||
function parseArguments(argv) {
|
||||
const allowed = new Set([
|
||||
'aab',
|
||||
'allow-local-cleartext',
|
||||
'apk',
|
||||
'bundletool',
|
||||
'expected-admob-app-id',
|
||||
|
|
@ -706,7 +707,7 @@ function verifyDeepLinkManifest(manifest) {
|
|||
if (!verifiedAppLink) fail('missing_verified_app_link_accept_invite')
|
||||
}
|
||||
|
||||
function verifyManifestContracts(badging, manifest, mode, expectedAdMobAppId) {
|
||||
function verifyManifestContracts(badging, manifest, mode, expectedAdMobAppId, allowLocalCleartext = false) {
|
||||
const packageInfo = badging.match(/package: name='([^']+)' versionCode='([0-9]+)' versionName='([^']+)'/)
|
||||
if (!packageInfo || packageInfo[1] !== EXPECTED_PACKAGE) fail('package_name_mismatch')
|
||||
const versionCode = Number(packageInfo[2])
|
||||
|
|
@ -719,7 +720,8 @@ function verifyManifestContracts(badging, manifest, mode, expectedAdMobAppId) {
|
|||
if (mode !== 'debug' && debuggable) fail(`${mode}_must_not_be_debuggable`)
|
||||
if (mode === 'debug' && !debuggable) fail('debug_must_be_debuggable')
|
||||
|
||||
if (!/android:usesCleartextTraffic[^\n]*0x0\b/.test(manifest) && mode !== 'debug') {
|
||||
const cleartextAllowed = mode === 'debug' || (mode === 'e2e' && allowLocalCleartext)
|
||||
if (!/android:usesCleartextTraffic[^\n]*0x0\b/.test(manifest) && !cleartextAllowed) {
|
||||
fail(`${mode}_cleartext_must_be_false`)
|
||||
}
|
||||
const requiredPermissions = [
|
||||
|
|
@ -747,11 +749,11 @@ function verifyManifestContracts(badging, manifest, mode, expectedAdMobAppId) {
|
|||
return { debuggable, adMobAppId, versionName, versionCode, minSdk, targetSdk }
|
||||
}
|
||||
|
||||
function verifyManifest(aapt, archive, mode, expectedAdMobAppId) {
|
||||
function verifyManifest(aapt, archive, mode, expectedAdMobAppId, allowLocalCleartext = false) {
|
||||
const apkPath = archive.absolute
|
||||
const badging = runArtifact(aapt, ['dump', 'badging', apkPath], 'aapt_badging', archive)
|
||||
const manifest = runArtifact(aapt, ['dump', 'xmltree', apkPath, 'AndroidManifest.xml'], 'aapt_manifest', archive)
|
||||
return verifyManifestContracts(badging, manifest, mode, expectedAdMobAppId)
|
||||
return verifyManifestContracts(badging, manifest, mode, expectedAdMobAppId, allowLocalCleartext)
|
||||
}
|
||||
|
||||
function verifyArchive(archive, mode) {
|
||||
|
|
@ -1114,6 +1116,35 @@ function runSigningPolicySelfTest() {
|
|||
if (!legacyArgumentRejected) fail('self_test_legacy_certificate_argument_not_rejected')
|
||||
|
||||
const manifestFixture = createManifestContractSelfTestFixture()
|
||||
const localOptions = parseArguments([
|
||||
'--mode', 'e2e',
|
||||
'--apk', 'local.apk',
|
||||
'--allow-local-cleartext', 'true',
|
||||
])
|
||||
if (localOptions['allow-local-cleartext'] !== 'true') fail('self_test_local_cleartext_option')
|
||||
const localE2eManifest = manifestFixture.manifest
|
||||
.replace('android:usesCleartextTraffic=(type 0x12)0x0', 'android:usesCleartextTraffic=(type 0x12)0xffffffff')
|
||||
.replaceAll('ca-app-pub-1234567890123456~1234567890', TEST_ADMOB_APP_ID)
|
||||
expectSelfTestFailure(
|
||||
'manifest_local_e2e_cleartext_default',
|
||||
() => verifyManifestContracts(manifestFixture.badging, localE2eManifest, 'e2e', null),
|
||||
'e2e_cleartext_must_be_false',
|
||||
)
|
||||
verifyManifestContracts(manifestFixture.badging, localE2eManifest, 'e2e', null, true)
|
||||
expectSelfTestFailure(
|
||||
'manifest_release_cleartext_override',
|
||||
() => verifyManifestContracts(
|
||||
manifestFixture.badging,
|
||||
manifestFixture.manifest.replace(
|
||||
'android:usesCleartextTraffic=(type 0x12)0x0',
|
||||
'android:usesCleartextTraffic=(type 0x12)0xffffffff',
|
||||
),
|
||||
'release',
|
||||
'ca-app-pub-1234567890123456~1234567890',
|
||||
true,
|
||||
),
|
||||
'release_cleartext_must_be_false',
|
||||
)
|
||||
const manifestEvidence = verifyManifestContracts(
|
||||
manifestFixture.badging,
|
||||
manifestFixture.manifest,
|
||||
|
|
@ -1434,6 +1465,11 @@ if (cliArguments.length === 1 && cliArguments[0] === '--self-test') {
|
|||
const options = parseArguments(cliArguments)
|
||||
const mode = options.mode
|
||||
if (!VALID_MODES.has(mode)) fail(`unknown_mode_${mode}`)
|
||||
const localCleartextOption = options['allow-local-cleartext']
|
||||
if (localCleartextOption !== undefined && (localCleartextOption !== 'true' || mode !== 'e2e')) {
|
||||
fail('allow_local_cleartext_only_valid_for_local_e2e')
|
||||
}
|
||||
const allowLocalCleartext = localCleartextOption === 'true'
|
||||
if (!options.apk) fail('apk_path_required')
|
||||
const apkPath = resolve(options.apk)
|
||||
if (!existsSync(apkPath)) fail(`apk_missing_${apkPath}`)
|
||||
|
|
@ -1462,6 +1498,7 @@ try {
|
|||
archive,
|
||||
mode,
|
||||
options['expected-admob-app-id'],
|
||||
allowLocalCleartext,
|
||||
)
|
||||
if (mode !== 'debug') {
|
||||
const expectedVersionName = options['expected-version-name']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue