registry/internal/service
Repository files (latest commit first)
Filename Latest commit message Latest commit date
adam jones 747ad310bb
Fix atomic latest version update to prevent missing isLatest flags (#530)
## Summary
Fixes a race condition where a server could have no version marked as
`isLatest` if the database operations failed independently.

## Changes
- **CreateServer signature**: Now accepts `oldLatestVersionID` parameter
to atomically unmark previous latest version
- **PostgreSQL implementation**: Uses a transaction to ensure UPDATE
(unmark old latest) and INSERT (create new version) happen atomically
- **Service layer**: Maintains `WithPublishLock` for concurrent
operation serialization
- **Two-level protection**: Advisory lock prevents races, transaction
ensures atomicity

## Test plan
- [x] Existing race condition tests pass
- [x] Integration tests pass
- [x] Unit tests pass

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-24 18:27:36 +01:00
..
registry_service.go Fix atomic latest version update to prevent missing isLatest flags (#530) 2025-09-24 18:27:36 +01:00
registry_service_test.go Fix atomic latest version update to prevent missing isLatest flags (#530) 2025-09-24 18:27:36 +01:00
service.go Introduce serverId, rename id to versionId (#465) 2025-09-21 15:00:09 +03:00
versioning.go feat: implement server versioning approach with semantic versioning support (#296) 2025-08-26 14:55:38 +01:00
versioning_test.go feat: implement server versioning approach with semantic versioning support (#296) 2025-08-26 14:55:38 +01:00