refactor(api): use audit operation constants and the shared zone not found error in zone handlers

- refactor(api): use audit operation constants and the shared zone not found error in zone handlers
- fix(api): return the stored content of rows with check errors
- fix(api): return warnings from record deletes, zone creation and import apply
- fix(api): allow repairing rows stored with a non canonical zone and invalid SOA sets
- fix(check): accept JSON column formatting and an absent SOA serial as canonical content
- fix(ui): match audit diff items by identity instead of array index
- fix(ui): count the SOA change once, report import warnings and check the request size
- fix(ui): edit the selected SOA row, keep the server order, show error rows raw and report write warnings
- test(check): cover triggering and clean pairs with exact codes and record ids
- test(records): cover SRV port, SOA timer and CAA value boundaries
- test(cli): check the exact check output and the exit code of warning-only zones
- refactor(import): order current rows with cmp.Compare
- test(check): cover malformed stored content and a mailbox stored as an address
- test(api): cover zone write failure paths, ambiguous SOA updates and unchanged record detection
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent 53444bec7a
commit a7ba01fc77
21 files changed
+1315 -170

No files matched your search

+2 -10
View File
@@ -6,6 +6,7 @@ package main
import (
"bufio"
"bytes"
"cmp"
"crypto/sha256"
"errors"
"fmt"
@@ -337,16 +338,7 @@ func diffZoneImport(zone string, current []recordRow, imported zoneFileRecords,
Skipped: imported.Skipped, Warnings: slices.Clone(imported.Warnings), Fingerprint: zoneFingerprint(current),
}
current = slices.Clone(current)
slices.SortStableFunc(current, func(a, b recordRow) int {
switch {
case a.ID < b.ID:
return -1
case a.ID > b.ID:
return 1
default:
return 0
}
})
slices.SortStableFunc(current, func(a, b recordRow) int { return cmp.Compare(a.ID, b.ID) })
byIdentity := make(map[recordIdentity][]int)
var soaIndices []int
for i, row := range current {