[PR #4074] [MERGED] fix(adb): keep a bare numeric wm density as the physical density #6038

Closed
opened 2026-10-31 01:11:22 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4074
Author: @yankikucuk
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @morluto

Base: main ← Head: fix/adb-display-bare-density


📝 Commits (1)

  • 095317d fix(adb): keep a bare numeric wm density as the physical density

📊 Changes

3 files changed (+75 additions, -3 deletions)

View changed files

📝 src/adb/AdbProvider.test.ts (+20 -0)
📝 src/adb/AdbShellOutput.test.ts (+44 -1)
📝 src/adb/AdbShellOutput.ts (+11 -2)

📄 Description

Summary

Fixes #3942.

inspect_adb_display dropped the density when wm density printed a bare number, the form older Android builds use. The parser now reads that bare numeric line as the physical density; labeled physical and override declarations behave as before.

Problem and expected behavior

Trigger: adb shell wm density returning 420 on its own line. parseWmDensityOutput documented that older builds print a bare number but only matched Physical density: and Override density: lines, so the successful display Evidence carried physical_density: null and override_density: null with no limitation saying the declaration was unread.

Expected: for bare 420, physical_density: 420 and override_density: null alongside the declared physical size; the labeled and labeled-plus-override controls unchanged.

Change and scope

parseWmDensityOutput in src/adb/AdbShellOutput.ts owns this interpretation, so the bare form is read there: the first bare numeric line becomes the physical density when no labeled physical declaration is present, and a labeled declaration still wins so a mixed dump cannot downgrade the value. Override density, wm size parsing and the provider projection are unchanged. No contract or schema change.

Contribution scope: ordinary fix within an existing read-only boundary; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/adb/AdbShellOutput.ts, parseWmDensityOutput (capture or observation).
  • Contribution scope fit and linked maintainer decision: existing adb read operation; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change; physical_density is now populated for the bare output form instead of null.
  • Provider, bridge, target-format, or platform compatibility: adb only; the bare form is the older wm density output.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

  • Tests added or updated:

    • src/adb/AdbShellOutput.test.ts: parseWmDensityOutput cases for labeled physical and override lines, a bare number (LF and CRLF), a mixed dump where the labeled line wins, and unrecognized output.
    • src/adb/AdbProvider.test.ts: provider-level regression through inspect_adb_display with a stub adb printing 420.
    • On main two of these fail (reads a bare numeric density as the physical density, keeps a bare numeric wm density as the physical density); all pass with this change.
  • Base reproduction or other evidence (executed): the issue's three CLI controls with a stub adb under REA_ADB_PATH and an isolated HOME, through node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output:

    wm density output before (main) after
    420 physical_density: null physical_density: 420, override_density: null
    Physical density: 420 420 / null 420 / null
    Physical density: 420 + Override density: 480 420 / 480 420 / 480
  • User-visible CLI/MCP output: {"physical_density":420,"override_density":null} for the bare form.

  • Remaining proof gaps: no physical Android device was used; prevalence of the bare form on real devices is not measured.

Validation performed

  • npm run test:local -- src/adb/AdbShellOutput.test.ts src/adb/AdbProvider.test.ts — 2 files, 72 passed (2 failed on main before the parser change)
  • npm run build:cached — ok
  • Issue CLI reproduction, three controls — table above
  • npx tsc --noEmit — clean
  • npm run lint — 0 errors; verify:module-boundaries clean

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; stub adb on macOS arm64, Node 26.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none; read-only device query.

Author readiness

Human owner: @yankikucuk

  • 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/4074 **Author:** [@yankikucuk](https://github.com/yankikucuk) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/adb-display-bare-density` --- ### 📝 Commits (1) - [`095317d`](https://github.com/morluto/rea/commit/095317d7c4d3dba8ac99a2503fe4d938e4da701c) fix(adb): keep a bare numeric wm density as the physical density ### 📊 Changes **3 files changed** (+75 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/adb/AdbProvider.test.ts` (+20 -0) 📝 `src/adb/AdbShellOutput.test.ts` (+44 -1) 📝 `src/adb/AdbShellOutput.ts` (+11 -2) </details> ### 📄 Description ## Summary Fixes #3942. `inspect_adb_display` dropped the density when `wm density` printed a bare number, the form older Android builds use. The parser now reads that bare numeric line as the physical density; labeled physical and override declarations behave as before. ## Problem and expected behavior Trigger: `adb shell wm density` returning `420` on its own line. `parseWmDensityOutput` documented that older builds print a bare number but only matched `Physical density:` and `Override density:` lines, so the successful display Evidence carried `physical_density: null` and `override_density: null` with no limitation saying the declaration was unread. Expected: for bare `420`, `physical_density: 420` and `override_density: null` alongside the declared physical size; the labeled and labeled-plus-override controls unchanged. ## Change and scope `parseWmDensityOutput` in `src/adb/AdbShellOutput.ts` owns this interpretation, so the bare form is read there: the first bare numeric line becomes the physical density when no labeled physical declaration is present, and a labeled declaration still wins so a mixed dump cannot downgrade the value. Override density, `wm size` parsing and the provider projection are unchanged. No contract or schema change. Contribution scope: ordinary fix within an existing read-only boundary; maintainer scope decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/adb/AdbShellOutput.ts`, `parseWmDensityOutput` (capture or observation). - Contribution scope fit and linked maintainer decision: existing adb read operation; not applicable. - CLI and MCP/tool-catalog contract: no schema change; `physical_density` is now populated for the bare output form instead of null. - Provider, bridge, target-format, or platform compatibility: adb only; the bare form is the older `wm density` output. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. ## Evidence and regression coverage - Tests added or updated: - `src/adb/AdbShellOutput.test.ts`: `parseWmDensityOutput` cases for labeled physical and override lines, a bare number (LF and CRLF), a mixed dump where the labeled line wins, and unrecognized output. - `src/adb/AdbProvider.test.ts`: provider-level regression through `inspect_adb_display` with a stub adb printing `420`. - On main two of these fail (`reads a bare numeric density as the physical density`, `keeps a bare numeric wm density as the physical density`); all pass with this change. - Base reproduction or other evidence (executed): the issue's three CLI controls with a stub `adb` under `REA_ADB_PATH` and an isolated `HOME`, through `node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output`: | `wm density` output | before (main) | after | |---|---|---| | `420` | `physical_density: null` | `physical_density: 420, override_density: null` | | `Physical density: 420` | `420 / null` | `420 / null` | | `Physical density: 420` + `Override density: 480` | `420 / 480` | `420 / 480` | - User-visible CLI/MCP output: `{"physical_density":420,"override_density":null}` for the bare form. - Remaining proof gaps: no physical Android device was used; prevalence of the bare form on real devices is not measured. ## Validation performed - `npm run test:local -- src/adb/AdbShellOutput.test.ts src/adb/AdbProvider.test.ts` — 2 files, 72 passed (2 failed on main before the parser change) - `npm run build:cached` — ok - Issue CLI reproduction, three controls — table above - `npx tsc --noEmit` — clean - `npm run lint` — 0 errors; `verify:module-boundaries` clean ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; stub adb on macOS arm64, Node 26. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none; read-only device query. ## Author readiness Human owner: @yankikucuk - [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-10-31 01:11:22 +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#6038
No description provided.