fix: normalize github_id to str, prevent false cancel votes on truncated timelines#1416
Open
zeroknowledge0x wants to merge 1 commit into
Open
Conversation
…nt false cancel votes Fixes entrius#1413: Normalize solver_github_id from GraphQL's databaseId (int) to str at the source (_solver_from_closed_event) so dict lookups against registered_miners keys always match. Also harden the dict comprehension in forward.py and inspections.py with explicit str() normalization. Fixes entrius#1411: When _select_current_close_event returns None but the issue has a closedAt and completed close events exist in the timeline (none matching closedAt), return None (lookup failure sentinel) instead of (None, None). This prevents forward.py from voting cancel on a legitimately solved issue whose authoritative close event fell outside the truncated timeline window. Changes: - _solver_from_closed_event: return str(dbId) instead of int - find_solver_from_closure_event: update return type to tuple[Optional[str], ...] - forward.py: str() normalize registered_miners keys - inspections.py: str() normalize github_id_to_uids keys - Update tests to expect str solver IDs
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
Normalizes
github_id/solver_github_idtostrat all boundaries to prevent int/str dict key mismatches, and returns a lookup-failure sentinel when a closed issue's authoritative close event is missing from the (possibly truncated) timeline.Fixes #1413
Fixes #1411
Changes
Bug #1413 — int/str github_id mismatch
Root cause:
_solver_from_closed_event()returnsdatabaseIddirectly from GraphQL asint, whileregistered_minerskeys come fromget_github_identity()→str(user_id). Even thoughforward.pyline 132 wraps the lookup instr(), the inconsistency is fragile and breaks duplicate detection ininspections.py.Fix:
github_api_tools._solver_from_closed_event— normalizedatabaseIdtostrat the source; update return type fromtuple[Optional[int], ...]totuple[Optional[str], ...]forward.py—str()normalizeregistered_minersdict keysinspections.py—str()normalizegithub_id_to_uidsdict keysBug #1411 — false cancel votes on truncated timelines
Root cause:
_ISSUE_CLOSURE_QUERYfetches only the last 20CLOSED_EVENTnodes. On high-churn issues the current close event can fall outside that window._select_current_close_eventthen returnsNone,find_solver_from_closure_eventreturns(None, None)(not a failure sentinel), andforward.pyvotes cancel on a legitimately solved bounty.Fix: In
find_solver_from_closure_event, whenclose_event is NonebutclosedAtis set and completed close events exist in the timeline (meaning the authoritative event was truncated), returnNone(lookup failure) instead of(None, None). This causesforward.pyto skip the issue rather than cancel it.Testing
tests/utils/test_github_api_tools.pypass (updated 6 assertions from int to str)tests/validator/test_issue_competitions_forward.pypasstests/validator/pass