[PR #5001] [MERGED] fix(adb): improve shell output parsing accuracy #6721

Closed
opened 2026-11-01 21:42:34 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5001
Author: @yash27git
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @morluto

Base: main ← Head: adb/Shell


📝 Commits (1)

  • 9f00fcf fix(adb): improve shell output parsing accuracy

📊 Changes

2 files changed (+119 additions, -6 deletions)

View changed files

📝 src/adb/AdbShellOutput.test.ts (+88 -0)
📝 src/adb/AdbShellOutput.ts (+31 -6)

📄 Description

Summary

This PR fixes two parsing accuracy issues in ADB shell output handling.

Problem and expected behavior

Two parser issues could produce inaccurate Android device observations:

  • parseAmStartOutput could report an app launch as successful when the output contained an unprefixed Java exception, including exceptions without a message. Generic error headers could also obscure a more specific Java exception.
  • parseDumpsysPackageOutput could count permissions from the separate Hidden system packages: section and reject valid permission names containing hyphens (-) or dollar signs ($).

The expected behavior is to report failed launches correctly, retain the most specific available error reason, and count only permissions belonging to the requested package.

Change and scope

  • Detects qualified Java exception and error types, including message-free exceptions and base types.
  • Prioritizes specific Java throwables over generic Activity Manager error headers.
  • Stops permission counting at the Hidden system packages: section.
  • Supports permission names containing hyphens and dollar signs.
  • Adds regression tests for the affected cases.

This is a focused fix within the existing ADB output parsers. It introduces no new providers, capabilities, target-execution behavior, or recovery mechanisms.

Contract and boundary impact

  • Semantic owner and earliest changed stage: ADB adapter output parsing in src/adb/AdbShellOutput.ts.
  • Contribution scope fit and linked maintainer decision: Existing parser correction; a new-capability maintainer scope decision is not applicable.
  • CLI and MCP/tool-catalog contract: No command, argument, schema, or tool-catalog changes.
  • Provider, bridge, target-format, or platform compatibility: Improves parsing of existing Android ADB command output without changing the commands issued.
  • Evidence, artifact, provenance, or reconstruction contract: No artifact format or provenance contract changes. Regression tests use deterministic output fixtures.
  • Target selection, authority, upstream behavior, and cleanup details: No changes to target selection, execution authority, or cleanup behavior.
  • Generated metadata, package, or installation impact: None intended.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: Regression cases cover hidden system packages, permission names containing - and $, unprefixed Java exceptions, message-free exceptions, base exception types, and specific-error prioritization.
  • Base reproduction or other evidence: The tests reproduce the relevant output patterns with deterministic fixtures.
  • User-visible CLI/MCP output: No CLI or MCP schema changes are intended. The internal launch verdict and failure reason become more accurate.
  • Remaining proof gaps: Verified with deterministic unit test fixtures; live real-device adb capture was not executed as part of this parser-only change.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • Focused parser tests: Passed all tests in AdbShellOutput test suite on the final revision (5a2178c).
  • TypeScript type checking & formatting: Passed npm run check:fast with zero diagnostics on the final revision.
  • Diff hygiene: Passed git diff --check with no whitespace or formatting issues.

Compatibility, safety, and release

  • Breaking changes or migration steps: None intended.
  • Real Hopper/Ghidra, browser, or OS coverage: Not applicable to this parser-only change.
  • Package or release metadata impact: None intended.
  • Security, privacy, process, or containment review: No new target execution, injection, mutation, or recovery functionality is introduced.

Author readiness

Human owner: @yash27git

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/5001 **Author:** [@yash27git](https://github.com/yash27git) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `adb/Shell` --- ### 📝 Commits (1) - [`9f00fcf`](https://github.com/morluto/rea/commit/9f00fcf9904df14faf666d4098b57f2437913a8c) fix(adb): improve shell output parsing accuracy ### 📊 Changes **2 files changed** (+119 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbShellOutput.test.ts` (+88 -0) 📝 `src/adb/AdbShellOutput.ts` (+31 -6) </details> ### 📄 Description ## Summary This PR fixes two parsing accuracy issues in ADB shell output handling. ## Problem and expected behavior Two parser issues could produce inaccurate Android device observations: - `parseAmStartOutput` could report an app launch as successful when the output contained an unprefixed Java exception, including exceptions without a message. Generic error headers could also obscure a more specific Java exception. - `parseDumpsysPackageOutput` could count permissions from the separate `Hidden system packages:` section and reject valid permission names containing hyphens (`-`) or dollar signs (`$`). The expected behavior is to report failed launches correctly, retain the most specific available error reason, and count only permissions belonging to the requested package. ## Change and scope - Detects qualified Java exception and error types, including message-free exceptions and base types. - Prioritizes specific Java throwables over generic Activity Manager error headers. - Stops permission counting at the `Hidden system packages:` section. - Supports permission names containing hyphens and dollar signs. - Adds regression tests for the affected cases. This is a focused fix within the existing ADB output parsers. It introduces no new providers, capabilities, target-execution behavior, or recovery mechanisms. ## Contract and boundary impact - Semantic owner and earliest changed stage: ADB adapter output parsing in `src/adb/AdbShellOutput.ts`. - Contribution scope fit and linked maintainer decision: Existing parser correction; a new-capability maintainer scope decision is not applicable. - CLI and MCP/tool-catalog contract: No command, argument, schema, or tool-catalog changes. - Provider, bridge, target-format, or platform compatibility: Improves parsing of existing Android ADB command output without changing the commands issued. - Evidence, artifact, provenance, or reconstruction contract: No artifact format or provenance contract changes. Regression tests use deterministic output fixtures. - Target selection, authority, upstream behavior, and cleanup details: No changes to target selection, execution authority, or cleanup behavior. - Generated metadata, package, or installation impact: None intended. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: Regression cases cover hidden system packages, permission names containing `-` and `$`, unprefixed Java exceptions, message-free exceptions, base exception types, and specific-error prioritization. - Base reproduction or other evidence: The tests reproduce the relevant output patterns with deterministic fixtures. - User-visible CLI/MCP output: No CLI or MCP schema changes are intended. The internal launch verdict and failure reason become more accurate. - Remaining proof gaps: Verified with deterministic unit test fixtures; live real-device `adb` capture was not executed as part of this parser-only change. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - Focused parser tests: Passed all tests in `AdbShellOutput` test suite on the final revision (`5a2178c`). - TypeScript type checking & formatting: Passed `npm run check:fast` with zero diagnostics on the final revision. - Diff hygiene: Passed `git diff --check` with no whitespace or formatting issues. ## Compatibility, safety, and release - Breaking changes or migration steps: None intended. - Real Hopper/Ghidra, browser, or OS coverage: Not applicable to this parser-only change. - Package or release metadata impact: None intended. - Security, privacy, process, or containment review: No new target execution, injection, mutation, or recovery functionality is introduced. ## Author readiness Human owner: @yash27git - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:42:34 +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#6721
No description provided.