Repository navigation
fix(apple): preserve 128-bit keyed archive integers - #4324
Conversation
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08e6d93dc4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| metadata: BinaryPlistNumberMetadata, | ||
| ): Buffer => { | ||
| if (metadata.wideIntegers.length === 0) return bytes; | ||
| const compatible = Buffer.from(bytes); |
There was a problem hiding this comment.
Charge the compatibility copy to the decode budget
When either inspected decode path sees even one wide integer, this line copies the entire input (up to 64 MiB for keyed-archive decoding, or 32 MiB aggregate for Interface Builder) after the existing preflight/reservation calculation; neither estimateBinaryPlistExpansion nor preflightPropertyListDecode charges the new buffer. A near-budget archive can therefore add an input-sized transient allocation beyond the modeled decode reservation, so charge this conditional copy before allocation (or avoid the full-file copy) and measure the new peak.
AGENTS.md reference: AGENTS.md:L77-L77
Useful? React with 👍 / 👎.
[Medium impact] The PR appears safe to merge; no new actionable issue was found. SummaryPreserves exact decimal values for unambiguous 16-byte binary plist integers in keyed archives and Interface Builder files.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Original binary plist] --> B[Check decode budget]
B --> C[Scan exact numbers and object boundaries]
C --> D{Safe wide integers found?}
D -->|Yes| E[Rewrite a copy for the parser]
D -->|No| F[Keep original parser input]
E --> G[Parse plist]
F --> G
C --> H[Original number metadata]
G --> I[Project decoded values]
H --> I
I --> J[Restore unambiguous exact decimals]
Reviews (3) · Last reviewed commit: "Merge origin/main into agent/keyed-archi..." · Reviewed by Greptile |
Main (morluto#4274) rewrote the active-action cancellation test for its new cancellation semantics (partial observation on AnalysisCancelledError). This branch had only adjusted that test around main's earlier red run, so take main's version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Resolved the conflict with main. The only conflict was in |
Summary
Fixes #4292. Binary keyed archives with 16-byte integer markers no longer report UInt64 values such as
18446744073709551615as an observed zero. Adjacent large integers retain exact decimal values too.Problem and expected behavior
The pinned plist decoder read only the first eight bytes of a 16-byte integer. For UInt64.max that produced zero, while the raw metadata scan marked the whole table incomplete. The result should preserve exact decimal text when the original integer bytes identify it unambiguously.
Change and scope
The bounded binary number scan now recognizes signed 128-bit integer markers. Before rewriting a parser-compatible copy, it validates object extents and refuses rewriting when object-table entries overlap. The decode budget reserves the possible input-sized copy before allocation. Exact integers are restored from metadata scanned from the original bytes, preserving source bytes and digest. Both keyed archive and Interface Builder decode paths use this handling. No schema or tool contract changes.
This is a focused static plist decoding fix; no maintainer scope decision applies. It reads local artifact bytes and does not launch a target process or contact a service.
Evidence and regression coverage
value: 0withstatus: "observed", and adjacent Int64.max was rounded.plutilruntime was available here; the fixture is generated with the bplist encoding and validated through REA's production CLI.Validation performed
npm run compile— passed.npm run test:focused -- src/artifacts/apple/PlistNumberLiterals.test.ts src/artifacts/apple/InterfaceBuilderDecodeBudget.test.ts src/artifacts/apple/KeyedArchiveReader.test.ts tests/boundary/filesystem/keyedArchiveNumberMetadata.test.ts src/browser/PlaywrightBrowserScenarioProvider.test.ts— 86 passed.npm run check:fast— passed.npm run format:check— passed.1bd5c5c87; one ADB CLI test additionally failed on this run due to differing temporary input paths.Compatibility and safety
No migration or schema changes. Numeric decoding of 16-byte binary plist integers becomes exact where source metadata is unambiguous. Overlapping object tables retain original bytes and are marked incomplete. Platform-specific Foundation writer verification was unavailable; the generated fixture and production CLI provide local coverage.
Author readiness
Human owner: