fix: respect sequence direction and effective bounds - #102
Open
DivyamTalwar wants to merge 1 commit into
Open
DivyamTalwar wants to merge 1 commit into
DivyamTalwar wants to merge 1 commit into
Conversation
Sequence diagnostics assumed ascending positive ranges and ignored cycling and owning-column lower bounds. Retain bounded SQL risk ordering, derive direction-aware position without signed overflow, and preserve semantic metadata through JSON. Safe in-range cycles are excluded; narrow owners remain guarded. Verification: actual collector fixtures pass on PostgreSQL 14, 16 and 18; affected race suites pass. The fixture uses the explicit database connection helper. The additive schema is regenerated. No production data is modified; revert this commit to restore prior calculation.
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 descending/cycling sequence item in #21 without closing the umbrella audit.
Sequence diagnostics assumed an ascending positive range, omitted negative ranges and ignored cycle semantics and owning-column lower bounds. Preserve the SQL top-50 bound and deterministic risk ordering while calculating position in the increment direction across the effective sequence/owner range. Integer subtraction precedes floating-point conversion so narrow spans near int64 extremes are not lost.
Persist optional floor, increment, cycle and column-limit metadata through the JSON contract; regenerate schema 1.3.0 and update the existing finding documentation. A cycle wholly within its usable owner range is excluded, but cycling alone does not exempt a sequence whose owning column can overflow. Legacy snapshots retain their existing stored ratio and rendering.
Verification
Verified commit:
fcc72d22401ead45d788dbf88a42c55739bbf1a1.bash scripts/gate.shpasses on committed HEAD: build, vet, pinned lint, tests and all six release-platform builds.go test -race ./...passes; formatting andgit diff --checkare clean.Scope, risk and rollback
The percentage is a position within effective bounds, not an exact number of calls remaining; PostgreSQL can expose cached sequence values. No target database writes, new dependencies or database migrations are introduced. Existing JSON field shapes remain, with optional metadata added and the schema regenerated. Other open additive-schema PRs may require version reconciliation when merged; this PR does not incorporate their changes. Revert this commit to restore the prior collector calculation and finding behavior.
Checklist