Repository navigation
docs(atlas): staging-shard ingest gate design (#6057) - #7707
Conversation
Records the write -> classify -> dedup -> provenance-check -> publish gate contracts: per-stage pass/fail semantics, quarantine and retry handling, and publish atomicity against fan-out search via the snapshot id. Design only; implementation split into follow-ons in section 9. Refs #6057
|
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 24 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. |
Codex Review Summary: ❌ FailedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df472316be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - **Batch visibility is per-snapshot.** A batch's rows become visible to a | ||
| fan-out when, and only when, the snapshot id that includes them is | ||
| published. The aggregator writes the batch, writes the manifest, then | ||
| bumps the snapshot id — in that order, so a reader that resolves the old | ||
| id sees the old set and a reader that resolves the new id sees the whole |
There was a problem hiding this comment.
Specify a reader-enforced visibility barrier for publish
For a batch spanning multiple ≤500-row transactions, delaying the snapshot-id bump does not hide rows already committed to live shards. In the inspected Atlas implementation, ShardSet::snapshot_id() hashes discovery-time shard names, tiers and counts (shards/mod.rs:518–532), while fan-out queries live transports (shards/scan.rs:87–92) using SQL without a snapshot or published-batch predicate (filters.rs:309–311). An old-id reader can therefore see the first part of a batch while later transactions are pending, or after publication fails, contradicting §6.1 and §6.4. Specify an immutable-generation cutover or a reader-enforced publication barrier rather than relying on the identifier update for atomic visibility.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed by the current head (§6.3, commit 3d3f996, which post-dates the commit this comment reviewed): publish no longer relies on delaying a snapshot-id bump. §6.3 specifies a reader-enforced publication barrier — hidden immutable candidate artifacts in prepare, one per-tier catalog commit as the single visibility point, and a read protocol that pins the active catalog generation at query start and scans only committed manifests (§5.2 states the same catalog-authority rule, and §6.3 explicitly forbids weakening the invariant to "bump the hash after the writes"). No further change in 304d4f5 for this finding.
| Re-running a quarantined batch re-enters at the **failing stage**, not at | ||
| write, unless the failure was `write_invalid` or `write_bypass` (in which | ||
| case the producer must fix and re-write). Because content is | ||
| content-addressed (#3125), a retry that re-lands identical bytes is a no-op | ||
| for those bytes; a retry that lands changed bytes is a new version under |
There was a problem hiding this comment.
Invalidate prior verdicts when retry inputs change
When a batch fails provenance-check or publish, this contract resumes at that stage while explicitly allowing the retry to land changed bytes. Those bytes would inherit classification and dedup verdicts obtained for different content, allowing newly introduced secret material to retain an earlier internal classification or bypass duplicate checks. Content addressing prevents overwrites but does not make prior verdicts valid for new inputs. Require retries to preserve the validated batch and stage-input identities, or restart the affected upstream stages when those inputs change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 304d4f5 (§5.3): every stage verdict is now bound to its stage-input identity (batch id + the content hashes of that stage's inputs, recorded in the gate record). A retry re-enters at the failing stage only when every upstream stage's input identity is unchanged; if any input bytes changed, the retry re-enters at the earliest stage whose input changed and every downstream verdict is invalidated and recomputed — changed bytes never inherit a classification or dedup verdict obtained for different content.
| | classify | every row has one of three levels at acceptable confidence | never | `classify_unresolved` | | ||
| | dedup | every row has a disposition; no deletion required | never | `dedup_undispositioned` | | ||
| | provenance-check | every mark parses, content resolves, attestation present, occurrences spanned | never | `provenance_unresolvable` | | ||
| | publish | count + hash identity, batch bound, manifest, snapshot bump, tier split | batch had zero survivors after dedup suppression | `publish_partial` | |
There was a problem hiding this comment.
Preserve occurrence writes when dedup suppresses every chunk
If promotion policy suppresses every near-duplicate in a batch, this condition permits skipping publish even though §3.3 explicitly requires suppressed near-duplicates to leave their occurrences recorded. Publish is also the only stage allowed to write live shards (§3.5), so skipping it leaves no stage that can persist those occurrence updates, reproducing the dropped-occurrence defect this design intends to prevent. Allow skipping only when no live mutations remain, rather than when no chunks survive suppression; occurrence-only batches still need publication.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 304d4f5 (§4): the publish skip condition is now "zero survivors after dedup suppression and no occurrence additions pending", in both the table and the paragraph below it. The paragraph spells out the rule: an occurrence-only tier unit is not skippable — publish is the only stage that writes the visible occurrence set (§3.5), so skipping it would drop the occurrence records §3.3 requires; occurrence-only units publish and their catalog commit advances the snapshot id.
Require hidden candidate artifacts and one per-tier catalog commit before search visibility. A post-write shard hash alone cannot hide rows inserted into an active shard. Clarify that indefinite DO cache hits can be stale even while fresh fan-out reads are snapshot-atomic.
|
Atomicity clarification (follow-up commit 3d3f996): the initial draft described manifest/snapshot ordering but did not make active-shard writes invisible during bounded writes. That is insufficient: a reader could discover rows before the final hash bump. The revised §3.5/§6 now requires immutable per-tier candidate shards and occurrence overlays, hidden from the committed manifest set, followed by a single per-tier catalog commit as the visibility point; fan-out pins that committed manifest generation once at query start. Snapshot ids derive from committed manifests, not live mutable counts. Cross-tier publication is explicitly independent, with per-tier snapshot ids. The indefinite DO cache may still return a coherent stale result until #6805/#6666 provide freshness; the doc no longer claims cache freshness or atomicity. |
…e-only units still publish (#6057)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Shepherd outcome — landed (task 17300, lane any-c, 2026-11-16) PR #7707 MERGED, merge sha Dispositions of the three Codex P2 findings (each answered on its review thread):
The design was not landed elsewhere (the doc was absent on main) and #6057 remains open for its §9 implementation follow-ons. |
Design record for #6057 (Follow-up 38, Cluster 7; parent #6018).
What this adds
doc/2026-11-08T13-45-00Z_design_atlas_staging_shard_ingest_gate/— the gate design the issue asks for:(verdict, reason_codes, counts, artifacts).skipmeans (never a pass, never bumps a snapshot id) and the fail-closed rule that no verdict = not passed.Packet staleness handled
The packet names #5755 as an open atomicity constraint. #5755 is CLOSED (2026-11-07); its surface moved to #6662/#6664/#6665/#6666 and successor #6788 (+ eviction follow-up #6805). §6 addresses atomicity against those successors, not the closed issue.
Sibling decisions consumed, not re-decided
#6026 (versioning — landed design), #3125 (keep-all, occurrences), #5733 (dedup findings are data), #5669 (staging tier, ≤500-row bound, merge-on-close). The three obligations this note adds that those designs did not state (per-row tier split at publish, snapshot-id-in-manifest, three-strikes quarantine bound) are called out explicitly in §7 as gate requirements to reflect back, not as changes to their decisions.
Follow-ons
§9 splits implementation into six follow-ons. The gate-record state machine is tracked as #7709 against #5669; remaining follow-ons are filed against their siblings as those designs land.
Design only — no implementation.
Refs #6057
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.