[PR #2066] [CLOSED] test(adb): restore fixtures and the quoting regression after listing changes #5000

Closed
opened 2026-10-31 00:57:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2066
Author: @kaoru0822-kitauji
Created: 10/12/2026
Status: ❌ Closed

Base: main ← Head: fix/issue-2064


📝 Commits (1)

  • 627c268 test(adb): restore fixtures and the quoting regression after listing changes

📊 Changes

1 file changed (+9 additions, -7 deletions)

View changed files

📝 src/adb/AdbProvider.test.ts (+9 -7)

📄 Description

Fixes #2064

Problem

Since 3bdc8730b, three tests in src/adb/AdbProvider.test.ts fail on main, locally and in main CI. The tests are stale; there is no product regression.

  1. Fixtures. The commit made the shared shellStub escape backslashes before printf '%b', so fixtures carry exact bytes. The logcat and pm list fixtures still spelled line breaks as \\n and relied on %b to turn them into newlines. Their output collapsed into one line, so read_adb_logcat saw one line and resolve_adb_packages matched nothing.
  2. Quoting regression. list_adb_directory moved from ls <path> to a remote sh -c 'cd "$1" … find … -exec sh -c "$2" …' rea-list-directory <path> <script>. The test "quotes caller text before adb joins the remote shell command" still faked ls, which is never called. It observed nothing and no longer checked the property it is named for.

Change

  • The two fixtures now use real line breaks.
  • The quoting regression still models adb joining the remote command and the device shell parsing the joined string. It now records the arguments the device shell's sh receives (NUL-separated), and requires the caller path to arrive as exactly one argument after rea-list-directory. The injected touch still must not run.

Validation

  • src/adb/AdbProvider.test.ts: 45/45 pass. The three tests fail on the base commit.
  • Mutation check: removing quoteShellOperand from adbArguments makes the rewritten quoting test fail, so it again guards against command injection through device_path.
  • npm run lint passes.
  • npm test: 9,075 passed and 13 failed. The 13 are unrelated to this change:
    • 12 are environmental on this host (macOS, Command Line Tools only): nibNativeHierarchy, interfaceBuilderBundle, javascriptRuntimeObservation, javascriptRuntimeTargetLocations, nativeDmgArtifactReader.
    • cliOptionAliases also fails on main and is fixed by #2054.

No live Android device was used; this changes tests only.

🤖 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/2066 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-2064` --- ### 📝 Commits (1) - [`627c268`](https://github.com/morluto/rea/commit/627c2682f1c09eecdfc2cd167ced3e8a9db0a024) test(adb): restore fixtures and the quoting regression after listing changes ### 📊 Changes **1 file changed** (+9 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbProvider.test.ts` (+9 -7) </details> ### 📄 Description Fixes #2064 ## Problem Since 3bdc8730b, three tests in `src/adb/AdbProvider.test.ts` fail on main, locally and in main CI. The tests are stale; there is no product regression. 1. **Fixtures.** The commit made the shared `shellStub` escape backslashes before `printf '%b'`, so fixtures carry exact bytes. The logcat and `pm list` fixtures still spelled line breaks as `\\n` and relied on `%b` to turn them into newlines. Their output collapsed into one line, so `read_adb_logcat` saw one line and `resolve_adb_packages` matched nothing. 2. **Quoting regression.** `list_adb_directory` moved from `ls <path>` to a remote `sh -c 'cd "$1" … find … -exec sh -c "$2" …' rea-list-directory <path> <script>`. The test "quotes caller text before adb joins the remote shell command" still faked `ls`, which is never called. It observed nothing and no longer checked the property it is named for. ## Change - The two fixtures now use real line breaks. - The quoting regression still models adb joining the remote command and the device shell parsing the joined string. It now records the arguments the device shell's `sh` receives (NUL-separated), and requires the caller path to arrive as exactly one argument after `rea-list-directory`. The injected `touch` still must not run. ## Validation - `src/adb/AdbProvider.test.ts`: 45/45 pass. The three tests fail on the base commit. - Mutation check: removing `quoteShellOperand` from `adbArguments` makes the rewritten quoting test fail, so it again guards against command injection through `device_path`. - `npm run lint` passes. - `npm test`: 9,075 passed and 13 failed. The 13 are unrelated to this change: - 12 are environmental on this host (macOS, Command Line Tools only): `nibNativeHierarchy`, `interfaceBuilderBundle`, `javascriptRuntimeObservation`, `javascriptRuntimeTargetLocations`, `nativeDmgArtifactReader`. - `cliOptionAliases` also fails on main and is fixed by #2054. No live Android device was used; this changes tests only. 🤖 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-31 00:57:50 +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#5000
No description provided.