Repository navigation
atlas-core: ingest gate record and state machine - #11995
Merged
Merged
Conversation
Adds the staging-shard ingest gate's per-batch record (design doc/2026-11-08T13-45-00Z_design_atlas_staging_shard_ingest_gate, follow-on 1, plus the quarantine and retry rules of follow-on 6): - One durable gate_records row per batch in the staging registry DB, from its own versioned DDL artifact. - The batch state machine is exactly open -> closing -> gated -> published | quarantined, plus quarantined -> gated on retry. - Fail-closed: stages are recorded strictly in order, a stage with no verdict has not passed, and only write (empty batch) and publish (zero survivors, no occurrences) may skip, with an enumerated reason. - A failure quarantines the batch. Three quarantines on one reason code set needs_review and stop automatic retries. - A retry resumes at the failing stage, at write for write_invalid or write_bypass, or at the earliest stage whose input hash changed. Every later verdict is discarded. - A record can't hold content: reason codes are a closed enum, ids match an identifier grammar, and hashes must be SHA-256 hex. Refs #7709 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Before: the ingest gate design had no record or state machine in code, so no stage check could record a verdict, and nothing enforced that a missing verdict means "not passed".
After:
atlas_core::gateholds the per-batch gate record and its state machine, saved as one row per batch in the staging registry DB.needs_reviewand stop automatic retries.write_invalidandwrite_bypass, or at the earliest stage whose input hash changed. Every later verdict is discarded.How:
src/gate.rsandschema/gate_records_v1.sql(its own versioned DDL, created on first use, besidestaging_units).Registrygainssave_gate_recordandload_gate_record, and a crate-privateconn().tests/gate.rshas 11 behaviour tests, including the issue's three "done when" cases, plus a proptest. The proptest checks that a published batch passed every stage, that refused steps leave the record unchanged, that verdicts stay a contiguous prefix of the stage order, and that the strike bound holds.cargo test -p atlas-core --test gate --test stage --test aggregatepasses. Clippy finds nothing in the new files. The newer toolchain in my environment flags older lints elsewhere in atlas-core, and this PR doesn't touch them.Not in this PR: calling the gate from the aggregator. Each stage check is a later follow-on (#6057 follow-ons 2 to 5), and each one records through
GateRecord::record.Refs #7709
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.