registry/internal
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tadas Antanavicius 272ee9322d
fix: add server name validation and clean invalid data before migration 009 (#591)
## Summary

This PR adds two important improvements to ensure data integrity:

1. **Adds server name format validation at the API layer** to match the
database constraint from migration 008
2. **Includes migration 008 to clean up invalid data** before applying
strict constraints in migration 009

## Changes

### Server Name Validation
- Enforces validation at the API layer matching the database constraint
- **Namespace pattern**: `[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9]` 
  - Must start and end with alphanumeric characters
  - Can contain dots and hyphens in the middle
- **Name pattern**: `[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]`
  - Must start and end with alphanumeric characters  
  - Can contain dots, underscores, and hyphens in the middle
- Provides clear, user-friendly error messages indicating which part is
invalid
- Uses DRY approach with composed regex patterns

### Migration 008: Data Cleanup
- Removes servers with invalid names or empty versions (5 servers
affected in production)
- Fixes invalid status values by setting them to 'active' (1 server
affected)
- Removes duplicate name+version combinations
- Includes comprehensive safety checks to prevent accidental data loss
- Must run before migration 009 which adds strict constraints

## Testing
- All validator tests pass
- Migration includes safety checks that match production data
- CI verification included

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-30 20:07:42 +03:00
..
api Apply gofmt formatting to all Go files (#588) 2025-09-30 17:32:22 +03:00
auth Apply gofmt formatting to all Go files (#588) 2025-09-30 17:32:22 +03:00
config Apply gofmt formatting to all Go files (#588) 2025-09-30 17:32:22 +03:00
database fix: add server name validation and clean invalid data before migration 009 (#591) 2025-09-30 20:07:42 +03:00
importer Apply gofmt formatting to all Go files (#588) 2025-09-30 17:32:22 +03:00
service Apply gofmt formatting to all Go files (#588) 2025-09-30 17:32:22 +03:00
telemetry Add OpenTelemetry metrics instrumentation (#290) 2025-08-21 14:23:37 +01:00
validators fix: add server name validation and clean invalid data before migration 009 (#591) 2025-09-30 20:07:42 +03:00