PagedSearchIterable returns a subset of the searched results and has non-deterministic behaviour.
Describe the bug
Searching for repositories and getting the results via the PagedSearchIterable returns a subset of the results with duplicate GHRepository objects and has non-deterministic behavior.
To Reproduce The problem is reproducible with the following JUnit tests.
matchingRepos = github.searchRepositories()
.user("DanySK")
.fork(GHFork.PARENT_AND_FORKS)
.q("Student-Project-OOP")
.list();
@Test
public void testDuplicates() throws IOException {
assertEquals(matchingRepos.toList().size(), matchingRepos.toSet().size());
}
@Test
public void testDeterminism() throws IOException {
var set1 = matchingRepos.toSet();
var set2 = matchingRepos.toSet();
assertEquals(set1, set2);
}
Expected behavior
The list of GHRepository returned by PagedSearchIterable should contains all the expected results.
Desktop:
- OS: [MacOS]
- Browser [firefox]
- Version [1.308]
The results returned from GitHub are non-deterministic and a subset of possible results. This is by-design behavior documented by GitHub itself. Sorry.
Ok, but in this case the isIncomplete() method of PagedSearchIterable should not return true? Instead, it returns false.
Perhaps. You'll need to debug the returned JSON. Perhaps try using the GitHub API via curl and see what comes back.
You could use this library's test facilities to run your commands and record the results. If you submitted a PR showing the failing behavior that would be a huge help.