## Issues Fixed
### Issue #161: Incorrect open/closed status after import
- Root cause: Gitea API creates issues as open first, then closes them in a separate step
- This two-step process can fail silently due to rate limiting or API errors
- Solution: Added explicit verification after issue creation
- If closed state wasn't applied, use PATCH to explicitly close the issue
- Added comprehensive error handling and logging
- Applied same fix to both issue and PR mirroring paths
### Issue #165: New issues/PRs not syncing after initial mirror
- Root cause: Boolean flags (issues: true) prevented subsequent syncs
- Once marked as "mirrored", new/updated items were permanently skipped
- Solution: Implemented incremental sync with timestamp tracking
- Track componentLastSynced timestamps for each metadata component
- Use GitHub's 'since' parameter to fetch only updated items
- Implement duplicate detection to prevent creating duplicates
- Update timestamps only after successful sync
## Optimizations
- **Efficient duplicate detection**: Uses 'since' parameter when fetching existing Gitea issues
- Reduces API calls by only checking recently updated issues
- Significantly faster for repos with many issues (100s or 1000s)
- Reduces pagination overhead
- **Improved PR detection**: Uses PR number extraction (regex) instead of title matching
- More robust against PR status/title changes
- Handles "[PR #123]", "[PR #123] [MERGED]", etc.
- **Pagination with safety limits**: Max 10 pages (1000 items) to balance completeness and performance
## Edge Cases Handled
1. Network timeouts between create and close operations
2. Rate limiting during two-step issue creation
3. Large repos with >1000 issues/PRs
4. PR status changes affecting title format
5. Timestamp updates only on successful sync (prevents missed items on failures)
## Testing
- All 111 tests passing
- Verified alignment with Gitea v1.25.3 and v1.26.0-dev source code
- Tested incremental sync behavior with timestamp tracking
## Files Changed
- src/lib/metadata-state.ts: Added componentLastSynced timestamps
- src/lib/gitea.ts: Status verification, incremental sync, optimized duplicate detection
- src/lib/gitea-enhanced.ts: Timestamp management and incremental sync orchestration
bun install requires network access which Nix sandbox blocks.
CI now validates flake structure and evaluates expressions only.
Full builds work locally with: nix build --option sandbox false
- Use DeterminateSystems/nix-installer-action for Nix installation
- Use DeterminateSystems/magic-nix-cache-action for caching (free, no setup)
- Update documentation to remove Cachix references
- Add nix branch to CI triggers
- Add 1-second delays between release creations to ensure distinct timestamps
- Prepend GitHub original publication date to release notes
- Improve logging to show chronological processing order
- Addresses Gitea API limitation where created_unix is always set to current time
Fixes#129
Fixes#141
The repository metadata field was missing from the database schema, which
caused the metadata sync state (issues, PRs, releases, etc.) to not persist.
This resulted in duplicate issues being created every time a repository was
synced because the system couldn't track what had already been mirrored.
Changes:
- Added metadata text field to repositories table in schema
- Added metadata field to repositorySchema Zod validation
- Generated database migration 0008_serious_thena.sql
Root cause analysis:
1. Code tried to read/write repository.metadata to track mirrored components
2. The metadata field didn't exist in the database schema
3. On sync, metadataState.components.issues was always false
4. This triggered re-mirroring of all issues, creating duplicates
The fix ensures metadata state persists between mirrors and syncs, preventing
duplicate metadata (issues, PRs, releases) from being created in Gitea.