Files
mesh-delivery/modules/mesh-delivery-pipeline/internal/pipeline/toolchain.go
T
jschoubben 960c8e104a §416, §25, A-104: a step ask carries the kept results of its package and the toolchain of its language
The asking half reads, in one pass for all a pipeline's asks, the kept entries whose package is the artifact's package from
the catalog entry or lies beneath it, and the runner's own toolchain per language, kept in the new state toolchains as
heard from toolchain-agreed.

Builds: design 47 G §25, §416, A-104

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-11 23:43:35 +01:00

29 lines
1.1 KiB
Go

package pipeline
import (
"encoding/json"
"strings"
builds "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshbuilds"
nodebuildgo "git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildgo"
)
// ToolchainOf reads a toolchain-agreed as the toolchain a step ask names: its language and version (design 47 G §416, A-104).
// The recipe and the building node's digest are the seat's to report, not the runner's to know.
func ToolchainOf(raw []byte) (*nodebuildgo.ToolchainUsed, error) {
var t builds.ToolchainAgreed
if err := json.Unmarshal(raw, &t); err != nil {
return nil, err
}
if t.Language == "" {
return nil, nil
}
return &nodebuildgo.ToolchainUsed{Language: t.Language, Version: t.Version}, nil
}
// InPackage says whether a kept result's package is the artifact's package name or lies beneath it (A-104: the kept entries
// whose package is the artifact's package, a Go module's packages being the module path and the paths beneath it).
func InPackage(pkg, name string) bool {
return name != "" && (pkg == name || strings.HasPrefix(pkg, name+"/"))
}