Files
mesh-delivery/sdk/buildlog/buildlog.go
T
jschoubben 28ef5af2df DLV-B9 readers: the indexer and the view read the builder's log kinds through one helper of mesh-delivery's sdk
The two copies of IsBuildEntry move into sdk/buildlog, which both modules already require from the repository's own
sdk module (the lead's ruling 5 on A2c's finding 5). The existing rows in the indexer's registered test and the view's
history test cover it unchanged.

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
2026-11-04 13:24:17 +01:00

22 lines
781 B
Go

// Package buildlog reads the builder's log as mesh-delivery's parts that follow it read it: the indexer and the view.
package buildlog
import (
"encoding/json"
"git.novox.be/novox/mesh-sdk/go/delivery"
)
// IsBuildEntry says whether an entry of the builder's log is a build's start or end, read from its event alone, so an
// entry of another kind (a build's narration, build.said) is passed over before its form is read. One whose event
// cannot be read is taken as a build's, so its decoding says what is wrong with it.
func IsBuildEntry(value []byte) bool {
var e struct {
Event *string `json:"event"`
}
if json.Unmarshal(value, &e) != nil || e.Event == nil {
return true
}
return *e.Event == delivery.BuildStartedEvent || *e.Event == delivery.BuildEndedEvent
}