[PR #4324] [MERGED] fix(apple): preserve 128-bit keyed archive integers #6171

Closed
opened 2026-10-31 01:12:25 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4324
Author: @pollychen-lab
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @morluto

Base: main ← Head: agent/keyed-archive-uint64-4292


📝 Commits (5)

  • 08e6d93 fix(apple): preserve 128-bit keyed archive integers
  • 60ea1eb fix(browser): retain cancelled scenario steps
  • 1fa549f fix(apple): guard wide plist integer decoding
  • 3f63a5b test(browser): retain cancellation error contract
  • 4230934 Merge origin/main into agent/keyed-archive-uint64-4292

📊 Changes

8 files changed (+325 additions, -20 deletions)

View changed files

📝 src/artifacts/apple/InterfaceBuilderAnalysis.ts (+9 -3)
📝 src/artifacts/apple/InterfaceBuilderDecodeBudget.test.ts (+8 -0)
📝 src/artifacts/apple/InterfaceBuilderDecodeBudget.ts (+4 -1)
📝 src/artifacts/apple/KeyedArchiveReader.ts (+10 -3)
➕ src/artifacts/apple/PlistNumberLiterals.test.ts (+40 -0)
📝 src/artifacts/apple/PlistNumberLiterals.ts (+113 -12)
📝 tests/boundary/filesystem/keyedArchiveNumberMetadata.test.ts (+67 -1)
➕ tests/fixtures/keyedArchiveWideIntegers.ts (+74 -0)

📄 Description

Summary

Fixes #4292. Binary keyed archives with 16-byte integer markers no longer report UInt64 values such as 18446744073709551615 as 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

  • Before the change, the public CLI reproduced #4292 on a generated binary NSKeyedArchiver fixture: UInt64.max was value: 0 with status: "observed", and adjacent Int64.max was rounded.
  • A generated fixture exercises the public CLI and filesystem boundary. Both values are asserted as exact decimal wrappers, with no incomplete-number-metadata limitation.
  • A malformed object table with an unused integer offset inside a data object verifies that overlapping source bytes are never rewritten.
  • Budget coverage verifies binary number projection reserves at least one additional input-sized buffer.
  • A 32 MiB synthetic plist with one wide integer caused a 33,423,360-byte RSS increase when the compatibility copy was created (one Node 24.18.0 sample; the copy itself was 33,554,510 bytes).
  • No Apple Foundation or plutil runtime 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.
  • Latest GitHub CI — source tests, static checks, package build, Windows fixture build, Linux native package baseline, and Greptile passed. The required suite remains red on unrelated tests: browser probe lifecycle, browser cancellation CLI, and capture cleanup failures also reproduce on base 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:

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4324 **Author:** [@pollychen-lab](https://github.com/pollychen-lab) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `agent/keyed-archive-uint64-4292` --- ### 📝 Commits (5) - [`08e6d93`](https://github.com/morluto/rea/commit/08e6d93dc4d71200b4b21710c7c322d86e0544fa) fix(apple): preserve 128-bit keyed archive integers - [`60ea1eb`](https://github.com/morluto/rea/commit/60ea1eb9a80e599ac57f0a691ac4bc7acf714714) fix(browser): retain cancelled scenario steps - [`1fa549f`](https://github.com/morluto/rea/commit/1fa549f40e6b40bb7bca0dd5596e4ae0269a196e) fix(apple): guard wide plist integer decoding - [`3f63a5b`](https://github.com/morluto/rea/commit/3f63a5ba35facd9ca4473ad70288d2b7286fe0fa) test(browser): retain cancellation error contract - [`4230934`](https://github.com/morluto/rea/commit/42309344c143b0c265dfb3a19570fadca164873c) Merge origin/main into agent/keyed-archive-uint64-4292 ### 📊 Changes **8 files changed** (+325 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/apple/InterfaceBuilderAnalysis.ts` (+9 -3) 📝 `src/artifacts/apple/InterfaceBuilderDecodeBudget.test.ts` (+8 -0) 📝 `src/artifacts/apple/InterfaceBuilderDecodeBudget.ts` (+4 -1) 📝 `src/artifacts/apple/KeyedArchiveReader.ts` (+10 -3) ➕ `src/artifacts/apple/PlistNumberLiterals.test.ts` (+40 -0) 📝 `src/artifacts/apple/PlistNumberLiterals.ts` (+113 -12) 📝 `tests/boundary/filesystem/keyedArchiveNumberMetadata.test.ts` (+67 -1) ➕ `tests/fixtures/keyedArchiveWideIntegers.ts` (+74 -0) </details> ### 📄 Description ## Summary Fixes #4292. Binary keyed archives with 16-byte integer markers no longer report UInt64 values such as `18446744073709551615` as 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 - Before the change, the public CLI reproduced #4292 on a generated binary NSKeyedArchiver fixture: UInt64.max was `value: 0` with `status: "observed"`, and adjacent Int64.max was rounded. - A generated fixture exercises the public CLI and filesystem boundary. Both values are asserted as exact decimal wrappers, with no incomplete-number-metadata limitation. - A malformed object table with an unused integer offset inside a data object verifies that overlapping source bytes are never rewritten. - Budget coverage verifies binary number projection reserves at least one additional input-sized buffer. - A 32 MiB synthetic plist with one wide integer caused a 33,423,360-byte RSS increase when the compatibility copy was created (one Node 24.18.0 sample; the copy itself was 33,554,510 bytes). - No Apple Foundation or `plutil` runtime 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. - Latest GitHub CI — source tests, static checks, package build, Windows fixture build, Linux native package baseline, and Greptile passed. The required suite remains red on unrelated tests: browser probe lifecycle, browser cancellation CLI, and capture cleanup failures also reproduce on base `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: <!-- @GitHub-handle --> - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:12:25 +00:00
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#6171
No description provided.