[PR #5775] [CLOSED] fix(apple): preserve unknown date status for sub-millisecond binary dates (#5770) #7052

Closed
opened 2026-11-01 21:44:59 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5775
Author: @Totopo27
Created: 10/21/2026
Status: ❌ Closed

Base: main ← Head: fix/5770-keyed-archive-submillisecond-dates


📝 Commits (1)

  • f681ebb fix(apple): preserve unknown date status for sub-millisecond binary dates (#5770)

📊 Changes

3 files changed (+161 additions, -13 deletions)

View changed files

📝 src/artifacts/apple/PlistNumberLiterals.test.ts (+39 -0)
📝 src/artifacts/apple/PlistNumberLiterals.ts (+81 -13)
📝 tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts (+41 -0)

📄 Description

Summary

Fixes #5770.

Keyed archive inspection silently truncated binary plist dates (0x33) with sub-millisecond precision to rounded millisecond timestamps, reporting them as observed without disclosing any precision limitation. Sub-millisecond binary dates are now identified during pre-scan and projected as { "$plist_type": "date", "iso8601": null } with a counted limitation, while canonical millisecond dates remain observed.

Problem and expected behavior

In binary plists (bplist00), dates are encoded as Float64 seconds from the 2001 epoch. The pinned plist decoder instantiates JavaScript Date directly (new Date(timestamp * 1000 + EPOCH_2001)), which truncates fractional milliseconds. A date at 0.1005 seconds was reported as 2001-01-01T00:00:00.100Z without limitation.

Expected behavior: preserve exact-millisecond dates as observed; report unrepresentable sub-millisecond instants as unknown dates (iso8601: null) with the documented counted limitation (unknownDateLimitation).

Change and scope

  • In scanBinaryPlistNumberLiterals, scan date markers (0x33) and detect if seconds * 1000 has fractional milliseconds (!Number.isInteger(ms)). Record unrepresentable date offsets in metadata.unrepresentableDateOffsets.
  • In decodeBinaryPlistNumbers, rewrite unrepresentable date double payloads in the parser's working copy to NaN. plist@5 parses them as Invalid Date, which projectPlistValue already maps to { "$plist_type": "date", "iso8601": null } and increments unknownDateCount.
  • Added unit tests in src/artifacts/apple/PlistNumberLiterals.test.ts and boundary test in tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts.

Ordinary fix within existing Apple keyed-archive boundaries; maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Native binary plist decoding / scanBinaryPlistNumberLiterals.
  • Contribution scope fit and linked maintainer decision: not applicable (bugfix).
  • CLI and MCP/tool-catalog contract: Unchanged output schema. Sub-millisecond dates project as unknown dates with limitation.
  • Provider, bridge, target-format, or platform compatibility: Binary property lists across all platforms.
  • Evidence, artifact, provenance, or reconstruction contract: Preserves provenance without inventing imprecise timestamps.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: None.

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

  • Tests added or updated: src/artifacts/apple/PlistNumberLiterals.test.ts, tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts.
  • Base reproduction: Binary plist fixture with date offset rewritten to 0.1005 double.
  • User-visible CLI/MCP output:
    {"id":1,"kind":"scalar","class_id":null,"class_name":null,"status":"observed","value":{"$plist_type":"date","iso8601":null}}
    
    with limitation:
    "1 date value(s) are reported as { \"$plist_type\": \"date\", \"iso8601\": null } because the decoder could not represent their timestamps."
    

For evidence-bearing changes:

  • 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

  • turbo run typecheck lint — passed clean.
  • npx vitest run src/artifacts/apple/PlistNumberLiterals.test.ts tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts — 8 passed.
  • npm run compile — successful build.
  • node scripts/rea.mjs inspect-keyed-archive with sub-millisecond date fixture — verified { "$plist_type": "date", "iso8601": null } and limitation.

Compatibility, safety, and release

  • Breaking changes or migration steps: None.
  • Real Hopper/Ghidra, browser, or OS coverage: Pure Node.js / binary parser, cross-platform.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: No target execution or secrets involved.

Author readiness

Human owner: @Totopo27

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

🔄 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/5775 **Author:** [@Totopo27](https://github.com/Totopo27) **Created:** 10/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/5770-keyed-archive-submillisecond-dates` --- ### 📝 Commits (1) - [`f681ebb`](https://github.com/morluto/rea/commit/f681ebb03aad8aab71e0736c894d9b40fbf1b07d) fix(apple): preserve unknown date status for sub-millisecond binary dates (#5770) ### 📊 Changes **3 files changed** (+161 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/artifacts/apple/PlistNumberLiterals.test.ts` (+39 -0) 📝 `src/artifacts/apple/PlistNumberLiterals.ts` (+81 -13) 📝 `tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts` (+41 -0) </details> ### 📄 Description ## Summary Fixes #5770. Keyed archive inspection silently truncated binary plist dates (`0x33`) with sub-millisecond precision to rounded millisecond timestamps, reporting them as observed without disclosing any precision limitation. Sub-millisecond binary dates are now identified during pre-scan and projected as `{ "$plist_type": "date", "iso8601": null }` with a counted limitation, while canonical millisecond dates remain observed. ## Problem and expected behavior In binary plists (`bplist00`), dates are encoded as Float64 seconds from the 2001 epoch. The pinned `plist` decoder instantiates JavaScript `Date` directly (`new Date(timestamp * 1000 + EPOCH_2001)`), which truncates fractional milliseconds. A date at `0.1005` seconds was reported as `2001-01-01T00:00:00.100Z` without limitation. Expected behavior: preserve exact-millisecond dates as observed; report unrepresentable sub-millisecond instants as unknown dates (`iso8601: null`) with the documented counted limitation (`unknownDateLimitation`). ## Change and scope - In `scanBinaryPlistNumberLiterals`, scan date markers (`0x33`) and detect if `seconds * 1000` has fractional milliseconds (`!Number.isInteger(ms)`). Record unrepresentable date offsets in `metadata.unrepresentableDateOffsets`. - In `decodeBinaryPlistNumbers`, rewrite unrepresentable date double payloads in the parser's working copy to `NaN`. `plist@5` parses them as `Invalid Date`, which `projectPlistValue` already maps to `{ "$plist_type": "date", "iso8601": null }` and increments `unknownDateCount`. - Added unit tests in `src/artifacts/apple/PlistNumberLiterals.test.ts` and boundary test in `tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts`. Ordinary fix within existing Apple keyed-archive boundaries; maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: Native binary plist decoding / `scanBinaryPlistNumberLiterals`. - Contribution scope fit and linked maintainer decision: not applicable (bugfix). - CLI and MCP/tool-catalog contract: Unchanged output schema. Sub-millisecond dates project as unknown dates with limitation. - Provider, bridge, target-format, or platform compatibility: Binary property lists across all platforms. - Evidence, artifact, provenance, or reconstruction contract: Preserves provenance without inventing imprecise timestamps. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: None. Expected effects: - [x] 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/artifacts/apple/PlistNumberLiterals.test.ts`, `tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts`. - Base reproduction: Binary plist fixture with date offset rewritten to `0.1005` double. - User-visible CLI/MCP output: ```json {"id":1,"kind":"scalar","class_id":null,"class_name":null,"status":"observed","value":{"$plist_type":"date","iso8601":null}} ``` with limitation: ```json "1 date value(s) are reported as { \"$plist_type\": \"date\", \"iso8601\": null } because the decoder could not represent their timestamps." ``` For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `turbo run typecheck lint` — passed clean. - `npx vitest run src/artifacts/apple/PlistNumberLiterals.test.ts tests/boundary/filesystem/keyedArchiveScalarStructure.test.ts` — 8 passed. - `npm run compile` — successful build. - `node scripts/rea.mjs inspect-keyed-archive` with sub-millisecond date fixture — verified `{ "$plist_type": "date", "iso8601": null }` and limitation. ## Compatibility, safety, and release - Breaking changes or migration steps: None. - Real Hopper/Ghidra, browser, or OS coverage: Pure Node.js / binary parser, cross-platform. - Package or release metadata impact: None. - Security, privacy, process, or containment review: No target execution or secrets involved. ## Author readiness Human owner: @Totopo27 - [ ] 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 - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:59 +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#7052
No description provided.