feat: Replace codegen with library #29
No reviewers
Labels
No labels
automerge
bug
dependencies
duplicate
enhancement
help wanted
invalid
migrations
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Personal/woodpecker-extension!29
Loading…
Reference in a new issue
No description provided.
Delete branch "use-my-clients"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Review Summary
This PR replaces the in-repo Forgejo API codegen pipeline (32,700-line
contracts/forgejo.json,crates/core,openapi-gen-build, theopenapi-generator-clijar + JRE in CI/dev-shell) with the pinnedmy-clientscrate from the private Forgejo registry, collapsing the workspace to a single member and re-wiringsrc/integration/forgejo_integration.rsto the new client API.Strengths
.nix/pkgs.nix,flake.nixdev shell, and.woodpecker/verify.yaml— a clear build/maintainability win. The dev shell, CI, and Nix derivations are all mutually consistent; no stale references tocrates/orcontracts/remain.create_clientfaithfully ported URL construction, token injection, and owner extraction fromcreate_configuration; the retained wiremock suite (owner-vs-author, subpath mounting, base64 config decode, empty-body 404 →Ok(None)) still exercises the real HTTP paths.serde_repr,tokio-util,chrono,reqwest) were in fact removed in this diff — that cleanup is done.h2,mime,encoding_rs,system-configuration, etc.) shrinks the build graph as a side benefit.The items already covered by earlier review (no timeout on
HttpClient::new(), private-registry/Renovate blind spot,AppError::Client(String)loosing structured error detail) remain valid but non-blocking and are not repeated here.New, non-blocking observations
map_client_error/is_not_foundnow key offApiOpError::api()and theApiError.statusfield, coupling 404 semantics tomy-clientsinternals. The retained tests only exercise 404/500 responses with empty/non-JSON bodies, so the contract thatapi()is populated from the raw HTTP status (the case that makes a missingwoodpecker.tomlstay benign) is not locked in by a JSON-bodied 404 test. Worth one added test.From<HttpError> for AppErrorhas no call site (both methods consumeApiOpError<E>); it is dead weight that will not trigger a lint since it's a trait impl.HttpClient(and thus a fresh reqwest connection pool + TLS handshake) is constructed per API call — two per extension request undertokio::try_join!. This predates the PR, but the newcreate_clientseam makes caching trivial.Verdict: approve — well-scoped refactor; the findings above are minor cleanup/verification items, not blockers.
*🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: approve
Code review findings from opencode.
Will do
@ -49,0 +65,4 @@}fn is_not_found<E: std::fmt::Debug>(error: &my_clients::forgejo::client::ApiOpError<E>) -> bool {error.api().is_some_and(|response| response.status == 404)Code review findings from opencode.
@ -49,0 +57,4 @@format!("https://{machine}/api/v1")};Ok((HttpClient::new()@ -49,0 +64,4 @@))}fn is_not_found<E: std::fmt::Debug>(error: &my_clients::forgejo::client::ApiOpError<E>) -> bool {@ -49,0 +68,4 @@matches!(error.api(), Some(ApiError { status: 404, .. }))}impl From<my_clients::forgejo::client::HttpError> for AppError {