From aa062c9fd0c5e4962bd078b8106bcc58c0d72482 Mon Sep 17 00:00:00 2001 From: jjbrunton Date: Mon, 31 Aug 2026 11:09:38 +0100 Subject: [PATCH] fix(mobile): make ota-publish actually run under a path with spaces The entrypoint guard compared process.argv[1] against new URL(import.meta.url).pathname. A URL pathname percent-encodes spaces, so in any checkout whose absolute path contains one the comparison never matched and main() never ran. Every ota:preflight:*, ota:publish:*, and ota:doctor:* script then exited 0 having done absolutely nothing, which is indistinguishable from success. A publish that silently no-ops is worse than one that fails: it reports a shipped update that never left the machine. Compare resolved filesystem paths instead. Verified from a checkout whose path contains a space: before the change `node scripts/ota-publish.mjs production --preflight` exited 0 with no output; after it runs a real export for both platforms and prints the preflight confirmation. Argument validation still rejects unknown targets and unsupported EOAS arguments. Co-Authored-By: Claude Opus 5 --- apps/mobile/scripts/ota-publish.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/mobile/scripts/ota-publish.mjs b/apps/mobile/scripts/ota-publish.mjs index 0245e39..b2817b8 100644 --- a/apps/mobile/scripts/ota-publish.mjs +++ b/apps/mobile/scripts/ota-publish.mjs @@ -3,6 +3,7 @@ import { mkdtempSync, readFileSync, rmSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; import { spawnSync } from 'node:child_process'; const projectDir = resolve(import.meta.dirname, '..'); @@ -140,4 +141,8 @@ export function main(args = process.argv.slice(2), environment = process.env) { run('npx', ['eoas', 'publish', '--branch', branch, ...parsePublishArgs(rawPublishArgs)], exportEnv); } -if (process.argv[1] === new URL(import.meta.url).pathname) main(); +// Compare real filesystem paths. A URL pathname percent-encodes spaces, so +// comparing it to process.argv[1] silently skips main() under any checkout +// whose absolute path contains a space, and every ota:* script then exits 0 +// having done nothing. +if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) main();