← Back to Pull requests

fix(apple): observe keyed-archive dates when the offset table reaches the trailer #7166

Open
unknown opened this pull request with 485 lines diff across 6 files
View on GitHub
unknown unknown commented on Oct 25, 2026 19:29 UTC
Author

Summary

inspect_keyed_archive reported a sub-millisecond NSDate as an exact timestamp when the binary plist's offset table runs into the trailer, a layout the keyed-archive preflight admits and plist@5 decodes. Expected output is the documented unknown date: iso8601: null plus the unknown-date limitation.

Change

  • scanBinaryPlistScalars bounds offset-table reads by end of file instead of the trailer, matching decoder bounds. Strict callers are unchanged.

  • Reconciled with #7820: its append-only rewrite already fixes the truncated-trailer crash Greptile found, so my earlier size helper is dropped.

  • Codex follow-up: the rewrite now copies the whole source buffer, including the old trailer, before appending clones, the new table and a new trailer. Before, an object stored in the trailer's spare bytes after an overlapping table was overwritten, and plist@5 threw Unsupported int size: 256. The offset width and both budget estimates now count the extra trailer.

  • Second Codex follow-up: a date is now observed only when it ends before both the offset table and the trailer. Before, a date that started just before the trailer could carry the trailer's width bytes in its payload, so rewriting it in place made decoding fail with Unsupported int size: 0. That layout now keeps the generic incomplete-metadata disclosure.
  • Evidence

  • Three regressions in KeyedArchiveReader.test.ts cover the table running into the trailer: a sub-millisecond date, an overlapping date (Greptile's case), and an object in the trailer's spare bytes (Codex's case). All three fail on current main and pass here.

  • src/artifacts/apple/ and src/native/parsers/: 367 tests pass. keyedArchivePostTable.test.ts from #7820 passes. Typecheck, lint and format pass.

  • Not run: the full CI suite. Tested on Linux x64 with Node 26.12.1. The build's metadata check needs the pinned Node 24, so I compiled with npm run compile.
  • Scope: a static parsing fix within existing boundaries, with no CLI/MCP contract, package or metadata change.

    Author readiness

    <!-- The human owner completes these declarations before requesting review.
    The PR author is the owner by default. A different owner must explicitly accept
    ownership on this PR.
    AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA.
    Draft PRs may leave them unchecked. These declarations record initial readiness
    when opening the PR for review; later pushes do not require a new human sign-off.
    Keep the description and validation evidence current as the work changes.
    See CONTRIBUTING.md#pull-request-ownership-and-readiness. -->

    Human owner: @devreddy1015

  • 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

    <!-- Draft PRs may leave pending items unchecked. Resolve material scope and
    authority questions before integration. -->

  • 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.
  • Diff: 485 lines (+363 / -122) across 6 files Reviewer: devreddy1015 Review duration: 42908m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 485 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.370
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7166"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.3% (MEDIUM) · Higher = larger blast radius
    47.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.2% · Safe to merge
    25.2%
    Repository