The post-migration comparison had the two versions counting domains differently, and yesterday's wiring turned that into a gate: `run` would have failed a migration that lost nothing. The 0.15 side added every domain appearing in any account's address on top of the domain principals - the fallback's own comment says "if the instance has no explicit domain principals", but the loop ran unconditionally. The 0.16 side did the reverse, listing only domains some account calls its primary, discarding the full Domain list it had already fetched. An instance with three declared domains and accounts aliased across nine reported nine before and three after. INBUXA is exactly that shape, and this was the account/domain over-count noted as undiagnosed. Both sides now mean "the domains this server holds". A domain that still goes missing is reported as a warning rather than failing the run: what the two versions call a domain differs across this boundary in ways we have now been caught by once, and a missing account - which is compared with a local-part fallback and is what actually matters - still fails. Narrowing OK() also made String() return before printing the domain lines, so the new warning would have been silent. Caught by its own test.
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
// SPDX-FileCopyrightText: 2026 LINUXexpert-org
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package validate
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type Status string
|
|
|
|
const (
|
|
StatusOK Status = "ok"
|
|
StatusFail Status = "fail"
|
|
// StatusSkip is a check that could not be performed. It is deliberately
|
|
// not StatusOK: "every account survived" and "we were unable to look"
|
|
// are different answers, and reporting the second as the first is the
|
|
// failure mode ARCHITECTURE.md §4.7 warns about.
|
|
StatusSkip Status = "skip"
|
|
// StatusWarn is a finding worth an operator's attention that is not
|
|
// worth failing a migration over.
|
|
StatusWarn Status = "warn"
|
|
)
|
|
|
|
type CheckResult struct {
|
|
Name string
|
|
Status Status
|
|
Detail string
|
|
}
|
|
|
|
type Report struct {
|
|
Results []CheckResult
|
|
}
|
|
|
|
func (r Report) Blocking() bool {
|
|
for _, res := range r.Results {
|
|
if res.Status == StatusFail {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (r Report) String() string {
|
|
var b strings.Builder
|
|
for _, res := range r.Results {
|
|
fmt.Fprintf(&b, "[%-4s] %-16s %s\n", strings.ToUpper(string(res.Status)), res.Name, res.Detail)
|
|
}
|
|
return b.String()
|
|
}
|