Skip to content

fix: coerce MirrorReviewSummary review counts to int#1560

Closed
e11734937-beep wants to merge 4 commits into
entrius:testfrom
e11734937-beep:fix/mirror-review-summary-int
Closed

fix: coerce MirrorReviewSummary review counts to int#1560
e11734937-beep wants to merge 4 commits into
entrius:testfrom
e11734937-beep:fix/mirror-review-summary-int

Conversation

@e11734937-beep

Copy link
Copy Markdown

Summary

MirrorReviewSummary.from_dict is the only model parser that doesn't coerce its
numeric fields with int() — every other field does (additions, deletions,
commits_count, pr_number, …). maintainer_changes_requested_count feeds the
review-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

  • Bug fix

Testing

Added test_counts_coerced_to_int; uv run pytest tests/utils/test_mirror_models.py passes.

cc @anderdc @LandynDev

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label Jun 29, 2026
@anderdc anderdc added refactor Code restructuring without behavior change and removed bug Something isn't working labels Jul 2, 2026
@anderdc

anderdc commented Jul 2, 2026

Copy link
Copy Markdown
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.

@anderdc anderdc closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants