The link knows a superseded report (issue 031)

This commit is contained in:
2026-09-21 12:11:52 +02:00
parent 153990348c
commit 1ab0364705
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -7,6 +7,7 @@ import (
"encoding/base64"
"errors"
"fmt"
"log"
"sort"
"github.com/novox/mesh-controller/internal/broker"
@@ -161,6 +162,9 @@ func (e Enrolment) Heard(ctx context.Context, report Report) error {
// this with only a node name; a real report always carries an account (something applied, or
// a refusal, or a failure), so those are the reports that get written down.
if report.Applied == nil && report.Refused == "" && len(report.Failed) == 0 {
if report.Superseded != "" {
log.Printf("%s set aside declaration %s for the newer %s", report.Node, report.Declared, report.Superseded)
}
return e.Inventory.Seen(ctx, node.ID)
}
// What it did is kept whichever way it went. Until this, a refusal or a failure moved
+5
View File
@@ -85,6 +85,11 @@ type Report struct {
Applied []string `json:"applied,omitempty"`
Failed map[string]string `json:"failed,omitempty"`
Refused string `json:"refused,omitempty"`
// Superseded names the newer declaration the reported one was set aside for, unapplied — a
// machine asked to be several things in a row becomes the last (novox/hq issue 031). Not an
// account of the machine: it moves last_seen and nothing else, like a bare word that the node
// is there, because the report for the declaration that WAS applied follows at once.
Superseded string `json:"superseded,omitempty"`
// Carried are the machine's ports held by what that host raised from its own bundle.
//