Repository navigation
fix: detect standby count losses for shared names - #69
Merged
alexshapalov merged 1 commit intoSep 27, 2026
Merged
Conversation
Standby presence was reduced to a boolean per application name, hiding a loss when another same-named standby remained. Compare group counts and emit one delta per shrinking key while preserving stable-name and address-fallback behavior. Regression tests cover 2-to-1 loss, unchanged and growing groups, complete group loss, independent groups, address fallback, unknown identities and missing sections. The new regression fails on the base; affected diff and findings race tests pass. Closes pgrundev#67
This was referenced Sep 22, 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.
What and why
Closes #67.
A boolean presence map collapsed multiple standbys with the same application name into one entry. Losing one of those standbys was invisible as long as another remained. Compare counts per existing stable key and emit one disconnect delta per shrinking group, carrying the actual before/after counts.
Application names remain stable across IP changes; unnamed standbys retain the client-address fallback. This detects a group-size loss, not an unproven identity change among equal-sized groups.
Verification
Verified commit:
bbe15f07ce2e2302282a3cc89bdb20aacf82e8dc.a1e6561e366455756c45a16a46647f882b3b6a1cbecause no disconnect delta is emitted.go test -race ./internal/diff ./internal/findings: passed against the real dependencies.go test -race ./internal/diff -run 'TestReplicaGone_detectsCardinality|TestReplicaCount' -count=20: passed.bash scripts/gate.sh: passed on committed HEAD: build, vet, pinned lint, tests and all six release-target builds.go test -race ./...: passed. Formatting andgit diff --checkare clean.Scope and risk
No collector SQL, dependencies, migrations, finding IDs or JSON fields change. The existing disconnect-delta count values now reflect group size instead of always being 1 and 0; its downstream finding consumer uses the same ID and subject. Tests use synthetic collected contexts rather than a live replication topology. PostgreSQL-dependent tests self-skip locally. Reverting this commit restores the previous comparison.
Checklist