Merge pull request 'The link knows a superseded report (issue 031)' (#36) from feat/migration-blockers into main

This commit was merged in pull request #36.
This commit is contained in:
2026-09-21 13:48:43 +02:00
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -7,6 +7,7 @@ import (
"encoding/base64" "encoding/base64"
"errors" "errors"
"fmt" "fmt"
"log"
"sort" "sort"
"github.com/novox/mesh-controller/internal/broker" "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 // 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. // 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.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) return e.Inventory.Seen(ctx, node.ID)
} }
// What it did is kept whichever way it went. Until this, a refusal or a failure moved // 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"` Applied []string `json:"applied,omitempty"`
Failed map[string]string `json:"failed,omitempty"` Failed map[string]string `json:"failed,omitempty"`
Refused string `json:"refused,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. // Carried are the machine's ports held by what that host raised from its own bundle.
// //