Repository navigation
Conversation
…ne's own private ones /repos/?q= has the rule of /sources/?q= and /collections/?q=: the private repositories of the requester and their organizations, by current membership, in the results, the count and the facets. A HEAD request for a search that finds nothing answers 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUWvM4HRKZktm5NSVk
…#1119 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaZ4qUWvM4HRKZktm5NSVk
|
Reviews: a Codex pass, a check of the commit after it and a simplification review, recorded on OpenConceptLab/ocl_online#747. No P0 or P1 of this change is open. One gap in the tests was filled: a person's own collection, and the facets for it. Lint and the tests of repositories, search access and membership pass. CI runs the rest. |
snyaggarwal
left a comment
There was a problem hiding this comment.
Approve. It's small and right. /repos/?q= now adds the same owner and member criteria as /sources/ and /collections/. Its hits still go through get_viewable_hits, because get_search_checks_access was already true for /repos/. So the database decides what's listed, by current membership. Results, num_found and the owner facet follow the same rule. The tests cover members, former members, outsiders, staff and signed-out users, for an org's and a person's source and collection.
Merge order: last of the three, after #1119 and #1120. It merges cleanly onto today's master (3c2e9c1) and onto both. Its HEAD num_found fix is the same line #1119 makes, so there's nothing to resolve whichever goes first.
The points left open from the Codex pass, recorded on OpenConceptLab/ocl_online#747, all predate this PR and are accepted there. They are allVersions counting public releases of private repositories (OpenConceptLab/ocl_online#876), a reused username, and organization names that differ only in case. I have nothing new to add.
What changes
Searching all repositories (
GET /repos/?q=) finds your own private repositories and those of your organizations, as/sources/?q=and/collections/?q=do. TBv3's Repositories search uses it.Who is a member is read from the database at each search, so someone who leaves an organization stops finding its private repositories at once. The same rule decides the results, the count and the facets.
A
HEADrequest for a repository search that finds nothing answersnum_found: 0. It used to fail.How
get_public_criteriaadds what owners and members can see for the repository search too. No reindexing is needed.Tests
SearchMembershipAccessTestruns its searches against/repos/as well: a source and a collection, of an organization and of a person, for members, former members, others, staff, and people who aren't signed in.Refs OpenConceptLab/ocl_issues#3097.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AaZ4qUWvM4HRKZktm5NSVk