[GH-ISSUE #7423] [Bug] inspect-asset-catalog misclassifies assetutil's tab-indented invalid-catalog rejection #4429

Closed
opened 2026-10-31 00:49:44 +00:00 by bsakaguchi · 0 comments
Owner

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

Before submitting

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

Area

Evidence, artifacts, or reconstruction

Observed behavior

On macOS, node scripts/rea.mjs inspect-asset-catalog "$WORK/Demo.app" --json returns unreadable_output and recommends rea doctor for a readable malformed Assets.car. Captured stderr already declares that the exact selected catalog is not a valid AssetCatalog, with a tab before its path. The documented invalid-artifact classification is lost.

Reproduction

Use a source checkout at the commit below, Node 24.22.1, and macOS with system assetutil. Fresh-checkout setup is npm ci && npm run build:cached; verification reused installed locked dependencies and rebuilt successfully. Set WORK to an empty disposable directory outside the checkout, then run from the checkout root:

mkdir -p "$WORK/Demo.app" "$WORK/home" "$WORK/cfg" "$WORK/data" "$WORK/cache" "$WORK/state" "$WORK/tmp"
printf '%s\n' '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>CFBundleIdentifier</key><string>com.example.demo</string></dict></plist>' > "$WORK/Demo.app/Info.plist"
printf 'not a catalog\n' > "$WORK/Demo.app/Assets.car"
export HOME="$WORK/home" XDG_CONFIG_HOME="$WORK/cfg" XDG_DATA_HOME="$WORK/data" XDG_CACHE_HOME="$WORK/cache" XDG_STATE_HOME="$WORK/state" TMPDIR="$WORK/tmp"
node scripts/rea.mjs inspect-asset-catalog "$WORK/Demo.app" --json
printf 'REA exit=%s\n' "$?"
/usr/bin/assetutil --info "$WORK/Demo.app/Assets.car" > "$WORK/assetutil.out" 2> "$WORK/assetutil.err"
printf 'assetutil exit=%s\n' "$?"
sed -n l "$WORK/assetutil.err"

The CLI and direct producer each failed as described in two independent fixture runs. A separate otherwise identical bundle without Assets.car exited 0 with an empty catalog inventory.

Expected behavior

docs/native-investigation.md:599–604 promises an invalid-artifact failure for a complete normal assetutil exit declaring the exact catalog path is not a valid AssetCatalog. Return artifact_operation_failed with details.reason: "format", the catalog path and invalid-artifact recovery. The existing rejection tests at src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts:520–575 assert that classification for the four-space diagnostic spelling; both focused variants passed.

Impact and scope

P2: callers receive the wrong public error code and recovery advice for malformed catalogs. The captured diagnostic and catalog path remain available, so inspecting stderr or running assetutil directly is a demonstrated workaround for identifying the invalid input. Real-app prevalence, other macOS releases and MCP transport were not tested. No valid-catalog success or software-fix restoration is claimed.

REA version

Exact node scripts/rea.mjs --version output: 6.8.0. Source commit: f2277454b8c5356abbe311ad6dbb1dd3a3e334a5 (fetched main, rebuilt before reproduction).

Runtime and platform

Node.js v24.22.1; macOS 27.0.1 (build 26A434); Darwin arm64. Used the installed system assetutil; Xcode version was not measured.

Target and artifact context

Synthetic resource-only app with an inline XML Info.plist and a regular 14-byte Assets.car containing not a catalog followed by a newline. No target code was launched. HOME, XDG directories and temporary storage were isolated.

Interface

CLI

Earliest failure stage

Native analysis or reconstruction

Relevant output or evidence

Observed projected fields, with unrelated fields omitted:

{"code":"unreadable_output","category":"execution_failure","message":"Analysis returned an unreadable result. Run `rea doctor` and review the reported details; repeating the unchanged request is not expected to succeed.","details":{"operation":"inspect_asset_catalog","reason":"assetutil did not produce usable catalog metadata for Assets.car","diagnostics":{"catalog_path":"Assets.car"}}}

REA's retained capture reports exit_code: 1, signal: null, truncated: false, and empty stdout. Both REA's retained stderr and direct assetutil stderr contain the following suffix; the disposable catalog prefix is replaced by $WORK, and \t denotes one observed tab:

carutil: error:
\t$WORK/Demo.app/Assets.car is not a valid AssetCatalog
REA exit=1
assetutil exit=1

Typed outcome or recovery expected

Use the documented invalid-artifact recovery: “Artifact is invalid or has changed. Get a fresh copy and try again.” Preserve details.diagnostics.catalog_path: "Assets.car" and captured stderr.

Analysis or suspected cause

Source-derived: src/artifacts/apple/AppleAssetCatalogAnalysis.ts:466–497 matches the carutil diagnostic with exactly four spaces before entry.adapterKey. The observed tab spelling cannot match, so the completed rejection falls through to AnalysisOutputError. The exact-path attribution and complete-exit guards should remain; this report concerns the producer's observed indentation.

Additional context

Closed issue #5698 covered malformed-catalog I/O classification and dropped diagnostics. The present failure persists on the tested main as a producer-format mismatch. Closed issue #5977 concerns successful malformed producer stdout being mistaken for invalid artifact bytes, a distinct case. No matching open report was found. Proposed restoration check: repeat this real-producer fixture and retain separate unavailable-tool and truncated-capture classifications; those latter controls were not executed here.

Originally created by @coygeek on GitHub (Oct 27, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/7423 ## 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 Evidence, artifacts, or reconstruction ## Observed behavior On macOS, `node scripts/rea.mjs inspect-asset-catalog "$WORK/Demo.app" --json` returns `unreadable_output` and recommends `rea doctor` for a readable malformed `Assets.car`. Captured stderr already declares that the exact selected catalog is not a valid AssetCatalog, with a tab before its path. The documented invalid-artifact classification is lost. ## Reproduction Use a source checkout at the commit below, Node 24.22.1, and macOS with system assetutil. Fresh-checkout setup is `npm ci && npm run build:cached`; verification reused installed locked dependencies and rebuilt successfully. Set `WORK` to an empty disposable directory outside the checkout, then run from the checkout root: ```sh mkdir -p "$WORK/Demo.app" "$WORK/home" "$WORK/cfg" "$WORK/data" "$WORK/cache" "$WORK/state" "$WORK/tmp" printf '%s\n' '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>CFBundleIdentifier</key><string>com.example.demo</string></dict></plist>' > "$WORK/Demo.app/Info.plist" printf 'not a catalog\n' > "$WORK/Demo.app/Assets.car" export HOME="$WORK/home" XDG_CONFIG_HOME="$WORK/cfg" XDG_DATA_HOME="$WORK/data" XDG_CACHE_HOME="$WORK/cache" XDG_STATE_HOME="$WORK/state" TMPDIR="$WORK/tmp" node scripts/rea.mjs inspect-asset-catalog "$WORK/Demo.app" --json printf 'REA exit=%s\n' "$?" /usr/bin/assetutil --info "$WORK/Demo.app/Assets.car" > "$WORK/assetutil.out" 2> "$WORK/assetutil.err" printf 'assetutil exit=%s\n' "$?" sed -n l "$WORK/assetutil.err" ``` The CLI and direct producer each failed as described in two independent fixture runs. A separate otherwise identical bundle without `Assets.car` exited 0 with an empty catalog inventory. ## Expected behavior `docs/native-investigation.md:599–604` promises an invalid-artifact failure for a complete normal assetutil exit declaring the exact catalog path `is not a valid AssetCatalog`. Return `artifact_operation_failed` with `details.reason: "format"`, the catalog path and invalid-artifact recovery. The existing rejection tests at `src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts:520–575` assert that classification for the four-space diagnostic spelling; both focused variants passed. ## Impact and scope P2: callers receive the wrong public error code and recovery advice for malformed catalogs. The captured diagnostic and catalog path remain available, so inspecting stderr or running assetutil directly is a demonstrated workaround for identifying the invalid input. Real-app prevalence, other macOS releases and MCP transport were not tested. No valid-catalog success or software-fix restoration is claimed. ## REA version Exact `node scripts/rea.mjs --version` output: `6.8.0`. Source commit: `f2277454b8c5356abbe311ad6dbb1dd3a3e334a5` (fetched main, rebuilt before reproduction). ## Runtime and platform Node.js v24.22.1; macOS 27.0.1 (build 26A434); Darwin arm64. Used the installed system assetutil; Xcode version was not measured. ## Target and artifact context Synthetic resource-only app with an inline XML Info.plist and a regular 14-byte `Assets.car` containing `not a catalog` followed by a newline. No target code was launched. HOME, XDG directories and temporary storage were isolated. ## Interface CLI ## Earliest failure stage Native analysis or reconstruction ## Relevant output or evidence Observed projected fields, with unrelated fields omitted: ```json {"code":"unreadable_output","category":"execution_failure","message":"Analysis returned an unreadable result. Run `rea doctor` and review the reported details; repeating the unchanged request is not expected to succeed.","details":{"operation":"inspect_asset_catalog","reason":"assetutil did not produce usable catalog metadata for Assets.car","diagnostics":{"catalog_path":"Assets.car"}}} ``` REA's retained capture reports `exit_code: 1`, `signal: null`, `truncated: false`, and empty stdout. Both REA's retained stderr and direct assetutil stderr contain the following suffix; the disposable catalog prefix is replaced by `$WORK`, and `\t` denotes one observed tab: ```text carutil: error: \t$WORK/Demo.app/Assets.car is not a valid AssetCatalog REA exit=1 assetutil exit=1 ``` ## Typed outcome or recovery expected Use the documented invalid-artifact recovery: “Artifact is invalid or has changed. Get a fresh copy and try again.” Preserve `details.diagnostics.catalog_path: "Assets.car"` and captured stderr. ## Analysis or suspected cause Source-derived: `src/artifacts/apple/AppleAssetCatalogAnalysis.ts:466–497` matches the carutil diagnostic with exactly four spaces before `entry.adapterKey`. The observed tab spelling cannot match, so the completed rejection falls through to `AnalysisOutputError`. The exact-path attribution and complete-exit guards should remain; this report concerns the producer's observed indentation. ## Additional context [Closed issue #5698](https://github.com/morluto/rea/issues/5698) covered malformed-catalog I/O classification and dropped diagnostics. The present failure persists on the tested main as a producer-format mismatch. [Closed issue #5977](https://github.com/morluto/rea/issues/5977) concerns successful malformed producer stdout being mistaken for invalid artifact bytes, a distinct case. No matching open report was found. Proposed restoration check: repeat this real-producer fixture and retain separate unavailable-tool and truncated-capture classifications; those latter controls were not executed here.
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#4429
No description provided.