Make product checks additive

This commit is contained in:
2026-10-06 17:15:46 +00:00
parent 08093124af
commit 3e9b5c1b99
23 changed files with 368 additions and 169 deletions

View File

@@ -36,13 +36,13 @@ const (
const recoveryTimeout = 30 * time.Second
type Request struct {
RepositoryDir string
Product string
Version string
Remote string
Validate func(context.Context, candidate.Candidate) error
AfterValidate func(context.Context, candidate.Candidate) error
Output io.Writer
RepositoryDir string
Product string
Version string
Remote string
AdditionalChecks func(context.Context, candidate.Candidate) error
AfterValidate func(context.Context, candidate.Candidate) error
Output io.Writer
}
type Result struct {
@@ -55,7 +55,8 @@ type Result struct {
}
// Publish validates one captured candidate and pushes only its annotated tag
// object. A failed push receives one bounded authoritative tag query. Exact
// object. It runs the standard Go suite, then AdditionalChecks when supplied.
// A failed push receives one bounded authoritative tag query. Exact
// object equality confirms publication; absence and conflict are classified,
// while an unreadable result remains Unknown and preserves the push error.
func Publish(ctx context.Context, request Request) (Result, error) {
@@ -65,11 +66,11 @@ func Publish(ctx context.Context, request Request) (Result, error) {
remoteName = "origin"
}
checks := candidate.Request{
RepositoryDir: request.RepositoryDir,
Product: request.Product,
Version: request.Version,
Validate: request.Validate,
Output: request.Output,
RepositoryDir: request.RepositoryDir,
Product: request.Product,
Version: request.Version,
AdditionalChecks: request.AdditionalChecks,
Output: request.Output,
}
captured, err := candidate.Capture(ctx, checks)
if err != nil {