Complete shared validation foundation
This commit is contained in:
20
check.go
20
check.go
@@ -42,14 +42,7 @@ type ReleaseRequest struct {
|
|||||||
// branch, HEAD, worktree, index, and local tag state. Success establishes local
|
// branch, HEAD, worktree, index, and local tag state. Success establishes local
|
||||||
// candidate evidence only; it does not establish remote availability.
|
// candidate evidence only; it does not establish remote availability.
|
||||||
func Check(ctx context.Context, request ReleaseRequest) (Candidate, error) {
|
func Check(ctx context.Context, request ReleaseRequest) (Candidate, error) {
|
||||||
checked, err := candidate.Check(ctx, candidate.Request{
|
checked, err := candidate.Check(ctx, candidateRequest(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,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Candidate{}, convertValidationError(err)
|
return Candidate{}, convertValidationError(err)
|
||||||
}
|
}
|
||||||
@@ -60,6 +53,17 @@ func Check(ctx context.Context, request ReleaseRequest) (Candidate, error) {
|
|||||||
}, nil
|
}, 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 {
|
func candidateChecks(checks func(context.Context, Candidate) error) func(context.Context, candidate.Candidate) error {
|
||||||
if checks == nil {
|
if checks == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# Validation model implementation plan
|
# 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
|
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
|
[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
|
## 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,
|
**Outcome:** The enabling refactor is complete, its current boundary is clear,
|
||||||
and later feature implementation can proceed through the shared model.
|
and later feature implementation can proceed through the shared model.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Validation API and profile model
|
# Validation API and profile model
|
||||||
|
|
||||||
Status: Agreed direction for v0.2.0; the staged plan records the API design
|
Status: Shared validation foundation implemented; optional v0.2.0 capabilities
|
||||||
and agreed incremental rollout.
|
and their public/profile settings remain future work.
|
||||||
|
|
||||||
This roadmap describes the shared model that enables the optional validation
|
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,
|
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
|
## Implementation
|
||||||
|
|
||||||
The [implementation plan](implementation.md) defines the enabling sequence,
|
The [implementation plan](implementation.md) records the completed foundation:
|
||||||
proposed declarations and diagnostics, inspection primitives, verification,
|
shared execution, internal diagnostics, captured candidate-tree inspection and
|
||||||
and documentation work. Individual capabilities supply their behavioral
|
destination resolution, facade diagnostics, and consistent CLI presentation.
|
||||||
coverage as they are implemented. The target state above describes the complete
|
The public `ReleaseRequest.Validation` field and profile `validation` object are
|
||||||
model across those capabilities.
|
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
|
## Adoption evidence
|
||||||
|
|
||||||
|
|||||||
14
publish.go
14
publish.go
@@ -3,7 +3,6 @@ package releasekit
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
internalbuild "gitea.maximumdirect.net/eric/ReleaseKit/internal/build"
|
|
||||||
"gitea.maximumdirect.net/eric/ReleaseKit/internal/publish"
|
"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
|
// an unreadable result is unknown. A nil error means publication is confirmed
|
||||||
// by the successful push or exact remote object match.
|
// by the successful push or exact remote object match.
|
||||||
func Publish(ctx context.Context, request ReleaseRequest) (PublicationResult, error) {
|
func Publish(ctx context.Context, request ReleaseRequest) (PublicationResult, error) {
|
||||||
|
candidateInput := candidateRequest(request)
|
||||||
result, err := publish.Publish(ctx, publish.Request{
|
result, err := publish.Publish(ctx, publish.Request{
|
||||||
RepositoryDir: request.RepositoryDir,
|
RepositoryDir: candidateInput.RepositoryDir,
|
||||||
Product: request.Product,
|
Product: candidateInput.Product,
|
||||||
Version: request.Version,
|
Version: candidateInput.Version,
|
||||||
Remote: request.Remote,
|
Remote: request.Remote,
|
||||||
AdditionalChecks: candidateChecks(request.AdditionalChecks),
|
AdditionalChecks: candidateInput.AdditionalChecks,
|
||||||
AfterValidate: internalbuild.CandidateCallback(internalBuildSpec(request.Build), request.Output),
|
AfterValidate: candidateInput.AfterValidate,
|
||||||
Output: request.Output,
|
Output: candidateInput.Output,
|
||||||
})
|
})
|
||||||
return PublicationResult{
|
return PublicationResult{
|
||||||
Version: result.Version,
|
Version: result.Version,
|
||||||
|
|||||||
Reference in New Issue
Block a user