Repository navigation
fix: preserve critical replica lag when warnings are raised - #65
Merged
alexshapalov merged 1 commit intoSep 22, 2026
Merged
alexshapalov merged 1 commit into
alexshapalov merged 1 commit into
Conversation
The configurable warning gate ran before the fixed critical comparison, making critical lag unreachable when the warning threshold exceeded 300 seconds. Evaluate both boundaries independently while preserving missing-measurement and idle-WAL guards. Update the finding documentation to distinguish warning suppression from critical detection. Table-driven tests cover boundary values and multiple replicas. Refs pgrundev#21; only the remaining replica-lag threshold item is addressed.
Open
4 tasks done
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.
What and why
Addresses the remaining
replica_lag_warn_secondsdefect reported in #21. This does not close that umbrella audit.A warning threshold above 300 seconds made the fixed critical threshold unreachable: with a configured warning of 600 seconds, a measured replay lag of 450 seconds produced no finding. Apply the configurable warning and fixed critical boundaries independently, preserving the existing WAL-flow and missing-measurement guards.
The finding documentation now states explicitly that increasing the warning threshold suppresses subcritical warnings, not the fixed critical boundary.
Verification
Verified commit:
d49754f720c481cc3d6d10b3a1f640e4dfe55f95.a1e6561e366455756c45a16a46647f882b3b6a1cbecause raised warnings hide critical lag.go test -race ./internal/findings -run 'TestReplicaLagTime_' -count=20: passed.bash scripts/gate.sh: passed on the committed HEAD, including pinned lint and all six release-target builds.go test -race ./...: passed; formatting andgit diff --checkare clean.Risk and rollback
Users with warning thresholds above the documented critical threshold will now see the critical finding that was previously hidden. Default thresholds, nil/idle handling and the JSON schema are unchanged. Revert this commit to restore prior behavior; no migrations or dependency changes are required.
Checklist