Batch --scan support for GitLab (GitLabIssueClient.listIssues + per-platform scan wiring) #246

Closed
opened 2026-08-17 12:04:51 +00:00 by david · 1 comment
Owner

Summary

Complete batch --scan (label-based issue discovery) support for GitLab repos.

GitLab support already exists on main (issue fetch, MR creation, comment write-back, auto-merge polling, origin detection incl. subgroups, GITLAB_TOKEN/GITLAB_BASE_URL config). The gap: GitLabIssueClient does not implement IssueListClient, and the --scan path in runCli.ts hard-rejects every non-Forgejo platform ("Scan mode (--scan) is not supported on ... repos").

Scope

  • Code: listIssues on GitLabIssueClient + per-platform scan wiring in runCli.ts
  • Unit tests (mocked HTTP, existing style)
  • AGENTS.md touch-up (line 66: "(Forgejo only)" → "(Forgejo and GitLab)")
  • Non-goals: live E2E (deferred until a GitLab instance/creds exist), GitHub parity, README work

Key decisions (docs-verified, GitLab v19.3)

  • Label semantics: client-side OR union — one paginated API call per label, results unioned + deduped by issue number. GitLab's labels param is AND-only ("issues must have all labels"); or_labels does not exist.
  • type filter: fail-fast on 'pr'/'all' (GitLab's issues endpoint cannot return MRs — separate merge_requests endpoint).
  • Pagination: page-size heuristic (per_page=30, MAX_PAGES=100) because "for GitLab.com users, some pagination headers may not be returned".
  • State mapping: open→opened, closed→closed, all→all; priority extraction mirrors Forgejo (priority/<level>, critical > high > medium > low).

Files

  1. src/gitlab/types/rawIssueList.ts — new RawGitLabIssueListItem type
  2. src/gitlab/index.ts — export the new type
  3. src/gitlab/services/gitLabIssueClient.ts — implement IssueListClient (listIssues, buildListUrl, normalizeCandidate, extractPriority, requireRepoForList)
  4. src/cli/services/runCli.ts — per-platform guard + list-client construction (gitlab → GitLabIssueClient(requireGitLabCreds(...)))
  5. AGENTS.md — --scan flag row

Validation

  • Unit tests: pagination, OR-union dedupe, state mapping, type fail-fast, priority extraction, error mapping, runCli gitlab branch
  • npm run lint + npm test green
  • E2E deferred (needs live GitLab instance/creds)

Full step-by-step plan with code sketches and test matrix: docs/implementation-plan-gitlab-scan.md.

## Summary Complete batch `--scan` (label-based issue discovery) support for GitLab repos. GitLab support already exists on `main` (issue fetch, MR creation, comment write-back, auto-merge polling, origin detection incl. subgroups, `GITLAB_TOKEN`/`GITLAB_BASE_URL` config). The gap: **`GitLabIssueClient` does not implement `IssueListClient`**, and the `--scan` path in `runCli.ts` hard-rejects every non-Forgejo platform ("Scan mode (--scan) is not supported on ... repos"). ## Scope - Code: `listIssues` on `GitLabIssueClient` + per-platform scan wiring in `runCli.ts` - Unit tests (mocked HTTP, existing style) - AGENTS.md touch-up (line 66: "(Forgejo only)" → "(Forgejo and GitLab)") - **Non-goals**: live E2E (deferred until a GitLab instance/creds exist), GitHub parity, README work ## Key decisions (docs-verified, GitLab v19.3) - **Label semantics: client-side OR union** — one paginated API call per label, results unioned + deduped by issue `number`. GitLab's `labels` param is AND-only ("issues must have all labels"); `or_labels` does not exist. - **`type` filter: fail-fast** on `'pr'`/`'all'` (GitLab's issues endpoint cannot return MRs — separate `merge_requests` endpoint). - **Pagination: page-size heuristic** (`per_page=30`, `MAX_PAGES=100`) because "for GitLab.com users, some pagination headers may not be returned". - **State mapping**: `open`→`opened`, `closed`→`closed`, `all`→`all`; priority extraction mirrors Forgejo (`priority/<level>`, `critical > high > medium > low`). ## Files 1. `src/gitlab/types/rawIssueList.ts` — new `RawGitLabIssueListItem` type 2. `src/gitlab/index.ts` — export the new type 3. `src/gitlab/services/gitLabIssueClient.ts` — implement `IssueListClient` (`listIssues`, `buildListUrl`, `normalizeCandidate`, `extractPriority`, `requireRepoForList`) 4. `src/cli/services/runCli.ts` — per-platform guard + list-client construction (gitlab → `GitLabIssueClient(requireGitLabCreds(...))`) 5. `AGENTS.md` — `--scan` flag row ## Validation - Unit tests: pagination, OR-union dedupe, state mapping, type fail-fast, priority extraction, error mapping, runCli gitlab branch - `npm run lint` + `npm test` green - E2E deferred (needs live GitLab instance/creds) Full step-by-step plan with code sketches and test matrix: `docs/implementation-plan-gitlab-scan.md`.
david closed this issue 2026-08-19 04:48:14 +00:00
Author
Owner

pi-loop opened and merged a pull request for this issue: #295

pi-loop opened and merged a pull request for this issue: https://git.excelera.net/david/pi-loop/pulls/295
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-loop#246
No description provided.