feat(forge): GitLab Repo box readers and update branch #147

Merged
deadstyle merged 6 commits from feature/140-gitlab-repo into develop 2026-10-12 08:50:41 -05:00
Owner

Refs #140 (parent #137)

Summary

The GitLab adapter now reads READMEs, branches, branch commits, directory listings and files, and updates an MR with its target branch, so the Repo box tabs and u work on GitLab. u on GitLab offers rebase only (GitLab's API can't merge the target into an MR); design.md's u sentences say so. architecture.md's GitLab rows are updated (unverified: no live GitLab used).

Decisions

  • GitLab's tree listing has no sizes, so ReadFile checks X-Gitlab-Size with a HEAD first and, over the preview cap, returns new sentinel forge.ErrTooLarge without downloading; core maps it to the existing "too large" preview. The cap moved to forge.MaxReadSize (core's MaxPreviewSize aliases it).
  • BranchUpdater contract: UpdateStyles lists UpdateMerge first when supported; the shared contract tests use the first style. Gitea and GitHub are unchanged.
  • Files are read through /raw for exact bytes (the JSON form transcodes non-UTF-8 text, hiding binaries). Rebase 202 is success; 403/409 map to ErrRefused with GitLab's message.

Test plan

  • go test -race ./...: 13 packages ok. Build passes.
  • Lint and fmt-check with CI's golangci-lint v2.14.0: 0 issues (after a gofumpt fix in a test file).
  • Tests written red-first from the AC (22 red on assertion with stubs); the 3 green-before or unproven tests mutation-proven.

🤖 Generated with Claude Code

Refs #140 (parent #137) ## Summary The GitLab adapter now reads READMEs, branches, branch commits, directory listings and files, and updates an MR with its target branch, so the Repo box tabs and `u` work on GitLab. `u` on GitLab offers rebase only (GitLab's API can't merge the target into an MR); design.md's `u` sentences say so. architecture.md's GitLab rows are updated (unverified: no live GitLab used). ## Decisions - GitLab's tree listing has no sizes, so `ReadFile` checks `X-Gitlab-Size` with a HEAD first and, over the preview cap, returns new sentinel `forge.ErrTooLarge` without downloading; core maps it to the existing "too large" preview. The cap moved to `forge.MaxReadSize` (core's `MaxPreviewSize` aliases it). - `BranchUpdater` contract: `UpdateStyles` lists `UpdateMerge` first *when supported*; the shared contract tests use the first style. Gitea and GitHub are unchanged. - Files are read through `/raw` for exact bytes (the JSON form transcodes non-UTF-8 text, hiding binaries). Rebase 202 is success; 403/409 map to `ErrRefused` with GitLab's message. ## Test plan - `go test -race ./...`: 13 packages ok. Build passes. - Lint and fmt-check with CI's golangci-lint v2.14.0: 0 issues (after a gofumpt fix in a test file). - Tests written red-first from the AC (22 red on assertion with stubs); the 3 green-before or unproven tests mutation-proven. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #140

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ReadFile may now refuse a file over forge.MaxReadSize with ErrTooLarge
instead of GitLab returning cap+1 zero bytes; core Preview maps it to
TooLarge. The BranchUpdater contract lists UpdateMerge first only when
supported, so GitLab's rebase-only styles pass the shared suite.

Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test(forge): gofumpt the branches test consts
All checks were successful
ci / check (pull_request) Successful in 1m23s
8d7e24e49f
Refs #140

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chore: merge develop into feature/140-gitlab-repo
All checks were successful
ci / check (pull_request) Successful in 1m33s
ca12f6cb09
deadstyle merged commit 6c8de2e2b1 into develop 2026-10-12 08:50:41 -05:00
deadstyle deleted branch feature/140-gitlab-repo 2026-10-12 08:50:41 -05:00
Sign in to join this conversation.
No description provided.