[PR #319] [MERGED] fix: scheduler auto-start gate, backup clone URL, cancel-pending action, actionable 405 #4666

Closed
opened 2026-06-13 07:26:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/319
Author: @arunavo4
Created: 6/12/2026
Status: Merged
Merged: 6/13/2026
Merged by: @arunavo4

Base: mainHead: fix/309-308-quick-wins


📝 Commits (4)

  • 53d0f0e fix(scheduler): make enabled flag authoritative for auto-start
  • 74a4be0 fix(backup): always derive clone URL from user-configured Gitea URL
  • 7732148 feat(jobs): cancel-pending endpoint + fix misleading Delete All copy
  • 14febbb fix(sync): actionable 405 error for non-pull-mirror repos

📊 Changes

5 files changed (+255 additions, -20 deletions)

View changed files

📝 src/components/activity/ActivityLog.tsx (+97 -7)
📝 src/lib/gitea-enhanced.ts (+32 -3)
📝 src/lib/scheduler-service.test.ts (+22 -0)
📝 src/lib/scheduler-service.ts (+15 -10)
src/pages/api/job/cancel-pending.ts (+89 -0)

📄 Description

Part of #309. Improves diagnostics for #308. Four independent fixes, one commit each:

  1. Auto-start respects the enabled toggle (#309): boot-time auto-start fired when scheduleEnabled || hasMirrorInterval, so a configured mirror interval overrode an explicitly disabled scheduler. scheduleConfig.enabled is now the single authoritative gate. The documented GITEA_MIRROR_INTERVAL contract is preserved — the env loader already sets enabled=true when that variable is present at startup.

  2. Backup clone URL derived from the configured Gitea URL (#309): the pre-sync backup preferred repoInfo.clone_url from the Gitea API, which reflects Gitea's ROOT_URL and can be unreachable from the app (e.g. Tailscale MagicDNS deployments). The clone URL is now always built from config.giteaConfig.url. (Issue/PR metadata mirroring was already using the configured URL and was unaffected.)

  3. Honest "Delete All" copy + a real cancel action (#309): the activity-page action only clears history rows while the scheduler re-derives pending work from repo status, so the log refilled. The dialog is renamed "Clear Activity History" with accurate copy, and a new POST /api/job/cancel-pending ("Stop Pending Mirrors" button) sets this user's imported/failed repos to ignored (re-enable from the Repositories page). In-flight work is left alone.

  4. Actionable HTTP 405 on mirror-sync (#308): Gitea returns a bodyless 405 when a repo isn't a pull-mirror in its database (e.g. Gitea auto-disabled the mirror). Previously surfaced as a raw "HTTP 405: Method Not Allowed"; now the repo's error message tells the user to check Gitea → Settings → Mirror Settings and re-mirror if the mirror section is missing.

Testing

Unit tests for the auto-start gate; full suite green. Cancel-pending verified live on a Gitea 1.24 test bed (745 repos flipped to Ignored, single summary activity entry).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/319 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 6/12/2026 **Status:** ✅ Merged **Merged:** 6/13/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `fix/309-308-quick-wins` --- ### 📝 Commits (4) - [`53d0f0e`](https://github.com/RayLabsHQ/gitea-mirror/commit/53d0f0e1ec6af6bf69de70ce245217c1c67d21a8) fix(scheduler): make enabled flag authoritative for auto-start - [`74a4be0`](https://github.com/RayLabsHQ/gitea-mirror/commit/74a4be0be5b8d79165747e8978b809e92783e573) fix(backup): always derive clone URL from user-configured Gitea URL - [`7732148`](https://github.com/RayLabsHQ/gitea-mirror/commit/77321485d17e90e0f169d10e613db7652d46102d) feat(jobs): cancel-pending endpoint + fix misleading Delete All copy - [`14febbb`](https://github.com/RayLabsHQ/gitea-mirror/commit/14febbbd8f1cda2eb3928011864e4c94950a1694) fix(sync): actionable 405 error for non-pull-mirror repos ### 📊 Changes **5 files changed** (+255 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/components/activity/ActivityLog.tsx` (+97 -7) 📝 `src/lib/gitea-enhanced.ts` (+32 -3) 📝 `src/lib/scheduler-service.test.ts` (+22 -0) 📝 `src/lib/scheduler-service.ts` (+15 -10) ➕ `src/pages/api/job/cancel-pending.ts` (+89 -0) </details> ### 📄 Description Part of #309. Improves diagnostics for #308. Four independent fixes, one commit each: 1. **Auto-start respects the enabled toggle** (#309): boot-time auto-start fired when `scheduleEnabled || hasMirrorInterval`, so a configured mirror interval overrode an explicitly disabled scheduler. `scheduleConfig.enabled` is now the single authoritative gate. The documented `GITEA_MIRROR_INTERVAL` contract is preserved — the env loader already sets `enabled=true` when that variable is present at startup. 2. **Backup clone URL derived from the configured Gitea URL** (#309): the pre-sync backup preferred `repoInfo.clone_url` from the Gitea API, which reflects Gitea's `ROOT_URL` and can be unreachable from the app (e.g. Tailscale MagicDNS deployments). The clone URL is now always built from `config.giteaConfig.url`. (Issue/PR metadata mirroring was already using the configured URL and was unaffected.) 3. **Honest "Delete All" copy + a real cancel action** (#309): the activity-page action only clears history rows while the scheduler re-derives pending work from repo status, so the log refilled. The dialog is renamed "Clear Activity History" with accurate copy, and a new `POST /api/job/cancel-pending` ("Stop Pending Mirrors" button) sets this user's `imported`/`failed` repos to `ignored` (re-enable from the Repositories page). In-flight work is left alone. 4. **Actionable HTTP 405 on mirror-sync** (#308): Gitea returns a bodyless 405 when a repo isn't a pull-mirror in its database (e.g. Gitea auto-disabled the mirror). Previously surfaced as a raw "HTTP 405: Method Not Allowed"; now the repo's error message tells the user to check Gitea → Settings → Mirror Settings and re-mirror if the mirror section is missing. ## Testing Unit tests for the auto-start gate; full suite green. Cancel-pending verified live on a Gitea 1.24 test bed (745 repos flipped to Ignored, single summary activity entry). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-13 07:26:07 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#4666