Skip to content

feat(atlas): ingest gate record + state machine (follow-on 1 of #6057) #7709

Closed

Description

@dezren39

Follow-on 1 of the staging-shard ingest gate design (#6057). Design record: doc/2026-11-08T13-45-00Z_design_atlas_staging_shard_ingest_gate/.

Depends on the staging-tier registry from #5669. Parent: #6018.

What this implements

The gate's record and state machine — the audit trail the gate exists to produce, and the fail-closed rule that makes every later stage checkable.

  1. Gate record — one durable row per batch in the internal registry DB: batch (staging unit) id, stage reached, per-stage verdict (pass / fail / skip + reason), reason codes, row counts, content hashes, and the publish manifest id when published. Written at the sensitivity of its batch: counts, classes, row ids and locations only — never content (design §8).
  2. State machine — open → closing → gated → published | quarantined, with the transition set owned by the aggregator (atlas staging tier: versioned schema, registry, aggregator with merge-on-close promotion into three-level core #5669). A batch in quarantined retains its staging DB (archived, not deleted).
  3. Fail-closed rule — a batch with no verdict for a stage has not passed it. Absence of a record is never success; only the write stage (empty batch) and publish (zero survivors) may record skip, and each requires a recorded reason. skip never advances a snapshot id.
  4. Three-strikes quarantine bound — a batch quarantined on the same reason code three times escalates to needs-review and stops auto-retrying (design §5.5).
  5. Resume-at-failing-stage retry — a retried batch re-enters at the stage that failed, except write_invalid / write_bypass, which require the producer to fix and re-write (design §5.3).

Done when

  • A deliberately failing batch, fed through the aggregator, lands a gate record naming the failing stage and reason codes, is quarantined, publishes nothing, and is not retried past three strikes.
  • A batch with a missing stage verdict is rejected as not-passed (a test asserts the fail-closed rule directly).
  • The gate record for a secret-tier batch contains no content (a test asserts the redaction).

Out of scope

The five stage checks themselves (follow-ons 2–5 of #6057), and the staging schema/provisioning (#5669).

Acceptance criteria

  • One durable gate-record row exists per batch: batch id, stage reached, per-stage verdict (pass/fail/skip + reason), reason codes, row counts, content hashes, and the publish manifest id when published — counts/classes/ids/locations only, never content.
  • The state machine implements exactly open → closing → gated → published | quarantined; a quarantined batch retains its staging DB (archived, not deleted).
  • Fail-closed is enforced: a stage with no recorded verdict has not passed, and absence of a record is never treated as success (covered by a test).
  • Transition ownership follows the atlas staging tier: versioned schema, registry, aggregator with merge-on-close promotion into three-level core #5669 staging-tier registry, as the design specifies.

Activity

  1. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    area/infraInfrastructure, deployment, and operations
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor
  3. added a commit that references this issue on Nov 8, 2026
  4. added
    priority/normalOrdinary priority (the default)
    effort/mMedium: expected under 1 day of work
    source/humanFiled directly by a human
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 8, 2026
  5. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: design #6057 (staging-shard ingest gate; the PR #7707 design record landed this morning), dependency #5669 (staging-tier registry), parent #6018.
    Live check: follow-on 1 of a design landed today; no implementation PR exists yet.
    Notes / risks: this is the audit substrate every later gate stage reads — keep the record schema minimal and durable rather than clever. The fail-closed rule is the acceptance heart; a permissive default would silently void the gate.
    Suggested approach: record + state machine only, per the issue's scope; later follow-ons add the stage checks that write verdicts into this record.

    — fleet monitor (repo-fleet-monitor), 2026-11-08 08:12 CST run: acceptance criteria appended to the body, labels normalized, meta/enriched applied.

  6. added this to the Atlas program milestone on Nov 12, 2026
  7. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Agent: triage-step; state: triaged\nwork kind: task/small-fix\npriority: priority/normal (from drew-priorities-brief.md)\neffort: effort/m\nfirst step: implement ingest gate record state machine per #6057\nacceptance: gate records are created, transitioned, and blocked on invalid state

  8. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Dropped-thread catcher — launch repair (2026-11-12):

    The Action outbox processor's 10:04 CST run reported both prepared enqueues for this issue blocked on broken preparation: the packet file in /tmp is not a valid repo-task/v1 packet (payload nested under body with string-typed fields, no payload object), so validate/enqueue fail with "packet.payload: required object". No queue task was enqueued, and this issue carried no queue label at check time (gh read-back 2026-11-12T16:31Z, OPEN, updated 15:41Z).

    The processor cannot compose a substitute packet, and no other owner was named. Routing this issue through the standard feeder instead: adding queue/queued so the repo-health code pilot feeder enqueues a fresh, valid packet for it. The invalid /tmp packet should be disregarded.

  9. removed their assignment
    on Nov 20, 2026
  10. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · lane GL (archer) claiming the reconciliation slice for #7709.

    Premise check (fresh, 2026-11-23): the implementation already landed on main via PR #11995 (merged 2026-11-19, commit 0e0ffb631b4) — pkgs/atlas-search/crates/atlas-core/src/gate.rs + tests/gate.rs + schema/gate_records_v1.sql — but this issue was never closed. Dependency #5669 is closed; design #6057 is closed.

    Plan: run the gate test suite on current main in a fresh worktree; if every acceptance criterion verifies, close this issue with the evidence. If anything fails, I will fix it in a PR instead.

  11. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · lane GL (archer) — verification complete, closing as completed.

    The implementation for this issue landed on main via PR #11995 (merged 2026-11-19, commit 0e0ffb631b4): pkgs/atlas-search/crates/atlas-core/src/gate.rs, pkgs/atlas-search/schema/gate_records_v1.sql, pkgs/atlas-search/crates/atlas-core/tests/gate.rs. The issue was never closed; this pass verified it against current main instead of re-implementing it.

    Verification (laptop worktree off origin/main ec2712729ba, nix develop in pkgs/atlas-search):

    • cargo test -p atlas-core --test gate — 12 passed / 0 failed, including the three "Done when" criteria by name:
      • a_failing_batch_quarantines_publishes_nothing_and_stops_after_three_strikes — failing batch lands a record naming the stage + reason codes, is quarantined, publishes nothing, stops after three strikes.
      • a_missing_stage_verdict_is_not_a_pass — the fail-closed rule, asserted directly.
      • a_secret_tier_record_holds_no_content — the redaction rule for secret-tier batches.
      • Plus the state-machine, skip, resume-at-failing-stage, and registry round-trip tests, and the property test published_implies_every_stage_passed.
    • cargo test -p atlas-core (full package) — 353 passed / 0 failed across lib, all integration suites, and doc-tests.

    Every acceptance criterion is met on current main: one durable gate-record row per batch (counts/classes/ids/locations only, never content), the exact open → closing → gated → published | quarantined machine with quarantine retaining the staging DB, fail-closed enforced by test, and transition ownership in the #5669 registry (Registry::save_gate_record). Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/infraInfrastructure, deployment, and operationseffort/mMedium: expected under 1 day of workepic/atlas-programReprioritization program epic (2026-11-12)kind/enhancementmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)queue/queuedHas a queued queue tasksource/humanFiled directly by a humanstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions