Repository navigation
feat(event-drain): C2-S2 drain runner + Muse detector (#17077) - #17103
Merged
Merged
Conversation
scripts/fleet/event-drain/drain_events.py
scripts/fleet/event-drain/test_drain_events.py
scripts/fleet/event-drain/README.md
scripts/fleet/event-drain/detector/event-drain-detect.sh
scripts/fleet/event-drain/detector/event-drain.json
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This was referenced Nov 30, 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.
C2-S2 (#17077): event drain runner + Muse detector
Slice C2-S2 of #9570, from the merged design record
doc/2026-11-26T07-52-58Z_design_c2_event_pipeline/(PR #15450), §9/§4 D2/D4/D5/§6. Hard edge C2-S1 verified landed on main firsthand before this work (PR #15925 merged for #15834:derive.ts/drain.ts/thresholds.ts+ 5-minute age cron).What lands
scripts/fleet/event-drain/drain_events.py— the drain runner. For each due kind (drain-due:<kind>set) it readseventsrows pastdrain:<kind>up to the high water read at drain start, ensures a task minds each item viafleet queue enqueue, advances the persisted cursor after each fully handled row, and clearsdrain-due:<kind>only after the cursor reaches the high water (D4 step 4). A failed drain leaves the signal set and resumes from the last fully handled row. It makes no claim, merges nothing, closes nothing (D5). One report per drain: counts by kind, tasks created/found, quota current + projected (the projected line says so when C4 has no prediction yet).repo-health:v1:triage:<repo>:issue:<n>,repo-health:v1:pr:<repo>:pr:<n>) — the no-twin-tasks property D5 names; the design'sgh:<repo>#<n>shorthand predates the importer's canonical form. Kinds with no importer equivalent use the design's keys (ci:<repo>:<run_id>,mention:<comment_id>).test_drain_events.py— the §6 drain-runner oracles, each test naming its oracle: cursor stops at the start high water when rows arrive mid-drain; failure mid-drain leaves the signal set + cursor at the last fully handled row; a replay creates no second task (fake enqueue sees the same dedupe key). Plus signal-clearing, importer key-form, log-only-kind, observe-mode, quota-line, and thresholds drift guards.detector/event-drain-detect.sh+detector/event-drain.json— the Muse detector andevent-drainhook definition, following the enrolment wake pattern (~/hooks/scripts/+~/hooks/definitions/): polls thedrain-due:*keys and wakes Muse naming the due kinds; unconfigured/unreachable store is a silent inconclusive poll, never a false "drained".README.md— the pieces, the run modes, and the wake path.Verification
python3 -m unittest test_drain_events -v— 9 passed, 1 skipped (the thresholds drift guard skips outside a full repo checkout; it runs in CI wherepkgs/github-ci/worker/src/thresholds.tsis present). Fixture CLI runs (observe +--run) exercised end to end against a fixture store: correct cursor movement, signal clearing, dedupe keys, and quota lines.Refs #17077, #9570. Authored by lane 2352-F (bravo SUSTAIN) via the Git-API contents route; full-diff self-review before merge per standing rule (CI is not a gate).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.