refactor(session-ingest): prepare direct ingest path#4472
Open
pandemicsyn wants to merge 2 commits into
Open
Conversation
jeanduplessis
approved these changes
Jul 9, 2026
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
This preparation PR extracts the parser/validation, metadata projection, staging cleanup, and tombstone handling that will be needed by the follow-up ,while keeping the existing R2 + queue ingest path in place. Basically, breeaking out all the bits that ill need/reuse.
PR 2 will add a gated direct path for the conservative common case: requests with a known body size under 4 MiB that fully validate, contain at most 128 valid items, and require no R2 item offloading will be written to SessionIngestDO in one synchronous RPC. A 200 will then mean the items are immediately available to exports and cloud-agent restores. Missing/oversized/multi-chunk payloads and direct RPC failures will continue through the existing R2 + queue path.
PR2 will ship with the bypass behind a user allowlist and percentage gate with path/fallback observability so that we can slowly roll it out, without changing the existing metadata or lifecycle consistency model.
ingestedAtordering.Verification
Visual Changes
N/A
Reviewer Notes
ingestedAtafter the R2 upload, matching existing conflict ordering. PR 2 will explicitly pass request-arrival time for direct fallback.