Complete shared validation foundation

This commit is contained in:
2026-10-07 18:41:29 +00:00
parent 89c5b2c1fd
commit f53354be5f
4 changed files with 39 additions and 23 deletions

View File

@@ -42,14 +42,7 @@ type ReleaseRequest struct {
// branch, HEAD, worktree, index, and local tag state. Success establishes local
// candidate evidence only; it does not establish remote availability.
func Check(ctx context.Context, request ReleaseRequest) (Candidate, error) {
checked, err := candidate.Check(ctx, candidate.Request{
RepositoryDir: request.RepositoryDir,
Product: request.Product,
Version: request.Version,
AdditionalChecks: candidateChecks(request.AdditionalChecks),
AfterValidate: internalbuild.CandidateCallback(internalBuildSpec(request.Build), request.Output),
Output: request.Output,
})
checked, err := candidate.Check(ctx, candidateRequest(request))
if err != nil {
return Candidate{}, convertValidationError(err)
}
@@ -60,6 +53,17 @@ func Check(ctx context.Context, request ReleaseRequest) (Candidate, error) {
}, nil
}
func candidateRequest(request ReleaseRequest) candidate.Request {
return candidate.Request{
RepositoryDir: request.RepositoryDir,
Product: request.Product,
Version: request.Version,
AdditionalChecks: candidateChecks(request.AdditionalChecks),
AfterValidate: internalbuild.CandidateCallback(internalBuildSpec(request.Build), request.Output),
Output: request.Output,
}
}
func candidateChecks(checks func(context.Context, Candidate) error) func(context.Context, candidate.Candidate) error {
if checks == nil {
return nil

View File

@@ -1,6 +1,7 @@
# Validation model implementation plan
Status: In progress; shared execution, candidate inspection, facade diagnostics, and CLI mapping are complete.
Status: Foundation complete; individual v0.2.0 validation capabilities and
their settings remain future work.
This plan implements the enabling work in [model.md](model.md), guided by
[ADR 0003](../adr/0003-declarative-validation.md). It is written for a Luna
@@ -545,6 +546,11 @@ outside this implementation plan.
## Stage 8: Verify and document the completed foundation
**Completion:** Complete. `Check` and `Publish` now use one shared conversion
from the facade request into candidate validation. The full Go suite and public
API/dependency check pass, and the roadmap distinguishes the completed
foundation from the optional capabilities still to come.
**Outcome:** The enabling refactor is complete, its current boundary is clear,
and later feature implementation can proceed through the shared model.

View File

@@ -1,7 +1,7 @@
# Validation API and profile model
Status: Agreed direction for v0.2.0; the staged plan records the API design
and agreed incremental rollout.
Status: Shared validation foundation implemented; optional v0.2.0 capabilities
and their public/profile settings remain future work.
This roadmap describes the shared model that enables the optional validation
capabilities in the [v0.2.0 roadmap](v0.2.0.md). It owns their common API,
@@ -124,11 +124,17 @@ failure-stopping behavior of the candidate workflow.
## Implementation
The [implementation plan](implementation.md) defines the enabling sequence,
proposed declarations and diagnostics, inspection primitives, verification,
and documentation work. Individual capabilities supply their behavioral
coverage as they are implemented. The target state above describes the complete
model across those capabilities.
The [implementation plan](implementation.md) records the completed foundation:
shared execution, internal diagnostics, captured candidate-tree inspection and
destination resolution, facade diagnostics, and consistent CLI presentation.
The public `ReleaseRequest.Validation` field and profile `validation` object are
not yet available; each setting will be introduced with its first working
capability. Individual checkers, module-selected CI tooling, and the publication
endpoint expectation remain future work in the [v0.2.0 roadmap](v0.2.0.md).
The target state above describes the complete model across those capabilities.
Foundation completion establishes their shared owners and conversion boundaries,
but does not mean the optional checks are implemented or that v0.2.0 is complete.
## Adoption evidence

View File

@@ -3,7 +3,6 @@ package releasekit
import (
"context"
internalbuild "gitea.maximumdirect.net/eric/ReleaseKit/internal/build"
"gitea.maximumdirect.net/eric/ReleaseKit/internal/publish"
)
@@ -60,14 +59,15 @@ type PublicationResult struct {
// an unreadable result is unknown. A nil error means publication is confirmed
// by the successful push or exact remote object match.
func Publish(ctx context.Context, request ReleaseRequest) (PublicationResult, error) {
candidateInput := candidateRequest(request)
result, err := publish.Publish(ctx, publish.Request{
RepositoryDir: request.RepositoryDir,
Product: request.Product,
Version: request.Version,
RepositoryDir: candidateInput.RepositoryDir,
Product: candidateInput.Product,
Version: candidateInput.Version,
Remote: request.Remote,
AdditionalChecks: candidateChecks(request.AdditionalChecks),
AfterValidate: internalbuild.CandidateCallback(internalBuildSpec(request.Build), request.Output),
Output: request.Output,
AdditionalChecks: candidateInput.AdditionalChecks,
AfterValidate: candidateInput.AfterValidate,
Output: candidateInput.Output,
})
return PublicationResult{
Version: result.Version,