rea/tests/boundary/cli
morluto 7369b5ee63
fix(ida): retain cleanup facts and let one-shot commands exit (#2814)
* fix(ida): let one-shot commands exit after retaining cleanup

When a headless IDA request outlives timeoutMs (for example idb_open on
a large binary still running auto-analysis), REA cannot prove the
worker stopped and correctly retains the upstream connection and
private workspace. The retained stdio child and its pipes stayed
referenced, so a one-shot CLI printed its cleanup_incomplete result and
then never exited, keeping the supervisor, worker and database alive.

Detach the retained connection's child process and pipes from the event
loop when cleanup fails. A long-lived MCP server can still retry
through the retained connection; a one-shot CLI exits with status 1,
and the supervisor observes end of input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): report an unverified upstream worker after failed cleanup

Upstream ida-pro-mcp spawns headless workers in their own session and
deliberately leaves them running when its supervisor exits, so neither
a retained connection nor REA exiting proves that a timed-out worker
stopped. When cleanup fails before the owned worker's release is
confirmed, the cleanup diagnostics now name its private session and
state that it may still be running until it finishes and reaches its
idle timeout. Failures after a confirmed release, or before any open
was attempted, do not report a worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): name the inventory sessions that block worker release

When idb_close confirmed the requested worker gone but the follow-up
inventory still found a different peer on the private input, the
upstream_worker diagnostic named the released session and could
misdirect manual cleanup. Record the session ids of the inventory
entries that actually blocked release and report those; fall back to
the requested private session only when no inventory evidence exists
(an incomplete open or an unanswered request). The field becomes
session_ids, since more than one entry can block release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): keep blocker evidence and backend in cleanup diagnostics

The release diagnostic reset its observed blockers on every close, so a
retry whose inventory was unavailable fell back to the already-released
session; and it kept only session ids, describing a blocking GUI
session with detached-worker guidance.

Blocker evidence is now replaced only by a successful inventory, and
the diagnostic becomes upstream_sessions with each session's id and
backend, with guidance that distinguishes workers from GUI sessions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): stop naming a worker after its close was confirmed

When idb_close confirmed the requested worker's release but the
following inventory failed, no blocker evidence existed yet and the
diagnostic fell back to the confirmed-absent worker. After a confirmed
close the diagnostic now reports an empty session list, meaning any
remaining same-input sessions are unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ida): group cleanup diagnostic cases in their own suite

The added cases pushed the reaped-worker describe block past the
150-line limit enforced by lint:built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): keep ownership and pre-close peers in cleanup diagnostics

Blocking sessions dropped the parsed ownership fact, so an external
unowned worker looked the same as REA's own; and recovery inventory
recorded same-input peers only when the requested worker was missing,
so a peer seen beside it was lost if the following close failed.

Each reported session now carries owned (null when no inventory has
reported it), and recovery records every same-input session until a
later successful inventory replaces that evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): drop a confirmed worker from retained cleanup blockers

Recovery inventory now records the requested worker beside any peers,
so once idb_close confirmed its release a failing follow-up inventory
still reported it as unreleased. Remove the confirmed session from the
retained blockers at close confirmation and keep the remaining peers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ida): retry cleanup through a detached stdio connection

The retry coverage used a recording connection whose detach() only
counts calls, so it could not show that detaching keeps a retained
connection usable. Run a real stdio supervisor in a long-lived host,
fail the first post-close inventory, and require the retry through the
same detached connection to confirm release and remove the workspace.
The test fails if detach() destroys the pipes instead of unref-ing them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): close the stdio supervisor in failed retry tests

Merge main and give its new IdaNativeProtocol connection double the
required detach() method. The real-stdio retry test now closes its
connection in an unconditional teardown, so a failing assertion cannot
leave the supervisor waiting on stdin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ida): share the cleanup diagnostic expectation in session tests

Repeated upstream_sessions assertions and the unrelated live peer
literal pushed repository duplication over the jscpd threshold. Build
the expected diagnostic with one helper and reuse one peer constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(ida): distinguish observed ownership from unreported input bindings

* fix(ida): keep requested-ID conflicts in recovery cleanup

Recovery inventory kept only same-input entries, unlike the startup and
post-close filters. After an explicitly rejected open, an entry under
the requested session ID on another input was dropped, so cleanup could
close the connection, remove the private workspace and report success
while that session stayed registered. Match the requested ID as well so
the entry is retained as a blocker and cleanup stays incomplete.

Also split the cleanup diagnostics suite under the lint:built function
length limit, and make two startup-inventory fixtures pass a defined
session id so the test file typechecks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ida): preserve retained session inventory facts

---------

Co-authored-by: Xingchuan Ma <xingchuan.ma@msn.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
2026-10-13 22:27:26 +08:00
..
adbCli.test.ts fix(adb): preserve device paths and prevent destination collisions 2026-10-12 05:57:35 +08:00
analysisSelectorCli.test.ts fix(ghidra): resolve file offsets in decompile (#2101) 2026-10-13 18:23:17 +08:00
analysisViewCli.test.ts feat(analysis): add opt-in retained inventory and WASM views (#2122) 2026-10-12 21:17:52 +08:00
androidCliCancellation.test.ts feat(android): integrate static APK analysis with headless JADX (#738) 2026-10-06 12:46:48 +00:00
apktoolBooleanOptions.test.ts fix(apktool): accept --no-strings CLI option (#2707) 2026-10-13 16:20:03 +08:00
apktoolCli.test.ts test(cli): consolidate schema coverage and assert input refusals 2026-10-12 05:24:33 +08:00
browserCli.test.ts fix(cli): retain correction details across adjacent browser commands (#2294) 2026-10-13 02:55:59 +08:00
browserCompareJsonFiles.test.ts fix(browser): bound screenshot comparison memory 2026-10-11 11:11:38 +08:00
browserInputDiagnostics.test.ts fix(cli): retain correction details across adjacent browser commands (#2294) 2026-10-13 02:55:59 +08:00
browserRedirectShapeCompleteness.test.ts fix(cli): accept JSON files for web capture and screenshot comparisons (#1397) 2026-10-09 19:29:42 -07:00
captureCleanup.test.ts fix(artifacts): retain read cleanup ownership through CLI and MCP shutdown 2026-10-13 16:08:41 +08:00
cliCompileCache.test.ts test(cli): cache subprocess compilation within each worker 2026-10-11 18:01:32 +08:00
cliInputSchemaRequired.test.ts fix(cli): reuse firmware and web module input constraints 2026-10-12 12:37:00 +08:00
cliLogLevelConfiguration.test.ts fix(cli): report an invalid REA_LOG_LEVEL as configuration (#2140) 2026-10-12 06:07:37 -07:00
cliOptionAliases.test.ts fix(cli): preserve native option descriptions in help 2026-10-11 06:41:46 +08:00
cliOutput.test.ts fix(cli): reject unterminated output filter slices (#2315) 2026-10-13 20:04:33 +08:00
cliServeHarness.ts fix(adb): share host configuration refusals with apktool (#1954) 2026-10-12 05:09:13 +08:00
cliSetup.test.ts fix(setup): honor config roots and display terminal dry-run plans 2026-10-13 03:22:53 +08:00
cliStartupImports.test.ts perf(cli): bundle runtime entries to reduce Windows startup I/O (#1996) 2026-10-12 09:25:27 +08:00
cliToolCoverage.test.ts refactor(catalog): import CLI metadata from its owner 2026-10-10 00:49:14 +08:00
clientProfileLifecycle.test.ts fix(setup): name each skill directory in the uninstall summary (#2118) 2026-10-12 04:55:15 -07:00
clientProfiles.test.ts perf(tests): reuse stateless workflows and immutable fixtures 2026-10-11 13:20:15 +08:00
developmentTests.test.ts test(cli): consolidate development runner workflow coverage 2026-10-13 13:12:17 +08:00
dispatcher.test.ts fix(cli): preserve failure semantics across full-output formats 2026-10-13 03:33:27 +08:00
dylibResolutionCli.test.ts feat(ghidra): support raw NMOS 6502 analysis (#2079) 2026-10-13 21:13:01 +08:00
electronCli.test.ts refactor!: enforce canonical evidence and provider boundaries 2026-10-09 20:18:52 +08:00
electronWrappedCallPaths.test.ts fix(javascript): trace nested Electron bridge members (#2745) 2026-10-13 22:16:44 +08:00
evidenceBundleCommands.test.ts fix(io): retain cleanup ownership and honor cancellation 2026-10-12 14:12:44 +08:00
flutterCli.test.ts feat(flutter): identify Dart snapshot builds and inspect AOT payloads by pure APK parsing (#1582) 2026-10-12 22:35:55 +08:00
fridaCli.test.ts fix(frida): name the argument each Frida input error rejects (#2217) 2026-10-12 23:00:59 +08:00
hopperLaunchFailureCli.test.ts fix(hopper): wait for late bridges during cleanup (#1866) 2026-10-11 22:50:27 +08:00
httpCaptureComparison.test.ts test(web): cover nullable HTTP captures through CDP and CLI (#1834) 2026-10-13 21:44:08 +08:00
idaRetainedCleanupCli.test.ts fix(ida): retain cleanup facts and let one-shot commands exit (#2814) 2026-10-13 22:27:26 +08:00
javascriptApplicationJsonOutput.test.ts fix(javascript): trace wrapped Electron IPC paths in large bundles (#1874) 2026-10-12 09:28:59 +08:00
javascriptApplicationProgress.test.ts fix(artifacts)!: retain cleanup owners through client shutdown 2026-10-11 04:43:02 +08:00
javascriptArtifactBomRanges.test.ts fix(javascript): preserve original BOM source coordinates (#1093) 2026-10-09 00:09:55 +08:00
javascriptArtifactTypeScriptDialect.test.ts perf(tests): consolidate TypeScript dialect producer checks 2026-10-11 13:29:50 +08:00
javascriptBundlerRuntimeScopes.test.ts fix(javascript): retain runtime scope in bundled module relationships 2026-10-11 01:36:12 +08:00
javascriptBundlerSelfReferences.test.ts fix(javascript): omit self-referential static references with disclosure (#1157) 2026-10-09 10:01:59 +08:00
javascriptIntegrityPolicyCli.test.ts feat(javascript): record Electron integrity mismatches 2026-10-10 02:49:46 +08:00
javascriptRuntimeObservationCli.test.ts refactor(javascript): group domain semantics and contracts (#907) 2026-10-07 17:16:58 +08:00
javascriptSelfImportRelationships.test.ts fix(javascript): keep TypeScript substitution out of runtime paths 2026-10-12 01:41:23 +08:00
jebCli.test.ts fix(jeb): confine an invalid REA_JEB_MCP_URL to the JEB tools (#2145) 2026-10-12 06:49:15 -07:00
jsonInputSize.test.ts perf(evidence): fuse streamed JSON token handling (#1694) 2026-10-11 12:36:35 +08:00
jsonInputStatus.test.ts fix(cli): classify JSON input permission denials 2026-10-10 03:52:35 +08:00
jsonOutput.test.ts fix(cli)!: keep a selected JSON null in --filter-output output (#2333) 2026-10-13 20:43:20 +08:00
keyedArchivePrototypeKeyCli.test.ts fix(plist): decode formatted XML dictionary keys 2026-10-12 05:57:34 +08:00
keyedArchiveXmlNestingCli.test.ts fix(apple): preflight XML plist nesting before keyed archive decoding (#2161) 2026-10-12 23:12:10 +08:00
mcpDoctorHelpCli.test.ts refactor!: enforce canonical evidence and provider boundaries 2026-10-09 20:18:52 +08:00
nativeDemangleCli.test.ts test: strengthen public input and module lookup controls 2026-10-12 11:59:23 +08:00
nativeEfficiencyComparison.test.ts test(native): verify real PE and DOS entry views 2026-10-13 00:04:00 +08:00
nativeMachoEchoedPathCli.test.ts fix(native): keep lipo path echoes out of FAT records (#2605) 2026-10-13 21:16:49 +08:00
nativePlistCli.test.ts refactor: consolidate boundary semantics and prune redundant tests 2026-10-10 05:56:01 +08:00
nativePlistPrototypeKeyCli.test.ts fix(plist): read XML plists containing a __proto__ key 2026-10-06 23:58:59 -07:00
nativePlistSelectionFailureCli.test.ts fix(native): name the CLI flag that selects another plist 2026-10-09 09:32:24 +00:00
nativeSignatureCli.test.ts fix(native): preserve literal line breaks in signing identifiers (#2107) 2026-10-13 18:22:34 +08:00
nativeUiScenarioInputCli.test.ts fix(cli): refuse scenario steps on passive native UI observation (#2712) 2026-10-13 06:59:33 -07:00
packageRunnerRegistration.test.ts fix(setup): register a stable launcher when run through bunx (#1731) 2026-10-11 19:17:15 +08:00
pcapCli.test.ts fix(pcap): name the host tool to configure in capability refusals (#2507) 2026-10-13 13:29:09 +08:00
projectedErrorStatus.test.ts refactor!: simplify runtime tools and remove replay engines (#572) 2026-10-05 21:15:04 +08:00
rawBinaryCli.test.ts feat(ghidra): support raw NMOS 6502 analysis (#2079) 2026-10-13 21:13:01 +08:00
reconstructionObligationLedgerCli.test.ts refactor(mcp): simplify evidence and workflows 2026-09-29 13:58:26 +08:00
referenceSourceDirectoryImports.test.ts fix(reference): preserve directory intent when resolving source imports (#2770) 2026-10-13 20:06:19 +08:00
referenceSourceExclusions.test.ts fix(reference)!: preserve exclusion rule provenance 2026-10-11 04:15:26 +08:00
referenceSourceImportStatus.test.ts test(cli): align reference import failure envelopes 2026-10-13 04:24:34 +08:00
referenceSourceLegacyFacts.test.ts fix(reference): report sloppy scripts, PHP, C# and enclosing Git facts (#1770) 2026-10-13 05:52:27 +09:00
referenceSourceUtf8.test.ts fix(reference): report malformed UTF-8 before import parsing 2026-10-10 01:45:00 +08:00
scenarioCliInputDiagnostics.test.ts fix(electron): identify each unresolved scenario path (#2279) 2026-10-13 21:15:33 +08:00
signalCleanup.test.ts feat(signals): discover installed decoders and option help (#2487) 2026-10-13 15:58:19 +09:00
skillSync.test.ts fix(cli): disable unmanaged skill synchronization 2026-10-05 23:27:46 -07:00
webScriptSelectionCli.test.ts fix(files): reject nonregular capture and JSON inputs 2026-10-10 01:49:54 +08:00
workflowInputIdentities.test.ts fix(mcp): preserve JavaScript workflow identity validation (#1366) 2026-10-10 05:11:38 +08:00