Repository navigation
3.x.x: gate the accepted-revision-work paging rule like the other criticals - #496
Merged
Merged
Conversation
…ticals Refs #493. PrismAcceptedRevisionWorkPendingCritical was the only paging rule with for 0s, no_data_state Alerting and no conjunction with the snapshot gauges, the scrape or connected miners. A frontend with no connected miners has no mining.notify write that can close its wait, so it paged 307 s after every pool block and never cleared; a stale or unavailable snapshot, a failed scrape and a missing series paged too. The rule now requires a known age (>= 0), an available and fresh metrics snapshot, a scraped target and at least one authorized miner on the reporting frontend, with a one-minute dwell and no-data and evaluation errors treated as OK. The dwell only suppresses single-scrape gate flaps on a gauge that is monotonic during a stall and stays well under the five-minute hold that delayed #413; a prolonged known stall with miners connected still pages. The warning keeps zero dwell and no-data Alerting, so missing or unknown measurements stay visible. HELP for the histogram and pending gauge now states that every frontend samples every block from its own observation; metric names and types are unchanged, and no landing, coordinator or ledger state changes. Scenarios: thirteen existing landing cases gain the gate series, three now expect no critical sample where the guard drops -1 or absent data, and eleven new cases cover each gate, the dwell, a miner flap under the dwell and a stall outlasting it. The deployment test asserts the rendered paging rule's for, noDataState and execErrState. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ence plainly Refs #493. Review follow-up on #496. The paging rule no longer conjoins the metrics snapshot gauges: the pending gauge is a live overlay rendered on every scrape, and a database-pool stall that also stalls the health publisher must still page. The known-age, authorized-miner and scraped-target terms and the one-minute dwell stay. The miner count is a snapshot family, so while the snapshot is stale the gate uses a count a few refresh intervals old; that rare false page is accepted over a missed stall. The two snapshot fixtures now expect the page. The rule basis, the regenerated migration table and deployment patch, and the metrics document now say what happens when every miner leaves a frontend during a stall: this page resolves and nothing else pages for that frontend, because the coverage rules cannot fire with zero authorized clients and the connected-clients rule is a cluster-wide non-paging warning; only the pending warning keeps reporting the age. The miner-flap fixture is now discriminating: a one-sample flap at 1m15s expects no alert while a new no-flap control at the same evaluation expects firing. The deployment test asserts, for every native page=true rule, a non-zero dwell, OK no-data and error states, and an availability conjunction, with the one-minute check separate. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Refs #493. Resolves the scenario fixture as a by-name union (the #463 advisory-lock scenarios plus this branch's landing cases) and regenerates the deployment patch. The native paging-rule assertion now also covers the #463 advisory-lock critical, which already satisfies it; the exact set check becomes a subset check so new paging rules are covered rather than listed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Member
Author
Review ledger (final)Head reviewed: Lanes
Findings and dispositions
Left for follow-up (not in this PR): #493 points 1 (lost-race pending semantics) and 5 (timeout-counter attribution after a lost COMMIT reply), with the seams proposed in the PR description; points 4, 6, 7 are the accepted #458 contract. |
This was referenced Sep 22, 2026
djh58
added a commit
that referenced
this pull request
Sep 23, 2026
) (#500) * 3.x.x: attribute build deadlines to known revision-work waits only (#493) After a lost or cancelled settlement COMMIT reply, the accepting frontend's landing tracking is unknown for that block (`unknown_revision`), yet the block still counted toward `pending_count`. `revision_work_build` derived `Build.pending` from that raw count (or saturation), so every later initial-job deadline, including admission and database waits unrelated to the block, incremented `revision_work_build_timeouts_total` and stamped `degraded` on the unknown wait (#493 point 5). `Build.pending` now comes from the known waits only: open identities with neither a lost settlement reply nor an unsettled orphan verdict, and no lost ordering history, which is exactly the set the pending gauge reports. While only unknown tracking remains, a deadline hit is an ordinary `job_delivery_failures_total` event, the tracking-unknown gauge keeps reporting the unknown state and the pending gauge stays -1; nothing is counted as a revision-work failure or as zero. A known wait beside unknown tracking still attributes its deadline as before. Mining, delivery, fences and the #493/#496 paging rules are unchanged; HELP, inventory and the rule basis state the known-wait rule. Tests: three landing unit tests (lost settlement reply with a recovering first confirmation, known wait beside unknown tracking, unsettled orphan verdict, untrackable identity and lost ordering); one PostgreSQL-gated test that loses a real COMMIT reply through the wire proxy and then holds a real Stratum initial-job build at admission until its deadline; two promtool scenarios for the corrected series (unknown-only with no timeout, unknown beside a known 308 s stall with a real timeout). Co-Authored-By: Claude Fable 5.1 <[email protected]> * 3.x.x: attribute a build deadline to a wait that recovered mid-build (#493) Review finding F1 on #500: `Build.pending` is a snapshot at the build's start, so a wait that was unknown then (lost settlement reply) and recovered through a proven first confirmation while the build was in flight was not attributed when the deadline fired, and its later delivery read `published`; the base counted that deadline. `deadline_hit` now also attributes when a known wait accepted before the build is open at the deadline instant; the degraded stamp for open waits accepted before the build is unchanged. Unknown-only tracking at both instants still counts nothing. The reviewer's discriminating test is adopted as a regression test; the inventory prose and metadata state the two attribution instants. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This was referenced Sep 24, 2026
djh58
added a commit
that referenced
this pull request
Sep 24, 2026
… the unknown warning (#493) (#503) * 3.x.x: keep a lost race out of the revision-work paging age and dwell the unknown warning (#493) Points 1 and 7 of #493. Telemetry and alert semantics only: no mining, submit, landing, payout or deployment change. Point 1. A null `submitblock` reply opened a known delivery wait whether or not the node held the block on its active chain, so a lost tip race grew `accepted_block_revision_work_pending_seconds` until its orphan proof (`PRISM_CANDIDATE_ORPHAN_CONFIRMATIONS` competitor confirmations plus the reconciliation backoff) and paged the #496-gated critical whenever that took longer than 307 s. The offering frontend now records such an acceptance as unlanded: outside the known pending age and build-deadline attribution, on its own gauge `accepted_block_unlanded_seconds` (age of the oldest one; zero when none; -1 under bounded-tracking saturation, never a silent zero). The post-offer landing observation, a reconcile proof or a settlement observation lands it on its original acceptance clock, so the histogram still measures from the definitive acceptance; a committed proven orphan closes it without a sample. A tombstone never reopens and a landed block is never downgraded. `PrismAcceptedBlockUnlanded` warns (never pages) at 30 minutes for 3 m. The same lost race also paged `PrismBlockCandidateOldestPendingCritical` (60 s, 3 m) from the database collector on every coordinator, because a `reconciliation` row is unfinished. The collector now reads, in the same snapshot, `block_candidate_oldest_unacknowledged_seconds`: the oldest unfinished row without a definitive node reply (`pending`, `offer_reserved`, and offered rows whose one `submitblock` outcome is `unknown`). The paging rule reads that gauge, so a found block not reaching the node pages exactly as before and an unknown outcome keeps paging because receipt is unproven, while a node-accepted lost race, a rejected block or a failing landing age only the all-unfinished gauge: the 15 s warning still reports them and the new non-paging `PrismBlockCandidateStuck` warns at 30 minutes for 3 m. All three candidate gauges read -1 together when the collector fails. Point 7. `PrismAcceptedRevisionWorkPending` had `for: 0s` and included the tracking-unknown gauge and the -1 age, so any failed template refresh (one 2 s poll interval of unknown) warned. The unknown terms move to `PrismAcceptedRevisionWorkTrackingUnknown` with a two-minute dwell and no-data Alerting; the pending warning keeps its documented no-dwell budget, missing-series and scrape-down terms unchanged. Review fixes (independent review: one blocker, two major, three minor). A definitive node rejection keeps paging through the unacknowledged age; only a side-chain reply (a lost race to a first-arriving block) is excluded. A row adopted on the node's own active-chain evidence is not unacknowledged. A won block whose audit landing keeps failing is reported by `block_candidate_oldest_landing_failed_seconds`, warned at 60 s for 3 m and paged at 307 s for 1 m, the floor and dwell the revision-work critical applies when the landing fails after the frontend's observation, so the class is never silent whichever step refused. The candidate paging rule falls back to the all-unfinished age on a target that does not export the new series, so a mixed-version rollout never loses the page. The -1 HELP wording and the backoff prose are corrected. The reason and reply vocabulary is shared as constants between the coordinator and the collector. Tests: three landing unit tests (lost race never a known wait, landing on the acceptance clock through every active-chain path, saturation as -1); four PostgreSQL-gated tests in `landing_metrics.rs` (a real lost race through the fake node, retried at five and six competitor confirmations, with an active block as the positive control; an offer without a definitive reply beside a node-accepted lost race in the collector's census; a `bad-cb-payee` rejection beside an `inconclusive` reply; a landing transaction aborted through the wire proxy and landed on the retry); the census, contract and inventory updates (56 families); 26 promtool scenarios (one failed refresh under and after the dwell, persistent unknown under and after the dwell, saturation beside a known age, the unchanged budget warning, a lost race that proves its orphan inside the threshold, a stuck unlanded row under and after the dwell, saturated unlanded tracking, a lost race that never pages either critical, a pre-offer or unknown-outcome row that still pages, a rejected block that pages, a stuck reconciliation row that warns, a failing landing under and past both dwells and one landed on its first retry, the mixed-version fallback, collector failure); the deployment patch test asserts the four new warnings dwell and never page, that the landing-failed critical is a gated one-minute paging rule, and that the candidate paging rule reads the unacknowledged age with the fallback. Co-Authored-By: Claude Fable 5.1 <[email protected]> * 3.x.x: keep the gated-test list sorted (#493) The expected-list checker requires byte order; the new `candidate_collector_keeps_an_acknowledged_lost_race_out_of_the_paging_age` entry was inserted before the `cancelled_*` lines. Moved after them. Co-Authored-By: Claude Fable 5.1 <[email protected]> * 3.x.x: read the landing-failed age from the missing pool-block row, not the error text (#493) Deep-review findings on #503, all verified against the code. The landing-failed gauge was discriminated only by the `last_error` prefix that `settle_offered_inner` writes for a refused landing. Every other writer of the same reconciliation row (a node or database error inside the landing, which surfaces as "post-offer processing failed", a refused operator recovery, a failed lease renewal) overwrote it, so the age read zero and both landing-failed alerts resolved while nothing had landed, and a landing that kept failing on a hard error paged nowhere. The collector now also counts every reconciliation row with no `qbit_pool_blocks` row: the landing transaction is that row's only writer, so its absence is the durable fact, and the prefix only adds a landed row that no longer authenticates. The age is measured from the offer reservation, the start of the post-offer lifecycle and the instant the frontend's acceptance clock starts, so pre-offer retry backoff never counts toward the 307 s critical. Structure: `Acceptance::known()` is the one predicate behind `known_waits` and `resolve`; `accept_block` takes an `Observation` (unlanded, active, confirmed) instead of two bools; `adoption_evidence` is the single writer of the adoption reply; the side-chain reply list is bound as `text[]`; the census query is one legible statement with named predicates; the candidate paging fallback is `unacknowledged or on(...) oldest_pending` (the `unless` was redundant); the promtool script checks every rule as an alert rule; the metadata file keeps its hand-authored formatting. Tests: the landing-failure gated test now also fails a retry transiently (a tip change under the observation overwrites `last_error`) and asserts the age holds and never predates the offer. Co-Authored-By: Claude Fable 5.1 <[email protected]> * 3.x.x: prove the errored post-offer path is reported and keep deadlines off unlanded blocks (#493) Workstream A review of #503 (three findings). M1: an accepted block whose post-offer processing keeps erroring before the landing (a database error in the landed-audit check or the rebuild, or a node or readiness error in the candidate observation) carries the "post-offer processing failed" reason. Every such error returns before the landing transaction, which is the only writer of the pool-block row, so the previous commit's no-pool-block predicate already reports it. A gated test now proves it on real rows: the observation fails on every attempt, the landing-failed age is positive, keeps growing across a failing retry, never predates the offer reservation, nothing is unacknowledged and the frontend identity stays unlanded; restoring the node lands the audit and the age returns to zero. L1: a build deadline attributed through another known wait no longer marks an unlanded block degraded: it has no revision work yet, so a deadline that fired before it landed cannot have delayed its delivery. Unit test added. L2: the HELP, metadata and contract prose now state the one deliberate exception to "an unlanded acceptance is a known state": while the terminal probe that carries peer orphan evidence fails, an unlanded-only frontend reads tracking unknown and a -1 pending age, and the unlanded gauge keeps the age. Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
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.
Refs #493 (points 2, 3 and 8; point 1 mitigated, not resolved). Rule surface, fixtures and HELP only: no landing, coordinator or ledger change, no deployment.
What paged falsely
PrismAcceptedRevisionWorkPendingCriticalwas the only paging rule indocs/prism-native-alert-rules.jsonwithfor: 0s,no_data_state: Alertingand noand on(job, instance, network)conjunction with the snapshot gauges, the scrape or connected miners. Reproduced with promtool against the unmodified rule (six scenarios, all firing): no connected miners, stale snapshot, unavailable snapshot, scrape down with a retained value, no gating series at all, and a single 307 s sample. A frontend with no connected miners has nomining.notifywrite that can close its wait (stratum.rs:944is the only closer), so it paged 307 s after every pool block and never cleared.Change
(pending >= bool 307) and (pending >= 0) and (snapshot available and not stale) and (authorized_clients > 0) and (up == 1),for: 1m,no_data_state/exec_err_state: OK. Same shape asPrismSemanticWorkCoverageLossCritical, plus the explicitupterm so the scrape-down case is testable.docs/prism-native-metrics.md.accepted_block_to_revision_work_secondsandaccepted_block_revision_work_pending_secondsnow says every frontend samples every block from its own observation (sum across instances counts one block once per frontend). Names and types unchanged; inventory regenerated.landing tracking unknown,landing missing gaugeandlanding scrape downnow expect no critical sample;landing increasing age at 307sexpects the alert pending, not firing; 11 new scenarios cover each gate, the dwell boundaries, a miner flap under the dwell and a stall outlasting it.scripts/test_prism_alert_deployment.pyasserts the rendered paging rule'sfor,noDataStateandexecErrState.Verification (local, this branch)
scripts/test_prism_alert_promql.pywith the CI-pinned promtool 3.14.0: 31 expressions, 103 scenarios, 198 expression assertions, 138 alert assertions passed.scripts/generate_prism_alerts.py --check --snapshot …andscripts/generate_prism_metrics.py --check: clean; deployment patch regenerated (new specification SHA-256).scripts/test_prism_alert_deployment.py --snapshot …against the frozen reviewed snapshot: patch applies, 10 Jinja gate combinations, 78 original / 65 proposed rules, rendered paging rulefor 1m,noDataState/execErrStateOK.inventory.rsinvokes both generators and checks HELP against the inventory;stratum.rschecks rendered HELP). The host is below the 10 GiB free-disk floor for a cargo build, so CI is the evidence for those.Left out on purpose (#493 remainder)
coordinator.rs:2031-2035opens the wait on any accepted reply;tests/landing_metrics.rs:106-107asserts it). The same row already pages throughPrismBlockCandidateOldestPendingCritical(reconciliationis inUNFINISHED_SQL). Proposed seam: anunlandedflag inlanding.rsset at acceptance and cleared at active proof or first confirmation, excluded byage()but keeping the acceptance clock for the histogram; one integration test intests/landing_metrics.rsasserting the pending gauge stays 0 for areconciliationrow and the histogram still samples from acceptance once it lands.revision_work_buildreports pending while only unknown state remains, so every later initial-job timeout increments the counter. Proposed seam:Build.pendingcomputed from known pending count only, with a unit test insrc/metrics/landing/tests.rsthat drops a settlement, times out a build and asserts the counter stays 0.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.