e951e97 fix: Detect and recreate incorrectly ordered releases (#148)
📊 Changes
1 file changed (+109 additions, -16 deletions)
View changed files
📝src/lib/gitea.ts (+109 -16)
📄 Description
This fix addresses the persistent release ordering issue by detecting when existing releases in Gitea are in the wrong chronological order and automatically deleting and recreating them in the correct order.
Root Cause:
Gitea ALWAYS sorts releases by created_unix DESC, id DESC
The Gitea API provides NO way to set created_unix when creating releases
Previous fix (PR #146) only worked for NEW releases, not UPDATES
When releases are UPDATED, their created_unix timestamp doesn't change
So releases created in wrong order initially stayed wrong forever
Solution:
Before processing releases, the code now:
Fetches all existing releases from Gitea
Checks if they're in correct chronological order
If order is wrong: deletes all releases and recreates them in correct order
If order is correct: proceeds with normal update logic
How it works:
Maps each release to its expected chronological index (0=oldest, n=newest)
Checks if Gitea's releases (sorted by created_unix DESC) match expected order
Detects mis-ordering by comparing adjacent releases
Logs detailed information about ordering issues found
Deletes and recreates only when necessary (optimized)
User Impact:
Users who mirrored repos BEFORE PR #146: ordering will be fixed on next mirror
First-time mirrors: work correctly (as before)
Subsequent mirrors: verify order and fix if needed
🔄 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/150
**Author:** [@arunavo4](https://github.com/arunavo4)
**Created:** 11/8/2025
**Status:** ✅ Merged
**Merged:** 11/8/2025
**Merged by:** [@arunavo4](https://github.com/arunavo4)
**Base:** `main` ← **Head:** `148-release-order-again`
---
### 📝 Commits (1)
- [`e951e97`](https://github.com/RayLabsHQ/gitea-mirror/commit/e951e97790efb8fcee4c1852479a11520dfa607b) fix: Detect and recreate incorrectly ordered releases (#148)
### 📊 Changes
**1 file changed** (+109 additions, -16 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/gitea.ts` (+109 -16)
</details>
### 📄 Description
This fix addresses the persistent release ordering issue by detecting when existing releases in Gitea are in the wrong chronological order and automatically deleting and recreating them in the correct order.
**Root Cause:**
- Gitea ALWAYS sorts releases by `created_unix DESC, id DESC`
- The Gitea API provides NO way to set `created_unix` when creating releases
- Previous fix (PR #146) only worked for NEW releases, not UPDATES
- When releases are UPDATED, their `created_unix` timestamp doesn't change
- So releases created in wrong order initially stayed wrong forever
**Solution:**
Before processing releases, the code now:
1. Fetches all existing releases from Gitea
2. Checks if they're in correct chronological order
3. If order is wrong: deletes all releases and recreates them in correct order
4. If order is correct: proceeds with normal update logic
**How it works:**
- Maps each release to its expected chronological index (0=oldest, n=newest)
- Checks if Gitea's releases (sorted by created_unix DESC) match expected order
- Detects mis-ordering by comparing adjacent releases
- Logs detailed information about ordering issues found
- Deletes and recreates only when necessary (optimized)
**User Impact:**
- Users who mirrored repos BEFORE PR #146: ordering will be fixed on next mirror
- First-time mirrors: work correctly (as before)
- Subsequent mirrors: verify order and fix if needed
- No manual intervention required
Fixes #148
Related: #129, PR #146
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/150
Author: @arunavo4
Created: 11/8/2025
Status: ✅ Merged
Merged: 11/8/2025
Merged by: @arunavo4
Base:
main← Head:148-release-order-again📝 Commits (1)
e951e97fix: Detect and recreate incorrectly ordered releases (#148)📊 Changes
1 file changed (+109 additions, -16 deletions)
View changed files
📝
src/lib/gitea.ts(+109 -16)📄 Description
This fix addresses the persistent release ordering issue by detecting when existing releases in Gitea are in the wrong chronological order and automatically deleting and recreating them in the correct order.
Root Cause:
created_unix DESC, id DESCcreated_unixwhen creating releasescreated_unixtimestamp doesn't changeSolution:
Before processing releases, the code now:
How it works:
User Impact:
Fixes #148
Related: #129, PR #146
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.