Engine: a forge-neutral failure type and the Gitea listers #202

Closed
opened 2026-11-11 06:32:31 +00:00 by james.maes · 0 comments
Owner

Part of #201.

Step 1 of the Gitea support epic. Library only: nothing a user of the app or the CLI sees changes yet.

Scope

  • ForgeKind (GitHub, Gitea).
  • ForgeAccessException with ForgeAccessKind (unauthorized, forbidden, rate limited, not found, unavailable): what a failed request to a forge means to a caller. GitHubAccessException derives from it and keeps its own Kind, so existing code that catches it keeps working.
  • GiteaServerUrl: turns what a user typed into the server's base address, or says why not (must be https, no user name or password in it, no query or fragment; a path is allowed for a server under a sub-path).
  • GiteaRepositoryLister and GiteaOrganizationLister (IRepositoryLister, IOrganizationLister), constructed with the server's address:
    • HttpClient, source-generated JSON, no new package;
    • the token goes into the Authorization header of each request to that server, redirects are not followed, certificate validation is the platform's;
    • paging until an empty page, with a stop when a page brings nothing new;
    • an organization's repositories; for a user account the token's own repositories or the other account's visible ones;
    • clone URLs are built from the configured server address and the repository's owner and name;
    • failures translated like the GitHub ones: the token (fix it), access (grant it, with the scope the server names), not found, rate limited, the server or the network (retry later), and "this does not answer like a Gitea server" for an address that is something else.
  • A contract test suite that both pairs of listers pass (ordering, duplicates, cancellation, empty results, the failure kinds).
  • ADR 0010 (forges beside GitHub), threat-model rows for a user-supplied server.

Not in this step

Accounts, the command line, the desktop app (steps 2 and 3 of the epic).

Part of #201. Step 1 of the Gitea support epic. Library only: nothing a user of the app or the CLI sees changes yet. ## Scope - `ForgeKind` (GitHub, Gitea). - `ForgeAccessException` with `ForgeAccessKind` (unauthorized, forbidden, rate limited, not found, unavailable): what a failed request to a forge means to a caller. `GitHubAccessException` derives from it and keeps its own `Kind`, so existing code that catches it keeps working. - `GiteaServerUrl`: turns what a user typed into the server's base address, or says why not (must be `https`, no user name or password in it, no query or fragment; a path is allowed for a server under a sub-path). - `GiteaRepositoryLister` and `GiteaOrganizationLister` (`IRepositoryLister`, `IOrganizationLister`), constructed with the server's address: - `HttpClient`, source-generated JSON, no new package; - the token goes into the `Authorization` header of each request to that server, redirects are not followed, certificate validation is the platform's; - paging until an empty page, with a stop when a page brings nothing new; - an organization's repositories; for a user account the token's own repositories or the other account's visible ones; - clone URLs are built from the configured server address and the repository's owner and name; - failures translated like the GitHub ones: the token (fix it), access (grant it, with the scope the server names), not found, rate limited, the server or the network (retry later), and "this does not answer like a Gitea server" for an address that is something else. - A contract test suite that both pairs of listers pass (ordering, duplicates, cancellation, empty results, the failure kinds). - ADR 0010 (forges beside GitHub), threat-model rows for a user-supplied server. ## Not in this step Accounts, the command line, the desktop app (steps 2 and 3 of the epic).
james.maes added the enhancement label 2026-11-11 06:32:31 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KofTwentyTwo/gclo#202