[PR #1156] [MERGED] fix(cli): cancel routed JavaScript analysis in rea analyze #2691

Closed
opened 2026-10-17 21:09:08 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1156
Author: @kaoru0822-kitauji
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @morluto

Base: main ← Head: fix/cli-analyze-javascript-cancellation


📝 Commits (1)

  • 51fe12f fix(cli): cancel routed JavaScript analysis in rea analyze

📊 Changes

2 files changed (+47 additions, -43 deletions)

View changed files

📝 src/cli/coreBinaryCommands.ts (+39 -39)
📝 tests/acceptance/applications/javascriptCancellationCli.test.ts (+8 -4)

📄 Description

Problem

rea analyze PATH routes a JavaScript directory or .asar (with no --provider, --snapshot or --target-format) to the same static analysis as rea analyze-javascript-application. That route passed no AbortSignal and was not wrapped in withCommandCancellation. The #1098 review raised this ("Propagate cancellation through the routed analyze command"), and it was still unaddressed on main.

I reproduced it by sending SIGINT at the first rea_progress line, the same scenario as javascriptCancellationCli.test.ts:

Command Exit stdout
rea analyze-javascript-application <dir> --json code 130 typed {"code":"cancelled",…}
rea analyze <dir> --json (before) killed by SIGINT empty
rea analyze <dir> --json (after) code 130 typed {"code":"cancelled",…}

Change

  • The analyze command now picks its route before running. The routing condition is unchanged, moved into routesToJavaScriptAnalysis.
  • A JavaScript target runs exactly like the dedicated command: withCommandCancellation wraps logCliCommand, so the cancelled exit code 130 is not replaced by the logged failure status of 1, which would happen if the wrapping were reversed.
  • The binary route is unchanged and keeps the SIGINT handling inside runDirectAnalysis.

Verification

  • tests/acceptance/applications/javascriptCancellationCli.test.ts now runs the SIGINT case through both analyze-javascript-application and analyze. The analyze case fails on main.
  • All 13 test files that reference the analyze command, coreBinaryCommands or analyze-javascript-application: 72 passed.
  • npm run check:fast
  • Manually, rea analyze <js-dir> without SIGINT still returns the analysis Evidence, and rea analyze /bin/ls still takes the provider route.

No real Hopper or Ghidra verification was run. The binary route those providers use is unchanged.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1156 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/cli-analyze-javascript-cancellation` --- ### 📝 Commits (1) - [`51fe12f`](https://github.com/morluto/rea/commit/51fe12f86fec4072b79deaa850d004f2051d77a9) fix(cli): cancel routed JavaScript analysis in rea analyze ### 📊 Changes **2 files changed** (+47 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `src/cli/coreBinaryCommands.ts` (+39 -39) 📝 `tests/acceptance/applications/javascriptCancellationCli.test.ts` (+8 -4) </details> ### 📄 Description ## Problem `rea analyze PATH` routes a JavaScript directory or `.asar` (with no `--provider`, `--snapshot` or `--target-format`) to the same static analysis as `rea analyze-javascript-application`. That route passed no `AbortSignal` and was not wrapped in `withCommandCancellation`. The #1098 review raised this ("Propagate cancellation through the routed analyze command"), and it was still unaddressed on `main`. I reproduced it by sending SIGINT at the first `rea_progress` line, the same scenario as `javascriptCancellationCli.test.ts`: | Command | Exit | stdout | |---|---|---| | `rea analyze-javascript-application <dir> --json` | code 130 | typed `{"code":"cancelled",…}` | | `rea analyze <dir> --json` (before) | killed by `SIGINT` | empty | | `rea analyze <dir> --json` (after) | code 130 | typed `{"code":"cancelled",…}` | ## Change - The `analyze` command now picks its route before running. The routing condition is unchanged, moved into `routesToJavaScriptAnalysis`. - A JavaScript target runs exactly like the dedicated command: `withCommandCancellation` wraps `logCliCommand`, so the cancelled exit code 130 is not replaced by the logged failure status of 1, which would happen if the wrapping were reversed. - The binary route is unchanged and keeps the SIGINT handling inside `runDirectAnalysis`. ## Verification - `tests/acceptance/applications/javascriptCancellationCli.test.ts` now runs the SIGINT case through both `analyze-javascript-application` and `analyze`. The `analyze` case fails on `main`. - All 13 test files that reference the `analyze` command, `coreBinaryCommands` or `analyze-javascript-application`: 72 passed. - `npm run check:fast` - Manually, `rea analyze <js-dir>` without SIGINT still returns the analysis Evidence, and `rea analyze /bin/ls` still takes the provider route. No real Hopper or Ghidra verification was run. The binary route those providers use is unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:08 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2691
No description provided.