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
This commit is contained in:
2026-11-04 13:24:17 +01:00
parent c04fa5ff62
commit 28ef5af2df
4 changed files with 27 additions and 30 deletions
@@ -1,7 +1,6 @@
package index
import (
"encoding/json"
"fmt"
"maps"
"slices"
@@ -9,6 +8,7 @@ import (
"sync"
"time"
"git.novox.be/novox/mesh-delivery/sdk/buildlog"
"git.novox.be/novox/mesh-sdk/go/delivery"
)
@@ -33,7 +33,7 @@ func NewBuilds() *Builds { return &Builds{records: map[string]delivery.BuildReco
// *The node-engine's own build*) is no build and is passed over, whatever its form. A build's entry that does not read, or
// names no module or repository, is refused and said.
func (b *Builds) Put(value []byte) error {
if !IsBuildEntry(value) {
if !buildlog.IsBuildEntry(value) {
return nil
}
e, err := delivery.DecodeBuildLogEntry(value)
@@ -184,16 +184,3 @@ func (b *Builds) Registered() []Registration {
}
return out
}
// 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 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
}
@@ -6,6 +6,7 @@ import (
"maps"
"slices"
"git.novox.be/novox/mesh-delivery/sdk/buildlog"
"git.novox.be/novox/mesh-sdk/go/delivery"
"mesh-delivery-indexer/internal/fingerprint"
@@ -23,7 +24,7 @@ import (
// Imports that cannot be resolved (a package the forge cannot list) are kept with no ImportForm: the next recompute that
// resolves them writes the import form, one rebuild too many, never a stale module.
func (ix *Indexer) ApplyBuildEnd(ctx context.Context, value []byte) error {
if !IsBuildEntry(value) {
if !buildlog.IsBuildEntry(value) {
return nil
}
e, err := delivery.DecodeBuildLogEntry(value)
@@ -14,6 +14,7 @@ import (
"sync/atomic"
"time"
"git.novox.be/novox/mesh-delivery/sdk/buildlog"
stdio "git.novox.be/novox/mesh-sdk/go"
"git.novox.be/novox/mesh-sdk/go/delivery"
)
@@ -895,7 +896,7 @@ func (r Reader) BuildHistory(module string, since time.Time) (HistoryAnswer, err
}
var entries []delivery.BuildLogEntry
for _, le := range page.Entries {
if !isBuildEntry(le.Value) {
if !buildlog.IsBuildEntry(le.Value) {
continue // an entry of another kind (the old reference form's close, design 51) is no build
}
e, err := delivery.DecodeBuildLogEntry(le.Value)
@@ -927,16 +928,3 @@ func (r Reader) BuildHistory(module string, since time.Time) (HistoryAnswer, err
out.More = page.Next != 0
return out, nil
}
// 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 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
}
+21
View File
@@ -0,0 +1,21 @@
// 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
}