fix: coerce MirrorReviewSummary review counts to int#1560
Closed
e11734937-beep wants to merge 4 commits into
Closed
fix: coerce MirrorReviewSummary review counts to int#1560e11734937-beep wants to merge 4 commits into
e11734937-beep wants to merge 4 commits into
Conversation
Collaborator
|
These counts are serialized mirror-side via json_build_object, which emits JSON numbers — the validator always parses them as int, so a string-typed count can't reach here and the int() coercion is dead code. The sibling fields that coerce (additions/deletions/commits_count) are raw DB columns where the type can vary; these aren't. Closing. |
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.
Summary
MirrorReviewSummary.from_dictis the only model parser that doesn't coerce itsnumeric fields with
int()— every other field does (additions,deletions,commits_count,pr_number, …).maintainer_changes_requested_countfeeds thereview-quality multiplier and is written to the analytics DB, so a string-typed
count from the mirror would silently break comparisons/arithmetic.
This wraps the four counts in
int()to match the established convention.Behaviour-preserving for well-formed payloads — a robustness/parity fix, not
a scoring-policy change (no weights/multipliers/thresholds touched).
Type of Change
Testing
Added
test_counts_coerced_to_int;uv run pytest tests/utils/test_mirror_models.pypasses.cc @anderdc @LandynDev