ADR 0573 §4 makes refusing a member for its mesh-sdk pin a fault of the check (issue 1585, S14). Every Go check ask now carries the latest published version of each package, or the head of the group member that publishes it, so the pin check, its forge reads and its tests go, and the controller's tests read mesh-sdk at the version it is built with. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
129 lines
6.0 KiB
Go
129 lines
6.0 KiB
Go
package check
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/buildstep"
|
|
"git.novox.be/novox/mesh-sdk/go/delivery"
|
|
)
|
|
|
|
// The shapes of what the build modules' steps answer, as their code writes them (mesh-catalog modules/mesh-build-go
|
|
// cmd/mesh-build-go levels.go TestResult, digest.go DigestResult, fetch.go FetchResult; modules/mesh-build-node
|
|
// cmd/mesh-build-node check.go TestResult, fetch.go FetchResult) with the fields the fetch step adds for a merge (ADR 0484
|
|
// clause 3). Only the fields the checker reads are named; the rest is ignored.
|
|
|
|
// MergeTree is what a fetch that merged says of one module directory: the tree sha, the digest of its manifest, the
|
|
// hashes of its lock files by name and the objects of its named paths. A bare string is the tree alone.
|
|
type MergeTree struct {
|
|
Tree string `json:"tree"`
|
|
Manifest string `json:"manifest,omitempty"`
|
|
Locks map[string]string `json:"locks,omitempty"`
|
|
// Paths are, of a module whose every artifact names its paths, each named path's object; Tree is then their named
|
|
// tree (mesh-sdk buildstep.ModuleTree, novox/hq ADR 0499 clause 2).
|
|
Paths map[string]string `json:"paths,omitempty"`
|
|
// Packages are the mesh packages the directory's go.sum names (mesh-sdk buildstep.ModuleTree, novox/hq ADR 0573 §2).
|
|
Packages []string `json:"packages,omitempty"`
|
|
}
|
|
|
|
// UnmarshalJSON takes a string as the tree alone, or an object.
|
|
func (t *MergeTree) UnmarshalJSON(data []byte) error {
|
|
if s := strings.TrimSpace(string(data)); strings.HasPrefix(s, `"`) {
|
|
return json.Unmarshal(data, &t.Tree)
|
|
}
|
|
type plain MergeTree
|
|
return json.Unmarshal(data, (*plain)(t))
|
|
}
|
|
|
|
// Fetched is the answer of a build module's fetch step.
|
|
type Fetched struct {
|
|
Workspace string `json:"workspace"`
|
|
Commit string `json:"commit"`
|
|
Modules []string `json:"modules"`
|
|
// What a fetch with a base adds: the trunk commit, the merge commit, the files in conflict (a conflict is an answer),
|
|
// the paths the merge changes and the trees of the module directories.
|
|
Base string `json:"base,omitempty"`
|
|
Merge string `json:"merge,omitempty"`
|
|
Conflicts []string `json:"conflicts,omitempty"`
|
|
Changed []string `json:"changed,omitempty"`
|
|
Trees map[string]MergeTree `json:"trees,omitempty"`
|
|
// Programs are the changed files whose first bytes are an executable binary, read by the build module in its workspace
|
|
// (issue 1577); nil for a build module that does not report it, a pointer to an empty list for one that found none.
|
|
Programs *[]ProgramFile `json:"programs,omitempty"`
|
|
}
|
|
|
|
// ProgramFile is a changed file that is a compiled program, and its format (ELF, Mach-O or PE).
|
|
type ProgramFile struct {
|
|
Path string `json:"path"`
|
|
Kind string `json:"kind"`
|
|
// Commit is set for a program a commit of the branch added and a later one removed: it stays in history once merged.
|
|
Commit string `json:"commit,omitempty"`
|
|
}
|
|
|
|
// GoPackage is one package of a Go test result.
|
|
type GoPackage struct {
|
|
Dir string `json:"dir"`
|
|
Package string `json:"package"`
|
|
Passed bool `json:"passed"`
|
|
Elapsed float64 `json:"elapsed"`
|
|
Tests int `json:"tests"`
|
|
NoTests bool `json:"no_tests,omitempty"`
|
|
// Skipped is how many of the package's tests skipped; an older build module names none.
|
|
Skipped int `json:"skipped,omitempty"`
|
|
}
|
|
|
|
// Failure is a test that failed, or a package that failed with no test to name: the build modules' failure contract
|
|
// (buildstep.Failure, issue 1901), its cause never empty and never a passing line from a build module that keeps it.
|
|
type Failure = buildstep.Failure
|
|
|
|
// TestTime is one test and the seconds it took.
|
|
type TestTime struct {
|
|
Package string `json:"package"`
|
|
Test string `json:"test"`
|
|
Elapsed float64 `json:"elapsed"`
|
|
}
|
|
|
|
// Tested is the answer of a test step of either build module (the Go one names packages and counts tests; the Node one
|
|
// names the package directory as Module and counts none).
|
|
type Tested struct {
|
|
Level string `json:"level"`
|
|
Module string `json:"module,omitempty"`
|
|
Passed bool `json:"passed"`
|
|
Why string `json:"why,omitempty"`
|
|
NoTests bool `json:"no_tests,omitempty"`
|
|
Tests int `json:"tests"`
|
|
Skipped int `json:"skipped"`
|
|
Packages []GoPackage `json:"packages,omitempty"`
|
|
Elapsed float64 `json:"elapsed"`
|
|
Setup float64 `json:"setup,omitempty"`
|
|
// Lint is the unit level's gofmt and go vet time, before its tests (mesh-build-go, ADR 0529 §1).
|
|
Lint float64 `json:"lint,omitempty"`
|
|
Bound float64 `json:"bound"`
|
|
SetupBound float64 `json:"setup_bound,omitempty"`
|
|
Slowest []TestTime `json:"slowest,omitempty"`
|
|
Failed []Failure `json:"failed,omitempty"`
|
|
OverBound bool `json:"over_bound"`
|
|
OverWhich string `json:"over_which,omitempty"`
|
|
// JudgedBy is the program that ran the step (ADR 0535 §5): "installed", or "candidate <merge commit>" under runner
|
|
// workspace; absent from a build module that does not take the runner.
|
|
JudgedBy string `json:"judged_by,omitempty"`
|
|
// By is the build module that answered and the SDK it was built with (buildstep.By); absent from a build module from
|
|
// before the failure contract.
|
|
By string `json:"by,omitempty"`
|
|
}
|
|
|
|
// Digested is the answer of the Go build module's digest step: one digest per package that has tests at the level, by import
|
|
// path.
|
|
type Digested struct {
|
|
// Beside are the lines `<owner/repo> <commit>` of the siblings the digest folded in (DigestVersion 3, lead decision L5),
|
|
// sorted; absent when the workspace has none or the build module folds none in.
|
|
Beside []string `json:"beside,omitempty"`
|
|
Level string `json:"level"`
|
|
Packages map[string]string `json:"packages"`
|
|
WithoutTests []string `json:"without_tests,omitempty"`
|
|
// JudgedBy is the program that ran the digest, as Tested.JudgedBy says.
|
|
JudgedBy string `json:"judged_by,omitempty"`
|
|
// Needs are the packages whose tests need something of the node at this level (issue 890).
|
|
Needs []delivery.PackageNeeds `json:"needs,omitempty"`
|
|
}
|