Conversation
Upgrade go-io to v0.4.1 and go-core to v0.8.0-alpha.1 to resolve indirect dependency on forge.lthn.ai/core/go-log (old module path). Co-Authored-By: Virgil <virgil@lethean.io>
5.4-mini pass. Build + tests clean. - pagination.go: refined cursor/next handling (+39 lines) - client.go, config.go: small alignment with RFC - ax_stringer_test, pagination_test, client_test: updated assertions Co-Authored-By: Virgil <virgil@lethean.io>
…s, pagination - 10 service files: add RFC-named methods + aliases (repos, issues, pulls, orgs, users, releases, milestones, labels, webhooks, contents) - types/list_options_compat.go: new ListIssueOption + ListPullRequestsOption shapes - types/hook.go: CreateHookOption.Config accepts generic map input - types/misc.go: MergePullRequestOption.MergeStyle compat field - users.go + pulls.go: honor PageSize alongside legacy Limit alias Verified: GOWORK=off go test ./... passes Co-Authored-By: Virgil <virgil@lethean.io>
…e compat
- commits.go: ListCommits / IterCommits / GetCommit RFC-facing methods
- issues.go + pulls.go: honor RFC-style Page / PageSize / Limit on
types.ListIssueOption + types.ListPullRequestsOption
- types/list_options_compat.go: add pagination fields + new ListCommitsOption
- types/content.go + misc.go: Content RFC compat alias
- types/content_compat.go: marshal Content back to Forgejo content payload so
RFC-shaped CreateFileOptions{Content: ...} works as written
- compat_helpers.go: shared compat glue
- Regression tests across commits_extra/issues_extra/pulls_extra/contents
Verified: go test ./... passes
Co-Authored-By: Virgil <virgil@lethean.io>
… services - 10 services: Repos, Issues, Pulls, Commits, Branches, Orgs, Webhooks, Releases, Milestones, Labels — each gains List*Page methods accepting ListOptions and returning *PagedResult[T] - Existing List* methods unchanged (still fetch all pages) - service_pagination_extra_test.go: regression for new single-page entrypoints Verified: GOWORK=off go test ./... passes Co-Authored-By: Virgil <virgil@lethean.io>
…ndpoint - users.go: numeric ID lookup now routes through Forgejo's supported /api/v1/users/search?uid= and returns a 404-style APIError when no match. Previously silently hit the username endpoint with the ID as the username. - users_test.go: success + not-found coverage - pulls_test.go: regression for MergePullRequestOption.MergeStyle → Do Verified: GOWORK=off go test ./... passes Co-Authored-By: Virgil <virgil@lethean.io>
- types/issue.go + pr.go: CreateIssueOption.Labels + EditPullRequestOption.Labels accept any — either []int64 IDs or []string names (RFC shape) - types/label_compat.go: helper for label normalisation + direct decode test coverage - cmd/forgegen/parser.go: codegen preserves the same compatibility rule going forward - issues_extra_test.go + pulls_extra_test.go: RFC-shaped service-call coverage Verified: GOWORK=off go test ./... passes Co-Authored-By: Virgil <virgil@lethean.io>
…ion JSON compat - client.go: multipart uploads send Accept: application/json and update rate-limit state from response headers on both success and API error paths - types/misc_compat.go: JSON compat for MergePullRequestOption — MergeStyle alias maps to Forgejo Do field during decode (works outside PullService too) - Coverage: client_test for multipart + rate limits, misc_compat_test for MergeStyle → Do mapping Verified: GOWORK=off go test ./... passes Co-Authored-By: Virgil <virgil@lethean.io>
client.go uses goccy/go-json as a faster drop-in for encoding/json. Added `// Note:` annotation documenting that no core.* equivalent exists for the JSON-decoder performance profile. Closes tasks.lthn.sh/view.php?id=740 Co-authored-by: Codex <noreply@openai.com>
Added `// Note:` annotations on bytes (body buffering), io (streaming upload), mime/multipart (file upload writer), net/http (HTTP client primitives). All intrinsic to the HTTP forge client layer — no core.* equivalents. Closes tasks.lthn.sh/view.php?id=739 Co-authored-by: Codex <noreply@openai.com>
- go.mod line 1: module dappco.re/go/core/forge → dappco.re/go/forge - go.mod require: dappco.re/go/core/io v0.4.1 → dappco.re/go/io v0.4.1 - 56 *.go files: self-imports + core/io imports rewritten Pre-existing go.work still references old layout — unrelated gap, separate ticket. Closes tasks.lthn.sh/view.php?id=738 Co-authored-by: Codex <noreply@openai.com>
- Bump dappco.re/go/io to v0.8.0-alpha.1 (canonical target across dappco.re/go/* namespace per 2026-04-24 release-gate sweep) - Add tests/cli/forge/Taskfile.yaml + main.go AX-10 driver per RFC-CORE-008-AGENT-EXPERIENCE.md §10 - Driver skips cleanly when FORGE_URL/FORGE_TOKEN env vars unset; lists core repos via NewForge + Repos.ListOrgRepos when credentials present Closes tasks.lthn.sh/view.php?id=356 Co-Authored-By: Codex <noreply@openai.com> Co-Authored-By: Athena <athena@lthn.ai>
- Removed bytes entirely - JSON/text request bodies → core.NewReader - Multipart bytes.Buffer → coreio.NewMemoryMedium - Response body reads → core.ReadAll - mime/multipart, net/url, strconv, residual goio retained with // Note: AX-6 intrinsic annotations Build + race tests PASS. Co-authored-by: Codex <noreply@openai.com> Closes tasks.lthn.sh/view.php?id=354
- Removed strconv / net/url from affected service files - Centralised int/bool parsing + query encoding in helpers.go (with AX-6 comments for missing core equivalents) - io.Reader retained only in upload APIs (issues.go, releases.go) as structural API body types Build + race tests PASS (with cache + modfile workaround). Co-authored-by: Codex <noreply@openai.com> Closes tasks.lthn.sh/view.php?id=355
Removed net/url + strconv. Replaced with core.URLParse, core.Itoa, core.FormatInt, core.Atoi, core.ParseInt. Annotated retained context, mime/multipart, net/http, aliased io as AX-6 structural. Also fixed stale coreio import path to dappco.re/go/io. Closes tasks.lthn.sh/view.php?id=739 Co-authored-by: Codex <noreply@openai.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (78)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Pull request overview
This dev→main cadence PR rolls up accumulated changes to the Go Forgejo client, primarily rehoming the module path, expanding pagination/page-based APIs across services, and adding RFC-compatibility shims for several request/option types.
Changes:
- Renamed module/import path from
dappco.re/go/core/forge→dappco.re/go/forgeand updated service/test imports accordingly. - Added/standardized pagination support (
PageSize), new*Pageservice methods, and expanded tests for paging behavior. - Added RFC-compatibility helpers for labels/content/merge-style and introduced a local query builder + client HTTP/auth/rate-limit handling adjustments.
Reviewed changes
Copilot reviewed 78 out of 79 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| wiki_test.go | Update types import path to new module. |
| wiki.go | Update types import path to new module. |
| webhooks_test.go | Update types import path to new module. |
| webhooks_extra_test.go | Update types import path to new module. |
| webhooks.go | Add page-based hook listing + repo wrapper methods; update types import. |
| users_test.go | Update types import; add tests for GetUserByID. |
| users_extra_test.go | Update types import path to new module. |
| users.go | Add GetUserByID/GetUserByUsername; update search paging/query construction; update types import. |
| types/pr.go | Make PR Labels RFC-compatible (any). |
| types/misc_compat_test.go | Add JSON compat tests for merge style (Do vs MergeStyle). |
| types/misc_compat.go | Add MergePullRequestOption JSON marshal/unmarshal compatibility. |
| types/misc.go | Add RFC-compat fields (ChangeFileOperation.Content, MergePullRequestOption.MergeStyle). |
| types/list_options_compat.go | Add RFC-style list option compatibility types. |
| types/label_compat_test.go | Add tests for label-name/id compatibility decoding. |
| types/label_compat.go | Add JSON unmarshal normalization for label refs across options. |
| types/issue.go | Make issue Labels RFC-compatible (any). |
| types/hook.go | Loosen hook Config field type to any; update formatting. |
| types/content_compat.go | Add content alias JSON compatibility for file/content types. |
| types/content.go | Add RFC-compat Content alias fields to content option structs. |
| tests/cli/forge/main.go | Add minimal CLI driver for artifact validation. |
| tests/cli/forge/Taskfile.yaml | Add task runner config for CLI artifact driver validation. |
| teams_test.go | Update types import path to new module. |
| teams.go | Update types import path to new module. |
| service_pagination_extra_test.go | Add cross-service page API tests for common endpoints. |
| repos_test.go | Update types import path to new module. |
| repos.go | Add repo CRUD helpers + org/user page listing; migrate query building to helper; update types import. |
| releases_test.go | Update types import path to new module. |
| releases_extra_test.go | Update types import path to new module. |
| releases.go | Add ListReleasesPage + GetRelease alias; update query encoding; update types import. |
| pulls_test.go | Update types import; add merge-style compatibility test for request body. |
| pulls_extra_test.go | Update types import; add label-name compat create test + compat pagination list test. |
| pulls.go | Add page-based listing + multiple compat aliases; refactor query building; widen filter API to ...any. |
| pagination_test.go | Update tests to use PageSize. |
| pagination.go | Introduce PageSize (with Limit compatibility) and update paging helpers/defaults. |
| packages_test.go | Update types import path to new module. |
| packages.go | Update types import path to new module. |
| orgs_test.go | Update types import path to new module. |
| orgs_extra_test.go | Update types import path to new module. |
| orgs.go | Add org CRUD helpers + page-based org/team/member listing; update types import. |
| notifications_test.go | Update types import path to new module. |
| notifications.go | Switch query encoding to helper; update header parsing; update types import. |
| misc_test.go | Update types import path to new module. |
| misc.go | Update types import path to new module. |
| milestones_test.go | Update types import path to new module. |
| milestones.go | Add milestone page/list/iter aliases + CRUD aliases; update types import. |
| labels_test.go | Update types import path to new module. |
| labels.go | Add label paging and repo/general aliases; update types import. |
| issues_test.go | Update types import path to new module. |
| issues_extra_test.go | Update types import; add label-name compat create test + compat pagination list test. |
| issues.go | Add issue CRUD helpers + page/list/iter repo aliases; add issue list sort; widen filter API to ...any; update query encoding. |
| helpers.go | Add queryBuilder/appendQuery utilities + int/bool helpers. |
| go.sum | Update dependency checksums for new module/dependency set. |
| go.mod | Rename module to dappco.re/go/forge and update core/io dependencies. |
| forge_test.go | Update types import path to new module. |
| contents_test.go | Update types import; add CreateFile content alias compatibility test. |
| contents.go | Switch query encoding to helper; add GetContents alias; update types import. |
| config_test.go | Update core io import path. |
| config.go | Update core io import path; tweak missing-config-file detection. |
| compat_helpers.go | Add helper to derive ListOptions from compat page fields. |
| commits_test.go | Update types import path to new module. |
| commits_extra_test.go | Update types import; add commits list/get tests. |
| commits.go | Add commits page/list/iter RFC compat; update bool query encoding; update types import. |
| cmd/forgegen/parser_test.go | Add generator test asserting labels become any for RFC compat. |
| cmd/forgegen/parser.go | Apply RFC-compat overrides during type extraction; update core io import. |
| cmd/forgegen/main_test.go | Update core io import path. |
| cmd/forgegen/generator_test.go | Update core io import path. |
| cmd/forgegen/generator.go | Update core io import path. |
| client_test.go | Update auth header expectation and add multipart rate-limit tests. |
| client.go | Refactor request body readers; add multipart body buffering via coreio; centralize auth header; add rate-limit parsing helpers; switch to queryBuilder for multipart query. |
| branches_test.go | Update types import path to new module. |
| branches_extra_test.go | Update types import path to new module. |
| branches.go | Add branch page listing; update types import. |
| ax_stringer_test.go | Update list options string expectations to page_size. |
| admin_test.go | Update types import path to new module. |
| admin.go | Update types import path to new module. |
| activitypub_test.go | Update types import path to new module. |
| activitypub.go | Update types import path to new module. |
| actions_test.go | Update types import path to new module. |
| actions.go | Switch query encoding to helper; update types import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return core.E("Client.PostMultipart", "forge: close multipart writer", err) | ||
| } | ||
| if err := bodyWriter.Close(); err != nil { | ||
| bodyWriterOpen = false |
There was a problem hiding this comment.
postMultipartJSON sets bodyWriterOpen = false before returning the error from bodyWriter.Close(). That disables the deferred close, so if Close() fails the writer can be left open (leaking the underlying medium/stream). Only flip the flag after a successful close (or always attempt the deferred close on error).
| bodyWriterOpen = false |
| func (c *Client) authorizationHeader() string { | ||
| if c == nil || c.token == "" { | ||
| return "" | ||
| } | ||
| return "Bearer " + c.token | ||
| } |
There was a problem hiding this comment.
The client now always uses Authorization: Bearer <token> via authorizationHeader(), but internal documentation still describes Authorization: token <token>. Either update the docs and/or consider supporting both schemes (or making the scheme configurable) to avoid breaking existing Forgejo/Gitea deployments that only accept the token prefix.
| // ListPullRequestsPage returns a single page of pull requests in a repository. | ||
| func (s *PullService) ListPullRequestsPage(ctx context.Context, owner, repo string, opts ListOptions, filters ...any) (*PagedResult[types.PullRequest], error) { | ||
| return s.listPage(ctx, owner, repo, opts, filters...) | ||
| } | ||
|
|
||
| // ListPullRequests returns all pull requests in a repository. | ||
| func (s *PullService) ListPullRequests(ctx context.Context, owner, repo string, filters ...PullListOptions) ([]types.PullRequest, error) { | ||
| func (s *PullService) ListPullRequests(ctx context.Context, owner, repo string, filters ...any) ([]types.PullRequest, error) { | ||
| if pageOpts, ok := compatPullListPageOptions(filters...); ok { | ||
| page, err := s.listPage(ctx, owner, repo, pageOpts, filters...) |
There was a problem hiding this comment.
Changing the public API from filters ...PullListOptions to filters ...any removes compile-time safety and can silently ignore unsupported filter types at runtime. Consider introducing a small interface (e.g., something with an addQuery(*queryBuilder) method) and accepting ...PullFilter, or providing explicit overloads for the RFC-compat types, so callers get type-checked filters.
| // ListIssuesPage returns a single page of issues in a repository. | ||
| func (s *IssueService) ListIssuesPage(ctx context.Context, owner, repo string, opts ListOptions, filters ...any) (*PagedResult[types.Issue], error) { | ||
| path := ResolvePath("/api/v1/repos/{owner}/{repo}/issues", pathParams("owner", owner, "repo", repo)) | ||
| return ListPage[types.Issue](ctx, s.client, path, issueListQuery(filters...), opts) | ||
| } | ||
|
|
||
| // ListIssues returns all issues in a repository. | ||
| func (s *IssueService) ListIssues(ctx context.Context, owner, repo string, filters ...IssueListOptions) ([]types.Issue, error) { | ||
| func (s *IssueService) ListIssues(ctx context.Context, owner, repo string, filters ...any) ([]types.Issue, error) { | ||
| path := ResolvePath("/api/v1/repos/{owner}/{repo}/issues", pathParams("owner", owner, "repo", repo)) |
There was a problem hiding this comment.
Similarly to pulls, filters ...any on the issue listing APIs removes type safety and can lead to filters being silently ignored if a caller passes an unsupported type. A typed filter interface or separate compat methods would keep the RFC-compatibility without weakening the primary API surface.
Routine dev→main PR opened by Hephaestus PR-cadence task.
This PR exists to:
ahead_by: 15 commit(s) (per gh api compare)If CodeRabbit clears with no blocking comments, this PR is eligible for
gh pr merge --merge(real merge commit, no force-push). Conflicts and review feedback should be addressed on the dev branch before merge.Co-authored-by: Hephaestus hephaestus@cladius