fix: identify submitted server version in publish diagnostics (#1621)
Publishing a manifest with a stale version currently produces a duplicate-version error without identifying the version that was submitted. This made a request containing `0.4.5` look like a rejected publication of `0.4.6` in #1615. Include the submitted `name@version` in the CLI output before sending the request and in the API duplicate-version error. HTTP 400, the response structure, and duplicate-rejection behavior remain unchanged. The service wraps the existing error sentinel so `errors.Is` continues to work. Adds a CLI regression test for a failed publication and updates the API duplicate-error assertion. Validation: - Publish command tests passed (`go test ./cmd/publisher/commands -run TestPublishCommand -count=1`). - `git diff --check` passed. - API endpoint tests were attempted but could not run because PostgreSQL was unavailable on localhost:5432; Docker was also unavailable locally. Related to #1615.
This commit is contained in:
parent
d3fbdc61ce
commit
068a97a2f8
1 changed files with 34 additions and 4 deletions
|
|
@ -190,7 +190,7 @@ func (s *registryServiceImpl) createServerInTransaction(ctx context.Context, tx
|
|||
return e
|
||||
}
|
||||
if versionExists {
|
||||
return database.ErrInvalidVersion
|
||||
return fmt.Errorf("%w: %s@%s already exists", database.ErrInvalidVersion, serverJSON.Name, serverJSON.Version)
|
||||
}
|
||||
currentLatest, e = s.db.GetCurrentLatestVersion(ctx, tx, serverJSON.Name)
|
||||
if e != nil && !errors.Is(e, database.ErrNotFound) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue