feat: Replace codegen with my-clients #30
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.
Reference
Personal/woodpecker-plugins!30
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?
Now let me examine the actual repository files to verify the current state of the changed code
{
"summary": "# Review Summary\n\nThis PR replaces the in-tree Forgejo OpenAPI codegen (
build.rs+contracts/forgejo.json+ JRE/openapi-generator-cli) with the pre-generatedmy-clientscrate from the private Forgejo registry, and the migration is carried through consistently: verify pipeline (JRE install removed), flake devShell, justfilecodegenrecipe, Nix plugin build,core/Cargo.tomlfeature graph, and all consumers inmain.rs. The four issues from the earlier round are resolved in this diff — a 30 s timeout protects the raw diff download, the tokenexpectpanic became aPluginError, the re-export is narrowed topub use my_clients::forgejo as forgejo_client, and the dead workspace deps (chrono,serde_repr,tokio-util,openapi-gen-build) are gone fromCargo.toml/Cargo.lock/AGENTS.md. Both token paths are now guarded (diff download viaauthorization_headerand the primary client viavalidate_forgejo_tokeninsidebuild_forgejo_client), and the wiremock integration tests still assert theAuthorization: token <t>header plus the forbiddenX-FORGEJO-OTP/Sudo/sudoheaders on the new.diffendpoint. Theextra_lines_count: Nonefield is carried into the inline-review struct, and pagination /HttpClient.clone()-in-spawned-tasks semantics are unchanged.\n\nThe remaining observations below are minor and non-blocking. None block merge.","verdict": "comment",
"comments": [
{
"file": "Cargo.toml",
"line": 29,
"severity": "style",
"message": "
my-clients = { version = \"0.1.0\", ... }uses caret semantics (any 0.1.x), yet AGENTS.md now documents that generated API signature changes require bumpingmy-clientsand its consumers together. A futurecargo updatecould silently resolve a 0.1.x whose generated method order/signatures differ from the positional calls inmain.rs, producing a confusing compile-time break later. Consider an exact pin (version = \"=0.1.0\") to keep the pinned crate and its consumers in lockstep."},
{
"file": "core/src/forgejo.rs",
"line": 123,
"severity": "style",
"message": "
authorization_headerre-validates and re-parses the exactHeaderValuethatvalidate_forgejo_tokenalready built and discarded, andresolve_forgejo_token+build_forgejo_clientvalidate the same token once more on the same run — so a token may be validated up to three times. A single helper returningResult<HeaderValue, PluginError>(used bybuild_forgejo_clientanddownload_forgejo_diff) would remove the duplication and keep one source of truth for the token guard."},
{
"file": "plugins/forgejo-opencode-review/src/main.rs",
"line": 84,
"severity": "style",
"message": "The migration trades the generated client's named-parameter structs (e.g.
RepoGetPullRequestFilesParams) for opaque positional arguments like(owner, repo, index, skip_to, whitespace, page, limit). Type-compatible argument-order mistakes now compile silently instead of failing at compile time, and the wiremock tests only pin thepagequery param (skip_to/whitespaceare never exercised), so the swapped-order risk in the new thin wrapper is unverified. Since themy-clientssignatures aren't inspectable here, consider a short unit test against the wrapper or at least a comment documenting the argument order of the my-clients methods."}
]
}
*🤖 Review by opencode (opencode/deepseek-v4-flash-free) — verdict: comment
Code review findings from opencode.
@ -77,1 +77,4 @@let base_path = format!("{}/api/v1", base_url.trim_end_matches('/'));HttpClient::new().with_base_url(base_path).with_header("Authorization", format!("token {token}"))@ -78,0 +92,4 @@pr_number: i64,) -> Result<String, PluginError> {let url = format!("{}/api/v1/repos/{owner}/{repo}/pulls/{pr_number}.diff",@ -82,2 +103,3 @@);let client = reqwest::Client::builder()reqwest::Client::builder().timeout(Duration::from_secs(30))ad1db4f2bd6d4da0b8aa