Repository navigation
fix(plist): record dictionary keys declared more than once - #10737
Merged
Merged
Conversation
…oding collapses them
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The reviewed changes appear safe to merge. SummaryThe PR records repeated dictionary keys in binary, XML, and OpenStep plists without changing which value wins.
Reviews (2) · Last reviewed commit: "fix(plist): bound repeated key names in ..." · Reviewed by Greptile |
22 tasks
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inspect_plistdecodes binary, XML and OpenStep plists into a JSON value with one property per dictionary key. A dictionary that declares the same key twice silently lost the earlier value: the result looked complete and nothing said a declaration was dropped. The decoders now read each dictionary's source keys before the collapse and the result carries a counted limitation naming the repeated keys.Refs the W7 duplicate-key workstream (structural audit report 06, finding 5: "Plist: a later duplicate key replaces the earlier one",
BinaryPlistMaterializer.ts).Problem and expected behavior
Trigger: an XML plist
<dict><key>a</key><string>first</string><key>a</key><string>last</string></dict>(or a binary plist whose dictionary references the key stringatwice, or OpenStep{ a = 1; a = 2; }).Before:
{ "a": "last" }with no limitation. The earlier declaration is gone and other plist readers (CoreFoundation, Python'splistlib) are free to keep a different one.After: the value is unchanged (
laststill wins, so existing consumers see the same data), andlimitationsgains:Change and scope
src/domain/apple/plistDuplicateKeys.ts(new) owns the fact: a collector that receives each dictionary's keys in source order, and the limitation text. Counts are exact; at most 8 distinct names are listed, each shortened to 64 characters with a marker, and ", ..." appears only when a further distinct repeated name was left out.propertyListXml.ts): from theentrieslist beforeObject.fromEntries.propertyListOpenStep.ts): an optional collector parameter; keys are recorded as members are defined.BinaryPlistMaterializer.ts):binaryPlistDuplicateKeys(plan)reads the planned dictionary containers' decoded keys, the same keys the materializer assigns.ParsedPropertyListgainsduplicateKeys;parsePlistBinaryand the XML projection insrc/native/parsers/plist.tsadd the limitation.docs/guides/native/native-investigation.md.Not included:
plutilconversion are not checked:JSON.parseand CoreFoundation have already kept one value per key before REA sees the text. The doc states this. The JSON reader belongs to the separate Keyed/duplicate-detecting JSON reader slice.parseXmlPropertyList/decodeBinaryPlistValueconsumers (keyed archives, Interface Builder, app bundleInfo.plistexecutable lookup) receive the new field but do not yet surface it. They are follow-ups once theKeyed<T>owner lands.Contribution scope: ordinary fix within an existing boundary; not applicable.
Contract and boundary impact
Semantic owner and earliest changed stage: the plist decoders (XML, OpenStep, binary plan) own key identity;
plistDuplicateKeys.tsowns the duplicate fact and its limitation;src/native/parsers/plist.tsprojects it intoParsedPlist.limitations.Contribution scope fit and linked maintainer decision: within existing
inspect_plistboundary; W7 part 6 decision ("plist: detect duplicate keys before the plist library collapses them and record a limitation").CLI and MCP/tool-catalog contract: no schema change;
inspect_plistcan return one more limitation string.Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: decoded values unchanged; the limitation makes the loss visible.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
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
Tests added or updated:
src/native/parsers/plist.test.ts: binary dictionary with a repeated stored key, XML source with a repeated key, distinct keys (including the same key in a nested dictionary) produce no limitation, OpenStep counts across two dictionaries.src/domain/propertyListKeys.test.ts: the existing last-value-wins cases (split__proto__keys, mixed CDATA/comment spellings, empty keys, OpenStep__proto__and compound keys) now also assert the duplicate count and names.Base reproduction: with the source changes reverted and the new tests kept, the 3 detection tests in
plist.test.tsfail (no limitation / noduplicateKeys).User-visible output: one added limitation string, shown above.
Remaining proof gaps: no real CoreFoundation comparison of which value it keeps; the limitation deliberately does not claim one.
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
npm run test:local -- src/native/parsers/plist.test.ts— 66 passed; 3 new tests fail with the source change reverted.npm run test:local -- src/domain/propertyListKeys.test.tsplus every test file importing the XML/OpenStep decoders andsrc/artifacts/apple/PropertyListDecodeBudget.test.ts— 9 files, 317 passed.npm run test:focused -- tests/boundary/providers/native/{nativePlistBinarySource,nativePlistDiagnostics,nativePlistFileCleanup,nativePlistSelection,nativePlistTextSource,plistSourceFormat}.test.ts src/artifacts/apple/PropertyListDecodeBudget.test.ts— 7 files, 86 passed.npm run typecheck— passed.npx oxlinton changed files — no errors.npx oxfmt --check src docs/guides/native/native-investigation.md— clean.node scripts/verify/architecture-guards.mjs— passed.npm run docs:check— passed.Review follow-up (1d29219):
npm run test:local -- src/native/parsers/plist.test.ts src/domain/propertyListKeys.test.ts— 113 passed; typecheck and oxlint clean.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.