#442: Omit GraphQL after argument when cursor is nil#444
Merged
yegor256 merged 2 commits intoMay 1, 2026
Conversation
…ssert it does not include 'after: ""' when cursor is nil
…views and pull_request_reviews when cursor is nil
|
@bibonix Hey! Nice work on that contribution – you just scored the full +24 points! 🎉 Your code hit the sweet spot with good size and solid review feedback, which is exactly how our bonus system rewards quality work. Keep them coming and you'll see those points add up fast! Your running score is +180, so don't forget to check your Zerocracy account for the latest updates. |
VasilevNStas
added a commit
to VasilevNStas/fbe
that referenced
this pull request
Jun 3, 2026
…sibling methods
total_releases_published always interpolated after: "#{cursor}"
in the GraphQL query, even when cursor was nil. This produced
after: "" on the first page, which is an invalid pagination
argument — the same bug fixed for pull_requests_with_reviews
and pull_request_reviews in PR zerocracy#444.
Applied the same pattern used by total_commits_pushed (line 410),
pull_requests_with_reviews (line 293), and pull_request_reviews
(line 356): conditionally build the after argument only when
cursor is not nil.
yegor256
pushed a commit
that referenced
this pull request
Jun 13, 2026
* fix: make total_releases_published conditional after cursor, same as sibling methods
total_releases_published always interpolated after: "#{cursor}"
in the GraphQL query, even when cursor was nil. This produced
after: "" on the first page, which is an invalid pagination
argument — the same bug fixed for pull_requests_with_reviews
and pull_request_reviews in PR #444.
Applied the same pattern used by total_commits_pushed (line 410),
pull_requests_with_reviews (line 293), and pull_request_reviews
(line 356): conditionally build the after argument only when
cursor is not nil.
* test: add regression test for nil cursor in total_releases_published
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.
@yegor256 this PR fixes #442.
The bug. Both
pull_requests_with_reviews(line 294) andpull_request_reviews(line 356) inlib/fbe/github_graph.rbinterpolated thecursorvalue directly into the GraphQL query asafter: "#{cursor}". When the caller passedcursor: nil(for the first page), Ruby producedafter: ""— an empty string, which is not a valid opaque cursor and is rejected/misinterpreted by the GitHub GraphQL API.The fix. I mirrored the pattern already used correctly in
total_commits_pushed(line 405): build anafter = "after: "#{cursor}", " unless cursor.nil?snippet and interpolate it into the query. Whencursorisnil,afterisniland theafter:argument is omitted from the query entirely. Whencursoris a real cursor, the argument is rendered as before. This required a one-line change inside each of the two methods.Tests. I added two tests in
test/fbe/test_github_graph.rbthat capture the GraphQL query string sent throughFbe::Graph#queryand assert it does not containafter: ""whencursorisnil. Both tests fail onmasterand pass with this change. The full test suite (bundle exec rake test) andrubocopboth pass locally and in CI.Ready for merge.