Repository navigation
fix(cli): route app bundles with trailing separators to native analysis - #3511
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
9cd1465 to
b5dbc93
Compare
baron
left a comment
There was a problem hiding this comment.
Reviewed unchanged head b5dbc93 and the routing producer/consumers. The extension-only spelling normalization preserves the original selected path passed downstream, avoids unsafe parent/symlink resolution, and leaves explicit provider and binary options authoritative. No source/design blocker found. Independently ran the compiled public CLI regression: 4/4 pass on pinned Node 24.18.0 (matching lockfile dependencies, isolated checkout; runtime build reused). Current repository CI is green, including CI required SUCCESS, with only unrelated conditional lanes skipped. Real native engines were not exercised; this change routes before provider startup.
Summary
analyze sample.app/andanalyze sample.app/.ran static JavaScript application analysis on a native macOS app bundle instead of native analysis. The routing check inisJavaScriptApplicationPathtestedpath.toLowerCase().endsWith(".app")on the raw argument, so a trailing/(what shell completion gives you) or/.missed it and fell through to the "any directory is a JavaScript app" branch. The command then exited 0 with ananalyze_javascript_applicationresult over zero source files.Fixes #3321
Problem and expected behavior
Smallest trigger: a
Sample.appbundle withContents/Info.plistand a Mach-OContents/MacOS/Sample,REA_ANALYSIS_PROVIDER=missing-provider.analyze Sample.appexits 1 withcapability_unavailablefrom native provider selection;analyze Sample.app/andanalyze Sample.app/.exit 0 with JavaScript application Evidence. Expected: all spellings of the same bundle take the native path (docs/cli.md: directly supplied.appbundles get the native overview).Change and scope
src/cli/coreBinaryCommands.ts: the.appcheck now ignores trailing/and/.segments before matching the extension. Everything downstream already handled those spellings: forcing the native route with--providergave the same result for all three on the base revision..appcheck changes..asarmatching and the directory fallback are as before, so JavaScript directories with or without a trailing slash still route to JavaScript analysis...segments.Sample.app/x/..is left alone on purpose; resolving it lexically could pick a different bundle whenxis a symlink.Contribution scope: ordinary fix within existing boundaries; no scope decision needed.
Contract and boundary impact
isJavaScriptApplicationPathinsrc/cli/coreBinaryCommands.ts, whenanalyzepicks its workflow.analyze <bundle>.app/now returns native analysis results (or native provider errors) instead of JavaScript application Evidence. MCP is not affected; this routing is CLI-only.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/cli/analyzeAppBundlePathCli.test.tsrunsanalyzeonSample.app,Sample.app/,Sample.app/.andSample.app//with an unknown standing provider and expectscapability_unavailablefromopen_binarywithselection_reason: unknown_providerfor each.expected +0 to be 1(exit 0 on the JavaScript route); the plain spelling passes.REA_ANALYSIS_PROVIDER=missing-provider analyze <path> --json, fixture from the issue, plus a plainjsapp/index.jsdirectory as a control):For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/cli/analyzeAppBundlePathCli.test.ts: 4 passed (3 fail on the base revision)npm run test:focusedon the 9 CLI boundary test files that runanalyze(grep -l '"analyze"' tests/boundary/cli/*.test.ts): 58 passed, 1 skippednpm run check:fast: typecheck and lint passednpm run build:cachedon base and on this branchCompatibility, safety, and release
analyze X.app/producing JavaScript Evidence now get native analysis;analyze-javascript-application(or passing the bundle's JavaScript directory) still selects JavaScript analysis explicitly.Author readiness
Human owner: @Sriram-PR
Before merge
type(scope): outcome.