DLV-T (A2d): a package's version is a full commit or a Go semantic version, a group's tagged version
delivery.PackageVersions.Check takes v0.1.15-feat-x.2 beside a full commit (ADR 0607 §3, §5): a delivery group's check names the group's tagged version. A2d's patch, whole. Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
+10
-4
@@ -266,17 +266,19 @@ type StepAsk struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PackageVersions are the versions of the mesh packages a build or a check builds against, by package (a Go module's
|
// PackageVersions are the versions of the mesh packages a build or a check builds against, by package (a Go module's
|
||||||
// path), each a full commit (novox/hq ADR 0573 §2).
|
// path): each a full commit (novox/hq ADR 0573 §2), or a Go semantic version, the form a delivery group's check names the
|
||||||
|
// group's tagged version in (`v0.1.15-feat-x.2`, ADR 0607 §3, §5; design 51 *Tagged versions*).
|
||||||
type PackageVersions map[string]string
|
type PackageVersions map[string]string
|
||||||
|
|
||||||
// Check refuses a package that is no module path or a version that is no full commit, naming it.
|
// Check refuses a package that is no module path or a version that is neither a full commit nor a Go semantic version,
|
||||||
|
// naming it.
|
||||||
func (p PackageVersions) Check() error {
|
func (p PackageVersions) Check() error {
|
||||||
for pkg, version := range p {
|
for pkg, version := range p {
|
||||||
if pkg == "" || strings.ContainsAny(pkg, " \t\n@") || strings.HasPrefix(pkg, "/") {
|
if pkg == "" || strings.ContainsAny(pkg, " \t\n@") || strings.HasPrefix(pkg, "/") {
|
||||||
return fmt.Errorf("delivery: the package %q is no module path", pkg)
|
return fmt.Errorf("delivery: the package %q is no module path", pkg)
|
||||||
}
|
}
|
||||||
if !askCommitOK.MatchString(version) {
|
if !askCommitOK.MatchString(version) && !PackageSemver.MatchString(version) {
|
||||||
return fmt.Errorf("delivery: the package %s names the version %q, which is no full commit", pkg, version)
|
return fmt.Errorf("delivery: the package %s names the version %q, which is neither a full commit nor a Go semantic version (v0.1.15-feat-x.2)", pkg, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -527,6 +529,10 @@ func (c CheckJob) check(id string) error {
|
|||||||
|
|
||||||
var askCommitOK = regexp.MustCompile(`^[0-9a-f]{40}$`)
|
var askCommitOK = regexp.MustCompile(`^[0-9a-f]{40}$`)
|
||||||
|
|
||||||
|
// PackageSemver is a Go semantic version a package may be named at (PackageVersions): v, three numbers, and an optional
|
||||||
|
// pre-release of Semantic Versioning's characters (a tagged version's, ADR 0607 §1).
|
||||||
|
var PackageSemver = regexp.MustCompile(`^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$`)
|
||||||
|
|
||||||
// checkFetchArgs refuses fetch arguments with no repository or no full commit; the rest is the build module's fetch to
|
// checkFetchArgs refuses fetch arguments with no repository or no full commit; the rest is the build module's fetch to
|
||||||
// judge, as a direct call's is.
|
// judge, as a direct call's is.
|
||||||
func checkFetchArgs(id string, args map[string]any) error {
|
func checkFetchArgs(id string, args map[string]any) error {
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ func checkAsk() StepAsk {
|
|||||||
Check: &CheckJob{Fetch: map[string]any{"repository": "novox/mesh-catalog", "commit": askCommit, "ref": "refs/pull/3/head", "base": askCommit},
|
Check: &CheckJob{Fetch: map[string]any{"repository": "novox/mesh-catalog", "commit": askCommit, "ref": "refs/pull/3/head", "base": askCommit},
|
||||||
Levels: []string{LevelUnit, LevelIntegration}, Kept: true, Runner: "workspace", RunnerWhen: "modules/mesh-build-go/", Run: "",
|
Levels: []string{LevelUnit, LevelIntegration}, Kept: true, Runner: "workspace", RunnerWhen: "modules/mesh-build-go/", Run: "",
|
||||||
NodeNames: []string{"anchor", "laptop"}},
|
NodeNames: []string{"anchor", "laptop"}},
|
||||||
Packages: PackageVersions{"git.novox.be/novox/mesh-sdk/go": askCommit, "git.novox.be/novox/mesh-controller/modules/route-proxy/contract": askCommit}}
|
Packages: PackageVersions{"git.novox.be/novox/mesh-sdk/go": askCommit, "git.novox.be/novox/mesh-controller/modules/route-proxy/contract": askCommit,
|
||||||
|
"git.novox.be/novox/mesh-contracts/go": "v0.1.15-feat-x.2"}} // ADR 0607 §5: a group's tagged version
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1887/A1a: an ask encodes and decodes with every field; 1585/S4: the package versions too.
|
// 1887/A1a: an ask encodes and decodes with every field; 1585/S4: the package versions too.
|
||||||
@@ -61,9 +62,11 @@ func TestAskRefusesUnknownKindAndLanguage(t *testing.T) {
|
|||||||
"commit": func(a *StepAsk) { a.Build.Fetch = map[string]any{"repository": "novox/x", "commit": "main"} },
|
"commit": func(a *StepAsk) { a.Build.Fetch = map[string]any{"repository": "novox/x", "commit": "main"} },
|
||||||
"path": func(a *StepAsk) { a.Build.Path = "" },
|
"path": func(a *StepAsk) { a.Build.Path = "" },
|
||||||
"needs": func(a *StepAsk) { a.Needs = []string{NeedNodeBuildNode} }, // issue 890: a build needs no node
|
"needs": func(a *StepAsk) { a.Needs = []string{NeedNodeBuildNode} }, // issue 890: a build needs no node
|
||||||
// Issue 1585: a package's version is a full commit, of a module path.
|
// Issue 1585, ADR 0607 §5: a package's version is a full commit or a Go semantic version, of a module path.
|
||||||
"version": func(a *StepAsk) { a.Packages["git.novox.be/novox/mesh-sdk/go"] = "v0.1.7" },
|
"version": func(a *StepAsk) { a.Packages["git.novox.be/novox/mesh-sdk/go"] = "main" },
|
||||||
"package": func(a *StepAsk) { a.Packages["git.novox.be/novox/x y"] = askCommit },
|
"no v": func(a *StepAsk) { a.Packages["git.novox.be/novox/mesh-sdk/go"] = "0.1.15-feat-x.2" },
|
||||||
|
"pre-chars": func(a *StepAsk) { a.Packages["git.novox.be/novox/mesh-sdk/go"] = "v0.1.15-feat/x.2" },
|
||||||
|
"package": func(a *StepAsk) { a.Packages["git.novox.be/novox/x y"] = askCommit },
|
||||||
"compose": func(a *StepAsk) {
|
"compose": func(a *StepAsk) {
|
||||||
a.Kind, a.Build = AskCheck, nil
|
a.Kind, a.Build = AskCheck, nil
|
||||||
a.Compose = &ComposeJob{Fetch: map[string]any{"repository": "novox/mesh-sdk", "commit": askCommit}, Dir: "go", Package: "x", Request: json.RawMessage(`{}`)}
|
a.Compose = &ComposeJob{Fetch: map[string]any{"repository": "novox/mesh-sdk", "commit": askCommit}, Dir: "go", Package: "x", Request: json.RawMessage(`{}`)}
|
||||||
|
|||||||
Reference in New Issue
Block a user