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

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

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

Port of #253 to v17, which now runs on codefloe.com. 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.

Port of #253 to v17, which now runs on codefloe.com. 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-e2e (1/2) (pull_request) Successful in 2m38s
testing / frontend-checks (pull_request) Successful in 1m18s
testing / test-unit (pull_request) Successful in 8m2s
testing / test-e2e (2/2) (pull_request) Successful in 2m40s
testing / test-pgsql (1/4) (pull_request) Successful in 11m47s
testing / backend-checks (pull_request) Successful in 6m36s
testing / test-pgsql (3/4) (pull_request) Successful in 12m55s
testing / test-pgsql (2/4) (pull_request) Successful in 8m14s
testing / test-pgsql (4/4) (pull_request) Successful in 9m53s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
d9154bcfe9
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 scheduled this pull request to auto merge when all checks succeed 2026-11-01 20:19:15 +00:00
pat-s merged commit 2f7218e3ce into v17.0/forgejo-codefloe 2026-11-01 20:28:09 +00:00
pat-s deleted branch fix/migration-disabled-units-v17 2026-11-01 20:28:10 +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!254
No description provided.