Skip to content

Commit 5bb5a07

Browse files
committed
fix: translate empty version in ProjectVersionUseCase.Create and fix workflow test
Add backward-compat "" → "v0" translation in ProjectVersionUseCase.Create to match WorkflowRunUseCase.Create behavior. Update workflow integration test to look up the default version by DefaultVersionName instead of "". Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
1 parent a64872a commit 5bb5a07

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

app/controlplane/pkg/biz/projectversion.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ func (uc *ProjectVersionUseCase) Create(ctx context.Context, projectID, version
9494
return nil, NewErrInvalidUUID(err)
9595
}
9696

97+
// Treat empty version as the default for backward compatibility
98+
if version == "" {
99+
version = DefaultVersionName
100+
}
101+
97102
if err := ValidateVersion(version); err != nil {
98103
return nil, err
99104
}

app/controlplane/pkg/biz/workflow_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (s *workflowIntegrationTestSuite) TestCreate() {
210210
s.NotEmpty(got.ContractID)
211211
s.NotEmpty(got.ContractName)
212212
// There is a project version created
213-
pv, err := s.ProjectVersion.FindByProjectAndVersion(ctx, got.ProjectID.String(), "")
213+
pv, err := s.ProjectVersion.FindByProjectAndVersion(ctx, got.ProjectID.String(), biz.DefaultVersionName)
214214
s.NoError(err)
215215
s.NotNil(pv)
216216
})

0 commit comments

Comments
 (0)