codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

fix(migrations): skip units the source repository has disabled #253

Merged
pat-s merged 1 commit from fix/migration-disabled-units into v16.0/forgejo-codefloe 2026-11-01 20:19:31 +00:00
Owner

Fixes the failure reported in https://forum.codefloe.com/t/migration-issue/228.

Problem

Migrating a repository from Codeberg (or any Forgejo/Gitea instance) aborts with The target couldn't be found. when one of the selected items is turned off on the source repository.
The source API answers 404 for a disabled unit, verified against codeberg.org:

  • /releases on a repository with releases disabled
  • /issues and /pulls on a repository with issues or pull requests disabled
  • /labels and /milestones when both issues and pull requests are disabled

GiteaDownloader passed that 404 up, and migrate.go treats any error other than "not supported" as fatal, so the user had to untick each such item by hand.

Fix

  • services/migrations/gitea_downloader_codefloe.go: add unitDisabled, which recognises a 404 on a list request and logs that the unit is skipped. The repository is known to exist because GetRepoInfo already succeeded.
  • services/migrations/gitea_downloader.go: call it from GetMilestones, GetLabels, GetReleases, GetIssues and GetPullRequests, returning an empty list instead of an error.
  • services/migrations/gitea_downloader_codefloe_test.go: cover a source answering 404 (empty lists, no error) and 500 (still an error) on every list endpoint.
  • README.md: add a custom changes row.

The test fails without the downloader change.
The Forgejo downloader embeds the Gitea one, so both source types get the fix.

Fixes the failure reported in https://forum.codefloe.com/t/migration-issue/228. ## Problem Migrating a repository from Codeberg (or any Forgejo/Gitea instance) aborts with `The target couldn't be found.` when one of the selected items is turned off on the source repository. The source API answers `404` for a disabled unit, verified against codeberg.org: - `/releases` on a repository with releases disabled - `/issues` and `/pulls` on a repository with issues or pull requests disabled - `/labels` and `/milestones` when both issues and pull requests are disabled `GiteaDownloader` passed that 404 up, and `migrate.go` treats any error other than "not supported" as fatal, so the user had to untick each such item by hand. ## Fix - `services/migrations/gitea_downloader_codefloe.go`: add `unitDisabled`, which recognises a 404 on a list request and logs that the unit is skipped. The repository is known to exist because `GetRepoInfo` already succeeded. - `services/migrations/gitea_downloader.go`: call it from `GetMilestones`, `GetLabels`, `GetReleases`, `GetIssues` and `GetPullRequests`, returning an empty list instead of an error. - `services/migrations/gitea_downloader_codefloe_test.go`: cover a source answering 404 (empty lists, no error) and 500 (still an error) on every list endpoint. - `README.md`: add a custom changes row. The test fails without the downloader change. The Forgejo downloader embeds the Gitea one, so both source types get the fix.
fix(migrations): skip units the source repository has disabled
All checks were successful
testing / test-pgsql (4/4) (pull_request) Successful in 10m39s
testing / frontend-checks (pull_request) Successful in 1m22s
testing / backend-checks (pull_request) Successful in 3m40s
testing / test-e2e (1/2) (pull_request) Successful in 3m55s
testing / test-pgsql (2/4) (pull_request) Successful in 7m51s
testing / test-e2e (2/2) (pull_request) Successful in 3m46s
testing / test-pgsql (1/4) (pull_request) Successful in 10m3s
testing / test-pgsql (3/4) (pull_request) Successful in 11m10s
testing / test-unit (pull_request) Successful in 5m52s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
1adfa8dbb1
Migrating from Forgejo or Gitea (such as Codeberg) failed with "The
target couldn't be found." when issues, pull requests, releases, labels
or milestones were selected but the source repository has that unit
turned off: the source API answers 404 and the downloader treated it as
a fatal error.

Treat a 404 on these list endpoints as an empty list and log it, since
GetRepoInfo has already proven the repository exists. Other errors
still abort the migration.

Reported in https://forum.codefloe.com/t/migration-issue/228
pat-s merged commit 5537601d5b into v16.0/forgejo-codefloe 2026-11-01 20:19:31 +00:00
pat-s deleted branch fix/migration-disabled-units 2026-11-01 20:19:31 +00:00
Sign in to join this conversation.
No reviewers
No milestone
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
codefloe/forgejo-codefloe!253
No description provided.