feat(storage): add bounded ledger archive reconstruction reader - #4972
Merged
Conversation
Read complete target-scoped evidence through a lease-bound indexed query, then reconstruct only applied v1 archive sources using the existing projection reducer and frozen encoding. Keep production writers and Artifact fallback unchanged. Generated-by: Codex
Astro-Han
reviewed
Sep 7, 2026
Astro-Han
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the reader-first implementation. Re-reviewed e6ec11f33d1a6dc559c6483c09a2034c77826847 with independent design, storage and reconstruction reviews. One API error-classification finding is inline, independently reproduced against the existing lease-revocation test. The production ArchiveRead route remains outside this slice.
AI disclosure: this review was performed by Codex agents; the coordinating agent checked the finding and reran the counterexample. This is not an independent human review.
中文摘要
已对当前提交重新进行设计、存储和重建路径交叉审查。发现一项 reader API 的错误分类问题,主审已通过现有 lease 撤销测试独立复现,详情见行内评论。生产 ArchiveRead 切换仍属于后续范围。本次为 Codex 自动化审查,不冒充人工验收。
Keep lease and database availability failures separate from JSON and record decoding failures. Assert exact revocation reasons and runtime error mapping. Generated-by: Codex
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
Refs #4071. Reader-first follow-up after #4963 and #4965.
Tool Result archive bytes are derived from durable model projections. Before changing writers, this PR adds a read-only reconstruction path that proves when an existing v1 archive can be recovered from the ledger alone.
Verification
Full runtime suite is not green locally: 3299 passed, 13 skipped, 2 failed in unchanged Responses reasoning coverage:
The second reproduces when run alone. No Responses/provider implementation is changed here. Full Host/Desktop suites, Windows/Linux execution and large-workspace latency/RSS benchmarks were not run.
Migration and Rollout
Core-execution schema advances from 8 to 9 to create the partial expression index over existing transition records. This is a rebuildable index, not another history authority. JSON-invalid rows are indexed as unscoped instead of crashing index extraction.
Index construction has a one-time schema-upgrade cost. This PR does not claim index creation itself is bounded or that #4027 startup acceptance has passed. Normal reads use indexed target lookup and bounded metadata/body retrieval.
The reader is intentionally conservative: missing durable projections, incomplete/corrupt evidence and evidence exceeding the internal 64-transition/2-MiB limits are refused. The evidence byte limit includes the containing RuntimeEvent, so a small projection inside a very large raw-result event may also be refused. Existing Artifact reads remain unchanged.
The next writer slice must introduce its own new ledger-reference protocol and copy/remap contract using this reader foundation. This PR only reconstructs current v1 archive identities; it does not emit new durable refs or claim all historical archives are reconstructible. No old payload can be reclaimed merely because this reader exists.
AI use
Tool(s) and scope: Codex inspected the ledger and storage contracts, implemented reader/index/test changes, ran local checks and prepared this PR. Commit carries Generated-by: Codex.
Checklist
Does this PR entail a change in behavior?