[GH-ISSUE #3942] [Bug] Display inspection drops bare numeric adb density #1550

Closed
opened 2026-10-16 21:07:01 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @coygeek on GitHub (Oct 15, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/3942

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Process capture or runtime observation

Observed behavior

Observed through the CLI, the bare declaration returned exit code 0, ok: true, empty stderr, and this display projection:

{
  "physical_size": { "width": 1080, "height": 2340 },
  "override_size": null,
  "physical_density": null,
  "override_density": null
}

raw_result was null. The Evidence limitations mentioned unavailable artifact identity and the circumstances in which overrides are present, but gave no indication that the density declaration was unread. Both labeled controls exited 0 and retained the expected density values. This establishes the format-specific loss for the simulated provider, not its frequency on real devices.

Reproduction

Run from the baseline checkout with its installed dependencies and built runtime. The following creates an isolated home and executable adb fixture without contacting a device:

fixture=$(mktemp -d)
mkdir -p "$fixture/home"
export HOME="$fixture/home"
export XDG_CONFIG_HOME="$fixture/home/config"
export XDG_CACHE_HOME="$fixture/home/cache"
export REA_ADB_PATH="$fixture/adb"
cat > "$REA_ADB_PATH" <<'ADB'
#!/bin/sh
root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
if [ "$1" = version ]; then
  printf 'Android Debug Bridge version 1.0.41\nVersion 34.0.5-stub\nInstalled as %s\n' "$0"
  exit 0
fi
case "$*" in
  '-s emulator-5554 shell wm size') printf 'Physical size: 1080x2340\n'; exit 0 ;;
  '-s emulator-5554 shell wm density') cat "$root/density.txt"; exit 0 ;;
esac
exit 1
ADB
chmod +x "$REA_ADB_PATH"
printf '420\n' > "$fixture/density.txt"
node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output

Inspect data.normalized_result.physical_density, which is null. For controls, replace the fixture's density declaration and repeat the command:

printf 'Physical density: 420\n' > "$fixture/density.txt"
node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output
printf 'Physical density: 420\nOverride density: 480\n' > "$fixture/density.txt"
node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output

The labeled controls return physical density 420, with null override in the first control and override density 480 in the second.

Expected behavior

Display inspection promises to report the physical and overridden size and density as declared by the device. The density parser's documentation explicitly recognizes bare numeric output as an older-build format. For the bare 420 declaration, the successful result should retain physical_density: 420 and override_density: null, alongside the declared physical size.

Impact and scope

A supported declaration loses a useful display fact in successful Evidence. The observed failure is bounded to bare numeric density; labeled density, override density, and physical size controls work. The prevalence of this output form on real devices is unknown.

Workaround: Callers with the selected adb can read adb -s SERIAL shell wm density directly and retain its raw declaration. That bypass returned 420 with the simulated provider and does not require changing device state.

REA version

rea 6.5.0 at source commit 4692bb3330; current-main source checked at 22ec8bdb2f

Runtime and platform

Node 24.18.0; macOS arm64

Target and artifact context

Simulated adb selected by REA_ADB_PATH; wm size declares 1080x2340 and wm density declares bare 420. No Android device was used.

Interface

CLI

Earliest failure stage

Capture or observation

Relevant output or evidence

src/contracts/adb/adbToolContracts.ts:212-220 and docs/adb-device-analysis.md:84 promise declared size and density. src/adb/AdbShellOutput.ts:156-172 documents bare density but only matches labeled declarations. src/adb/AdbProvider.ts:1105-1142 copies those null density values into successful Evidence. Bare, labeled, and labeled-plus-override CLI cases were executed; only the bare form lost density.

Typed outcome or recovery expected

For bare 420, return physical_density 420 and override_density null while preserving size. Preserve the labeled and override controls.

Analysis or suspected cause

Source-derived: parseWmDensityOutput has no bare-number fallback. CLI and MCP share the service/provider, but MCP was not executed. Real-device frequency is unknown.

Additional context

The direct adb density read returned 420 with the same simulated provider. Generic limitations did not warn that the density declaration was unread.

Freshness check: the failing source is unchanged on current upstream main at 22ec8bdb2f. The only change among the cited files is unrelated CLI output-flag normalization. Runtime observations above are from the stated baseline; current-main persistence is source-derived.

Originally created by @coygeek on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/3942 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Process capture or runtime observation ### Observed behavior Observed through the CLI, the bare declaration returned exit code 0, `ok: true`, empty stderr, and this display projection: ```json { "physical_size": { "width": 1080, "height": 2340 }, "override_size": null, "physical_density": null, "override_density": null } ``` `raw_result` was null. The Evidence limitations mentioned unavailable artifact identity and the circumstances in which overrides are present, but gave no indication that the density declaration was unread. Both labeled controls exited 0 and retained the expected density values. This establishes the format-specific loss for the simulated provider, not its frequency on real devices. ### Reproduction Run from the baseline checkout with its installed dependencies and built runtime. The following creates an isolated home and executable adb fixture without contacting a device: ```sh fixture=$(mktemp -d) mkdir -p "$fixture/home" export HOME="$fixture/home" export XDG_CONFIG_HOME="$fixture/home/config" export XDG_CACHE_HOME="$fixture/home/cache" export REA_ADB_PATH="$fixture/adb" cat > "$REA_ADB_PATH" <<'ADB' #!/bin/sh root=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) if [ "$1" = version ]; then printf 'Android Debug Bridge version 1.0.41\nVersion 34.0.5-stub\nInstalled as %s\n' "$0" exit 0 fi case "$*" in '-s emulator-5554 shell wm size') printf 'Physical size: 1080x2340\n'; exit 0 ;; '-s emulator-5554 shell wm density') cat "$root/density.txt"; exit 0 ;; esac exit 1 ADB chmod +x "$REA_ADB_PATH" printf '420\n' > "$fixture/density.txt" node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output ``` Inspect `data.normalized_result.physical_density`, which is null. For controls, replace the fixture's density declaration and repeat the command: ```sh printf 'Physical density: 420\n' > "$fixture/density.txt" node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output printf 'Physical density: 420\nOverride density: 480\n' > "$fixture/density.txt" node scripts/rea.mjs inspect-adb-display emulator-5554 --format json --full-output ``` The labeled controls return physical density 420, with null override in the first control and override density 480 in the second. ### Expected behavior Display inspection promises to report the physical and overridden size and density as declared by the device. The density parser's documentation explicitly recognizes bare numeric output as an older-build format. For the bare `420` declaration, the successful result should retain `physical_density: 420` and `override_density: null`, alongside the declared physical size. ### Impact and scope A supported declaration loses a useful display fact in successful Evidence. The observed failure is bounded to bare numeric density; labeled density, override density, and physical size controls work. The prevalence of this output form on real devices is unknown. Workaround: Callers with the selected adb can read `adb -s SERIAL shell wm density` directly and retain its raw declaration. That bypass returned `420` with the simulated provider and does not require changing device state. ### REA version rea 6.5.0 at source commit 4692bb33300c7cb77b095b6cc0c33da861c1b860; current-main source checked at 22ec8bdb2f7d4626587f23b1eed4a207df600386 ### Runtime and platform Node 24.18.0; macOS arm64 ### Target and artifact context Simulated adb selected by REA_ADB_PATH; wm size declares 1080x2340 and wm density declares bare 420. No Android device was used. ### Interface CLI ### Earliest failure stage Capture or observation ### Relevant output or evidence `src/contracts/adb/adbToolContracts.ts:212-220` and `docs/adb-device-analysis.md:84` promise declared size and density. `src/adb/AdbShellOutput.ts:156-172` documents bare density but only matches labeled declarations. `src/adb/AdbProvider.ts:1105-1142` copies those null density values into successful Evidence. Bare, labeled, and labeled-plus-override CLI cases were executed; only the bare form lost density. ### Typed outcome or recovery expected For bare 420, return physical_density 420 and override_density null while preserving size. Preserve the labeled and override controls. ### Analysis or suspected cause Source-derived: `parseWmDensityOutput` has no bare-number fallback. CLI and MCP share the service/provider, but MCP was not executed. Real-device frequency is unknown. ### Additional context The direct adb density read returned 420 with the same simulated provider. Generic limitations did not warn that the density declaration was unread. Freshness check: the failing source is unchanged on current upstream main at 22ec8bdb2f7d4626587f23b1eed4a207df600386. The only change among the cited files is unrelated CLI output-flag normalization. Runtime observations above are from the stated baseline; current-main persistence is source-derived.
Author
Owner

@XinwangTao commented on GitHub (Oct 15, 2026):

Confirmed: a bare numeric 420 from wm density is a valid adb output form, and silently dropping it to null loses real display data. Since the labeled control parses fine, the parser should accept the bare numeric form as the density value — ideally normalized into the same physical_density field with a test covering both output shapes.

<!-- gh-comment-id:6186026691 --> @XinwangTao commented on GitHub (Oct 15, 2026): Confirmed: a bare numeric `420` from `wm density` is a valid adb output form, and silently dropping it to null loses real display data. Since the labeled control parses fine, the parser should accept the bare numeric form as the density value — ideally normalized into the same physical_density field with a test covering both output shapes.
Author
Owner

@yankikucuk commented on GitHub (Oct 15, 2026):

Working on this. Reproduced with the stub-adb CLI controls above: the bare 420 form returned physical_density: null while both labeled controls parsed. The fix reads a bare numeric line as the physical density when no labeled physical declaration is present (a labeled line still wins), with parser and provider-level regression tests covering both output shapes. Draft PR follows shortly.

<!-- gh-comment-id:6189475777 --> @yankikucuk commented on GitHub (Oct 15, 2026): Working on this. Reproduced with the stub-adb CLI controls above: the bare `420` form returned `physical_density: null` while both labeled controls parsed. The fix reads a bare numeric line as the physical density when no labeled physical declaration is present (a labeled line still wins), with parser and provider-level regression tests covering both output shapes. Draft PR follows shortly.
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#1550
No description provided.