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

+1 -37
View File
@@ -56,7 +56,7 @@ export function presentValue(record) {
case "CAA":
return data.flag + " " + data.tag + ' "' + data.value + '"';
case "SOA":
return [data.ns, data.MBox !== undefined ? data.MBox : data.mbox, data.serial === null || data.serial === undefined ? "dynamic" : data.serial, data.refresh, data.retry, data.expire, data.minttl].join(" ");
return [data.ns, data.MBox !== undefined ? data.MBox : data.mbox, data.serial == null || data.serial === 0 ? "dynamic (Unix time)" : data.serial, data.refresh, data.retry, data.expire, data.minttl].join(" ");
default:
return JSON.stringify(data);
}
@@ -66,42 +66,6 @@ export function displayName(record) {
return record.name === "" ? "@" : record.name;
}
function nameLabels(name) {
return name === "" ? [] : name.toLowerCase().split(".").reverse();
}
function compareLabels(a, b) {
const left = nameLabels(a);
const right = nameLabels(b);
const length = Math.min(left.length, right.length);
for (let i = 0; i < length; i += 1) {
if (left[i] < right[i]) return -1;
if (left[i] > right[i]) return 1;
}
return left.length - right.length;
}
function typeRank(type) {
if (type === "SOA") return 0;
if (type === "NS") return 1;
return 2;
}
export function compareRecords(a, b) {
const byName = compareLabels(a.name, b.name);
if (byName !== 0) return byName;
const byRank = typeRank(a.type) - typeRank(b.type);
if (byRank !== 0) return byRank;
if (a.type !== b.type) return a.type < b.type ? -1 : 1;
const left = presentValue(a);
const right = presentValue(b);
return left.localeCompare(right, "en", { numeric: true });
}
export function sortRecords(records) {
return [...records].sort(compareRecords);
}
export function matchesFilter(record, type, text) {
if (type && record.type !== type) return false;
if (!text) return true;