nisse-review: match repository patterns against Gitea's search
At bring-up, `dev/*` failed: listing an organization's repositories (/orgs/dev/repos) needs the read:organization token scope, which the reviewer's token doesn't have and shouldn't need. Patterns are now matched against /repos/search, which needs only the repository scope and already lists every repository the account can read. A pattern that matches nothing is logged (access.no_match). owner_repositories goes. A Gitea error at startup is now reported like a config error, not a traceback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
1 parent
86f899006a
commit
faf973be6c
8 files changed
+25
-58
No files matched your search
@@ -361,19 +361,6 @@ def test_readable_repositories_page_to_the_end() -> None:
|
||||
assert len(found) == PR_PAGE_SIZE + 2 and found[-1] == "o/r2-1"
|
||||
|
||||
|
||||
def test_owner_repositories_try_the_organization_then_the_user() -> None:
|
||||
asked: list[str] = []
|
||||
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
asked.append(request.url.path)
|
||||
if request.url.path.startswith("/api/v1/orgs/"):
|
||||
return httpx.Response(404, json={"message": "not found"})
|
||||
return httpx.Response(200, json=[{"full_name": "don/r"}])
|
||||
|
||||
assert client(handler).owner_repositories("don") == ["don/r"]
|
||||
assert asked == ["/api/v1/orgs/don/repos", "/api/v1/users/don/repos"]
|
||||
|
||||
|
||||
def test_visible_repositories_read_the_search_and_a_404_is_not_found() -> None:
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
if request.url.path.endswith("/repos/search"):
|
||||
|
||||
Reference in new issue
Block a user