Stop reading a rounded sixth decimal place as a decomposition bug - #545
Merged
Conversation
`the_stages_account_for_no_more_than_the_total` compared a sum of `round6`'d stage seconds against a separately `round6`'d total with an exact `<=`. Each part can round up by half a microsecond while the whole rounds down by as much, so the sum legitimately exceeds the total without anything having been charged twice -- and the test called that a bug. It failed on PR #543 with `0.030157 + 0.030099` against a total of `0.060256`, a dependency bump that touches no Rust at all. The comparison now allows the precision the document is written to: one half-microsecond per stage plus one for the total. It moved into `stages_within_total` so both sides of the boundary get a deterministic test -- the numbers from the failing run on one side, a stage counted twice on the other -- rather than waiting on a sleep to land badly.
Reviewer's GuideThe PR makes stage-total validation tolerant of the document’s independent six-decimal rounding while preserving detection of real stage overcounting, and adds deterministic tests for both boundaries using the exact regression values. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
the_stages_account_for_no_more_than_the_totalsummed each stage'sround6'dseconds and compared that against a separately
round6'd total with an exact<=. Every number in the document is rounded on its own, so each part can roundup by half a microsecond while the whole rounds down by as much — the sum
then exceeds the total by arithmetic, with nothing charged twice, and the test
reported it as a decomposition bug.
It fired on #543 — Bump docker/login-action from 3 to 4,
a dependency bump that touches no Rust:
What changed
The comparison now allows the precision the document is actually written to —
one half-microsecond per stage plus one for the total — rather than demanding
exactness the reporting never promised. Binary addition error is orders of
magnitude below that. A stage genuinely charged twice overshoots by a sleep, so
the check still catches what it exists for.
The comparison moved into
stages_within_totalso both sides of that boundaryget a deterministic test: the exact numbers from the failing run on one side, a
stage counted twice on the other. The flake is now a pinned regression instead
of a comment explaining a tolerance.
🤖 Generated with Claude Code
Summary by Sourcery
Make stage timing validation tolerate independent rounding while continuing to flag actual over-counting.
Bug Fixes:
Enhancements:
Tests: