import-issues: Codeberg through --api-base is untested, sourcehut export unsupported #191

closed cmc opened this on 2026-09-07 21:59 UTC · migration

Discussion

cmc 2026-09-07 21:59 UTC

repo import takes git from any HTTPS remote. repo import-issues (#17) walks GitHub-shaped endpoints; --api-base exists (internal/control/ghimport.go) and has only ever been pointed at api.github.com. Forgejo's API mirrors GitHub's issue and comment shapes closely, so --api-base https://codeberg.org/api/v1 may work as is. Sourcehut's tracker export (JSON, via todo.sr.ht) is not read at all.

  1. Run an import from a Codeberg repository through --api-base and record what breaks. Fix or document.
  2. Decide sourcehut separately: a reader for the todo.sr.ht export, or a documented no.

Ref #185

cmc 2026-09-08 05:44 UTC

Part 1, run. repo import-issues with --api-base https://codeberg.org/api/v1 against oneprog/ada-judge (25 items, one merged PR, 6 comments, labels, closed state) on a local instance, unauthenticated.

What broke, in order of consequence:

  1. The comments endpoint has no pages. Forgejo's issues/{n}/comments takes only since/before, ignores page, and returns everything every time, so the importer's page loop never returned on the first issue with a comment. The run hung past 90 s.
  2. Order. The issue list ignores sort=created&direction=asc and lists newest first, so local numbers would have come out reversed. Forgejo's own parameter is sort=oldest.
  3. Page size. per_page is ignored; Forgejo reads limit (Codeberg caps it at 50). Slower, not wrong.
  4. Attribution said github.com/oneprog/ada-judge#N and the pull-head fetch went to github.com, so the merged PR would have arrived without a head.

Everything else matched: pull_request on list rows, closed_at, merged_at, head/base on pulls/{n}, user.login, labels[].name, comments counts, RFC 3339 dates with an offset.

!349 fixes all four: one /version probe tells Forgejo from GitHub, and on Forgejo the client pages with limit, orders with sort=oldest, and reads comments once. The site is derived from the API base for attribution and the pull-head fetch, so a GitHub Enterprise base is attributed to its own host too. The same run then imports 24 issues, the merged MR with its head, and 6 comments in the source's order in six seconds. Users wiki and FAQ carry the Codeberg example.

Part 2, sourcehut, is still a decision. todo.sr.ht has a JSON export and a GraphQL API; neither has the GitHub shape, so it is a separate reader, not an --api-base case. The Users page currently states that the tracker is not read.

referenced in commit bc93d6cbca by cmc: control, e2e, wiki: import-issues reads Forgejo through --api-base

2026-09-08 05:55 UTC
cmc 2026-09-10 00:00 UTC

Part 1 shipped in v1.17.0 (bc93d6c, !349): import-issues --api-base reads Forgejo, verified against codeberg.org/oneprog/ada-judge.

Part 2, sourcehut: a documented no, as the Users page already states — repo import takes the git data, the todo.sr.ht tracker is not read. Its export has neither the GitHub shape nor a demand to justify a separate reader. Reopen if that changes.