Commit 9b718bc
feat: add Gitea forge implementation (3/3) (cesarferreira#134)
* feat: add Gitea forge implementation
Add GiteaClient implementing the ForgeClient interface for Gitea
pull request operations. Supports creating, updating, merging PRs,
stack comment management via issue comments, and CI status checks.
Key additions:
- src/forge/gitea.rs with full Gitea API v1 client
- AuthorizationToken auth style and patch_json helper in forge/mod.rs
- Integration tests for submit (comment/body/both/off modes) and
merge/merge-when-ready with PR retargeting
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: is_pr_merged returns true only for actually merged PRs, add pagination limits
- Fix is_pr_merged() to check only the `merged` field instead of also
treating closed PRs as merged (a closed PR may have been rejected)
- Add limit=50 to all Gitea list API calls (pulls, comments, statuses)
to avoid silent truncation at Gitea's default page size of 30
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: normalize Gitea check conclusion values for consistency with GitLab
Map raw Gitea status strings to normalized conclusions:
success->success, failure/error->failure. This matches the GitLab
normalization pattern so downstream consumers get consistent values.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: remove spurious ?limit=50 from create_stack_comment POST URL
Pagination parameters only apply to GET requests. The limit=50 was
accidentally added to the POST endpoint by a bulk replace.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: CI status priority, forge-generic messages, and silent no-op warnings
- Fix aggregate CI overall status: failure now takes priority over
pending. Previously find_map short-circuited on the first non-success
status, so [pending, failed] would report "pending" instead of
"failure". Both GitLab and Gitea clients affected.
- Replace GitHub-specific auth check in ci.rs with forge_token() so
`stax ci` works on GitLab/Gitea repos.
- Replace hardcoded "GitHub" in user-facing error messages (submit.rs,
ci.rs) with forge-generic wording.
- Rename API stats labels from "github.api.*" to "forge.api.*".
- Add eprintln warnings when reviewers/labels/assignees are requested
on forges that don't support them (were silent no-ops).
- Add Display impl for ForgeType.
- Add unit tests for aggregate_ci_overall priority logic.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: Gitea MergeTitleField serde rename, detect Forgejo as Gitea
- Fix MergePullRequest serialization: Gitea API expects PascalCase
"MergeTitleField" but we were sending snake_case "merge_title_field",
causing squash merge commit titles to be silently ignored.
- Recognize Forgejo (popular Gitea fork) in forge detection so
self-hosted Forgejo instances use the Gitea client automatically.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: add missing #[tokio::test] and normalize Gitea merged-PR state
Two bugs:
1. test_submit_gitea_comment_mode_creates_pull_and_issue_comment was
missing the #[tokio::test] attribute, so the test runner never
executed it (same class of bug as the GitLab one).
2. Gitea's API returns state="closed" for merged PRs (with a separate
merged=true field), so pr.state.to_uppercase() produced "CLOSED"
instead of "MERGED". This broke sync's metadata-based merge
detection (sync.rs:1133 checks for state "MERGED").
Added normalize_gitea_state() that checks the merged field first,
mirroring GitLab's normalize_gitlab_state() approach.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>1 parent fd43ee5 commit 9b718bc
6 files changed
Lines changed: 1432 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
259 | 262 | | |
260 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
261 | 269 | | |
262 | 270 | | |
263 | 271 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | 272 | | |
269 | 273 | | |
270 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| |||
956 | 956 | | |
957 | 957 | | |
958 | 958 | | |
959 | | - | |
| 959 | + | |
960 | 960 | | |
961 | | - | |
| 961 | + | |
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
| |||
1442 | 1442 | | |
1443 | 1443 | | |
1444 | 1444 | | |
1445 | | - | |
| 1445 | + | |
1446 | 1446 | | |
1447 | 1447 | | |
1448 | 1448 | | |
1449 | | - | |
| 1449 | + | |
1450 | 1450 | | |
1451 | 1451 | | |
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
1455 | 1455 | | |
1456 | | - | |
1457 | | - | |
| 1456 | + | |
| 1457 | + | |
1458 | 1458 | | |
1459 | 1459 | | |
1460 | 1460 | | |
| |||
0 commit comments