The part build-step lacks the check job's toolchain and types the check answer's fetch as the fetch arguments; both are kept in askrun_gaps.go until the part has them. Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
53 lines
2.0 KiB
Go
53 lines
2.0 KiB
Go
package buildstep
|
|
|
|
// Two layouts the part build-step (mesh-delivery-sdk buildstep, as the three node-build seats generate it) lacks, which a
|
|
// check ask still carries; both are kept here and nowhere else, so that deleting this file is the whole change once the
|
|
// part has them (B5i finding 1 and 2, issue 1966):
|
|
//
|
|
// - the check job's toolchain (novox/hq ADR 0584 clause 2): the part's CheckJob has no `toolchain`, so a node on
|
|
// another toolchain than the checker agreed would take the ask and record a pass it did not run. The Puller reads
|
|
// the field from the ask's own bytes and the run takes it from its context.
|
|
// - the check answer's fetch: the part types the answer's `fetch` as Fetch (the arguments), but the fetch tool's answer
|
|
// (workspace, merge, conflicts, changed, modules) is what the checker reads a conflict from.
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
|
|
)
|
|
|
|
type checkToolchainKey struct{}
|
|
|
|
// checkToolchainOf reads the toolchain a check ask names, from the ask's bytes; nil when it names none or is no check.
|
|
func checkToolchainOf(data []byte) *sdkstep.ToolchainUsed {
|
|
var a struct {
|
|
Check *struct {
|
|
Toolchain *sdkstep.ToolchainUsed `json:"toolchain"`
|
|
} `json:"check"`
|
|
}
|
|
if json.Unmarshal(data, &a) != nil || a.Check == nil {
|
|
return nil
|
|
}
|
|
return a.Check.Toolchain
|
|
}
|
|
|
|
// WithCheckToolchain is ctx carrying the toolchain the ask in data names for its check.
|
|
func WithCheckToolchain(ctx context.Context, data []byte) context.Context {
|
|
if tc := checkToolchainOf(data); tc != nil {
|
|
return context.WithValue(ctx, checkToolchainKey{}, tc)
|
|
}
|
|
return ctx
|
|
}
|
|
|
|
func checkToolchain(ctx context.Context) *sdkstep.ToolchainUsed {
|
|
tc, _ := ctx.Value(checkToolchainKey{}).(*sdkstep.ToolchainUsed)
|
|
return tc
|
|
}
|
|
|
|
// CheckAnswer is a check ask's answer with the fetch tool's own answer as it is.
|
|
type CheckAnswer struct {
|
|
Fetch json.RawMessage `json:"fetch"`
|
|
Levels []sdkstep.LevelAnswer `json:"levels,omitempty"`
|
|
}
|