Skip to content

fix(plist): preserve complete XML character-data key names - #3426

Closed
thangldw wants to merge 1 commit into
morluto:mainfrom
thangldw:codex/fix-3371-xml-key-identity
Closed

thangldw wants to merge 1 commit into
morluto:mainfrom
thangldw:codex/fix-3371-xml-key-identity

Conversation

@thangldw

@thangldw thangldw commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #3371. XML dictionary keys split across text and CDATA now retain their complete names. For example, ma<![CDATA[in]]> stays main, so named-root selection succeeds; user<![CDATA[ID]]> stays userID.

Problem and expected behavior

The pinned plist decoder reads only the first child of a <key>. Inspection therefore returned roots.ma and value.user, with truncated: false, and rejected --root main. Native plutil, plain XML and binary controls retained the complete names. Inspection must preserve those identities and their UID reference paths.

Change and scope

Normalize complete character-data key names at the existing shared XML plist boundary, before the pinned value decoder. Prototype-key omission and placeholder collision checks consume the same identity. Replace only key contents, preserving source values, encoded line endings, depth preflight and the existing handling of unsupported nested markup. Update the owning documentation. No consumer-specific fallback or new dependency.

Contract and boundary impact

  • Semantic owner: parseXmlPropertyList in src/domain/propertyListKeys.ts; callers consume its decoded keys.
  • Contribution scope: ordinary correction within existing inert decoding authority; separate maintainer scope decision not applicable.
  • CLI/MCP: existing schemas and commands; corrected root/field names and root selection.
  • Compatibility: shared XML plist consumers, including keyed archives, Interface Builder and app metadata. OpenStep and binary decoding stay on their existing paths.
  • Evidence: preserve original archive digest, object indices, reference targets and source bytes.
  • Authority/cleanup: no new target execution, network or mutation authority.
  • Generated metadata/package/install: no schema, dependency or version change; ignored outputs are not committed.

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

  • Reproduced through compiled CLI on main 322506d0c0d3; four regressions failed before repair (36 other tests passed).

  • Public regression covers root selection, field identity, UID path, original digest and unchanged source bytes, with plain XML and independently encoded binary controls.

  • Owner controls cover segmented prototype keys, placeholder collisions, literal CDATA entities/closing-tag text, encoded line endings and unsupported nested elements.

  • Original compiled CLI and real stdio MCP replay after repair return main, userID: 42, reference path ["main"] and the original digest. Root selection succeeds.

  • Independent subagent review found no actionable findings, independently ran 39 owner tests and 64 compiled-owner stress combinations. It did not rerun the full checks or public transports; the stress oracle uses xmldom.

  • 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

Head 789e8a6e1e9e, rebased onto main 1b97b0f3707b, Node 24.18.0 / npm 11.16.0, macOS arm64. The authored XML fix is preserved. OpenStep scanner/helpers from #4105 are byte-identical to main, and both newer regression cases remain included. The rebased tree matches the independently checked three-way integration tree.

  • npm run test:focused with 15 exact parser/consumer/CLI/MCP files — 227 passed, one platform skip. Includes keyed-archive number/nesting/encoding controls and Interface Builder consumers.
  • npm run check — passed typecheck, lint, formatting, knip, metadata, module boundaries and architecture guards.
  • npm run docs:check — passed, including five consistency tests.
  • npm run verify:test-discovery — all 1,412 test files discovered exactly once.
  • git diff --check — passed.
  • Fresh real stdio MCP replay on the rebased head — both full and root: "main" inspection retain main, userID: 42, the UID edge and original archive digest.
  • GitHub CI for the rebased head will run separately; previous green checks apply to the pre-rebase head.

Compatibility, safety, and release

Corrects XML key decoding without a caller migration or package/release change. Local validation is macOS arm64; Linux/Windows and the full CI suite have not been executed locally. Synthetic archives and native plutil controls do not measure occurrence in real application archives. No near-64-MiB peak-memory qualification or real disassembler run is claimed.

Author readiness

Human owner: @thangldw

  • 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.

@thangldw
thangldw marked this pull request as ready for review October 14, 2026 12:15
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found.

Summary

Preserves complete XML dictionary key names at the shared parseXmlPropertyList boundary.

  • XML plist keys keep their full names across text and CDATA.

The previous and current commits have different merge bases, so this review covered the full PR diff. No previous review threads were supplied.

Static review found no actionable correctness or security issue. git diff --check passed. Tests were not run because dependencies are absent. Live supersession status could not be checked because GitHub authentication is unavailable; local history did not establish that this patch was superseded.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[XML source] --> B[Normalize line endings]
  B --> C[Check nesting depth]
  C --> D[Combine key text and CDATA]
  D --> E[Choose collision-free placeholder]
  E --> F[Rewrite changed key contents]
  F --> G[Pinned plist decoder]
  G --> H[Remove placeholder entries and count omissions]
  H --> I[Shared consumers]
Loading

Reviews (2) · Last reviewed commit: "fix(plist): preserve complete XML charac..." · Reviewed by Greptile

@CassieFox23

CassieFox23 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

TL;DR: The fix works on its own branch: a plist key split across text and CDATA, like ma<![CDATA[in]]>, now reads as main. Four tests that fail on current main pass on this branch. The patch no longer applies cleanly to main, so it needs a rebase.

Edit: Newer results for the rebased head are here. The branch was rebased onto 1b97b0f and now sits at 789e8a6. The Before and After rows below are for the old head 86c06b3. My line about GitHub showing the PR as mergeable and clean is out of date. GitHub now shows it as dirty, with three files in conflict with main.

Results (Linux, Node 24.18.0)

Step Tree Result
Before main 0cfced1 plus this PR's test changes only 4 failed, 39 passed (43 tests)
After this PR's head 86c06b3 41 passed, 0 failed (41 tests)
  • Two test files ran: the plist key parser test and the keyed archive CLI test. Their paths are in the Commands fold.
  • The four failures on main match the bug. The compiled CLI gave roots of ma where main was expected. Three parser cases kept __rea, __pro and pre as key names.
  • The counts differ (43 and 41) because main's test file has two newer cases from fix(apple): report __proto__ entries omitted from OpenStep property lists #4105. This branch does not have them.
  • Neither file runs the doctor command. I checked with grep first.
  • Full CI ran on this head on GitHub (secondhand: I read the check list, I did not rerun it). Every check passed or was skipped.

Merge drift

Main moved on after this branch started. A later change, #4105 (fe7bcc3), also edited the key parser. The patch no longer applies cleanly to main for that file. GitHub still shows the PR as mergeable and clean. Because of that, I tested the head tree as the author branched it. I did not test head merged with main.

Not run

  • This head merged with current main (the patch does not apply cleanly).
  • The 15-file focused set from the PR text, and its check, docs and discovery scripts.
  • The real stdio MCP replay from the PR text.
  • Real app archives. The tests use made-up plists.
  • Windows and macOS.

Thanks, thangldw, for the clear fix and the tests.

Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 24.18.0
  • Head: 86c06b3
  • Base: 0cfced1
  • Other: the box was shared with other test agents during the runs
Commands
git -C ~/code/rea-mirror/rea.git archive 86c06b38e | tar -x -C /tmp/t12-1015/h3426
npm ci && npm run build && npm run test:prepare   # in the head tree, then again in a main tree
# after, in the head tree
npm run test:focused -- src/domain/propertyListKeys.test.ts tests/boundary/cli/keyedArchivePrototypeKeyCli.test.ts
# before, in the main tree after applying only the PR's two test-file changes
npm run test:focused -- src/domain/propertyListKeys.test.ts tests/boundary/cli/keyedArchivePrototypeKeyCli.test.ts

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@thangldw
thangldw force-pushed the codex/fix-3371-xml-key-identity branch from 86c06b3 to 789e8a6 Compare October 16, 2026 04:42
@thangldw

Copy link
Copy Markdown
Contributor Author

Replying to your Linux verification: thank you for checking the before/after behavior and identifying the main drift.

Rebased the branch onto main 1b97b0f3707b; new head: 789e8a6e1e9e531f7402dc94752bf03980d0c43a.

  • Preserved fix(apple): report __proto__ entries omitted from OpenStep property lists #4105: the OpenStep scanner/helpers are byte-identical to current main, and both added OpenStep prototype-key regression cases remain in the test file. XML key normalization from [Bug] CDATA in XML keyed-archive keys truncates root and field names #3371 is retained.
  • The original text patch failed a context-only apply check, while Git three-way integration was clean. The rebased tree is byte-for-byte the same Git tree as that tested integration result.
  • Fresh validation on the actual rebased branch, macOS arm64 / Node 24.18.0 / npm 11.16.0: the 15-file parser/consumer/CLI/MCP selection passed 227 tests with one platform skip. npm run check and npm run docs:check passed (including five consistency tests); test discovery found all 1,412 files exactly once; git diff --check passed.
  • Replayed the original fixture through real stdio MCP on the rebased head. Full inspection and root: "main" both retain main, userID: 42, reference path ["main"], and the original archive SHA-256. The compiled CLI regression also exercises mixed XML, plain XML and binary controls, including named-root selection and unchanged source bytes.

GitHub CI for this rewritten head is a new run; the previous green CI belongs to 86c06b38e400. No Linux/Windows rerun, real application archive qualification or near-64-MiB memory measurement is claimed for this local follow-up.

morluto added a commit that referenced this pull request Oct 17, 2026
Use the validated DOM's character-data key names for both identity and
prototype omission. Replace first-child reinterpretation with canonical,
collision-free aliases inside the pinned decoder boundary; restore names
through the existing dictionary projection. Alias every spelling of the
same name to preserve duplicate assignment order. Handle empty key spellings
and keep scalar key elements outside aliasing. Preserve value text and bytes.

Adapt @thangldw's tests and proposal from PR #3426. Avoid the proposal's
closing-content scanner and re-escaping source names. Add duplicate, empty,
alias-collision, scalar-key, native fallback and Interface Builder controls.

Validation: 180 focused checks across 20 files pass, including built CLI and
actual stdio MCP, build, check:fast and docs:check. Baseline public inspection
truncates main to ma. 24 tiny completed CLI cost controls preserve ordinary
XML/binary full replies and Evidence IDs byte for byte. No statistical speed
claim, heavy profiling, investigated-target or real deep-provider execution.

Fixes #3371
@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: Fixed: the rebased branch still cures the bug. The same four tests fail without the fix and all 43 pass with it. Still open: this branch now conflicts with main in three files. Main landed its own fix for the same bug in 78cf610.

Thanks, thangldw, for the rebase and the clear notes. I tested head 789e8a6 as pushed.

Results (Linux, Node 24.18.0)

Check Earlier result (head 86c06b3, base 0cfced1) Now (head 789e8a6, base 1b97b0f)
Before: base plus this PR's test changes only 4 failed, 39 passed (43 tests) 4 failed, 39 passed (43 tests)
After: this PR's head 41 passed, 0 failed (41 tests) 43 passed, 0 failed (43 tests)
Extra: main 1d5bf5f with its own versions of the same two test files not run 49 passed, 0 failed (49 tests)
Tree check: clean three-way merge of the old head 86c06b3 onto 1b97b0f not run tree f7b05a341, same as the tree of 789e8a6
  • Two test files ran: the plist key parser test and the keyed archive CLI test. Their paths are in the Commands fold.
  • The four failures in the Before row match the bug. The compiled CLI gave roots of ma where main was expected, and three parser cases kept the wrong key names.
  • The After count went from 41 to 43 because the parser test file went from 39 to 41 tests. The author says the two added cases are the OpenStep ones from fix(apple): report __proto__ entries omitted from OpenStep property lists #4105. I did not check which two they are.
  • The author's claim holds. The rebased tree is the same Git tree as a clean three-way merge of the old head onto 1b97b0f.
  • Neither test file runs the doctor command. I checked with grep first.

Merge with today's main

GitHub shows this PR as dirty. I merged head 789e8a6 with main 1d5bf5f in a scratch repo (Git's merge-tree, no build). Three files conflict:

  • src/domain/propertyListKeys.ts
  • src/domain/propertyListKeys.test.ts
  • tests/boundary/cli/keyedArchivePrototypeKeyCli.test.ts

The cause is main commit 78cf610, which closed #3371. Its title is preserve complete XML dictionary key identities. Its message says it adapts the tests and proposal from this PR. On main 1d5bf5f the same two test files pass 49 of 49, and they contain the ma<![CDATA[in]]> cases. The commit message is secondhand. The test run is mine. This is not a request to close the PR; that call is the maintainers' and thangldw's.

Not run

  • This head merged with main. It conflicts, so there was nothing to build.
  • This PR's two test files against main's source, for the same reason.
  • The 15-file focused set from the PR text, and its check, docs and discovery scripts.
  • The real stdio MCP replay.
  • Real app archives. The tests use made-up plists.
  • Node 22 and Node 26.
  • Windows and macOS.
  • GitHub CI on this new head.
Test setup
  • Box: Nobara 44 (Fedora 44 base), Linux 7.2.9
  • CPU: AMD Ryzen 9 5900X, 12 cores / 24 threads
  • RAM: 32 GB DDR4-3600
  • Node: 24.18.0 (npm 11.16.0)
  • Head / base: 789e8a6 / 1b97b0f
  • Other: the box was shared with other test agents during the runs. Main moved from 3537e58 to 1d5bf5f while I worked. The final merge check used 1d5bf5f; the earlier one gave the same three files.
Commands
git -C ~/code/rea-mirror/rea.git fetch origin
git -C ~/code/rea-mirror/rea.git archive 789e8a6e1 | tar -x -C /tmp/rea-rt-3426/head
git -C ~/code/rea-mirror/rea.git archive 1b97b0f37 | tar -x -C /tmp/rea-rt-3426/base
git -C ~/code/rea-mirror/rea.git archive 1d5bf5ff0 | tar -x -C /tmp/rea-rt-3426/main
# base: copy only the PR's two test files over the base tree
cp /tmp/rea-rt-3426/head/src/domain/propertyListKeys.test.ts /tmp/rea-rt-3426/base/src/domain/
cp /tmp/rea-rt-3426/head/tests/boundary/cli/keyedArchivePrototypeKeyCli.test.ts /tmp/rea-rt-3426/base/tests/boundary/cli/
# in each tree (head, base, main), Node 24 first on PATH
npm ci && npm run prepare && npm run build:cached && npm run test:prepare
npm run test:focused -- src/domain/propertyListKeys.test.ts tests/boundary/cli/keyedArchivePrototypeKeyCli.test.ts

# tree check and conflict list, in a scratch bare repo that reads the mirror's objects
git init --bare /tmp/rea-rt-3426/scratch/s.git
git -C /tmp/rea-rt-3426/scratch/s.git merge-tree --write-tree 1b97b0f37 86c06b38e      # f7b05a3417d3, clean
git -C /tmp/rea-rt-3426/scratch/s.git rev-parse 789e8a6e1^{tree}                        # f7b05a3417d3
git -C /tmp/rea-rt-3426/scratch/s.git merge-tree --write-tree --name-only 1d5bf5ff0 789e8a6e1   # exit 1, three files

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@morluto

morluto commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thanks @thangldw. Closing this PR as superseded by 78cf6100f on main.

XML dictionary key identity is retained at the shared source-aware owner, including CDATA/prototype-key controls. Current main replaces the earlier local representation.

This is an unmerged closure: it does not label this PR as merged or remove contributor history/credit. The decision uses the current source diff and existing validation record; no new local test or provider run is claimed.

@morluto morluto closed this Oct 18, 2026
@morluto morluto added the bug Something isn't working label Nov 23, 2026
@morluto morluto added the area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CDATA in XML keyed-archive keys truncates root and field names

3 participants