Compare views rebuilt: from the zone's view, in sections, one line per record

The Compare views tab and jarl zone diff compare a zone with the same zone in other views from the view you're on: a summary per view, what is answered differently (Use this everywhere), the names only some views have (Add to VIEW), and how many are the same. One name can be compared (jarl zone diff ZONE NAME [TYPE], a Compare button per record). The CLI prints one line per record, cut to the terminal (--wide shows it whole); the web UI cuts long values with the whole one on hover. GET /zones/{zone}/compare returns these sections, with ?with, ?name and ?type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-13 10:55:57 +01:00
1 parent ec16de875d
commit b1719ce362
12 files changed
+656 -146

No files matched your search

+21 -4
View File
@@ -418,11 +418,28 @@ expect_dig "now every view's" "10.1.1.1" -k $E/external.key linked.adbraun.test
run "--view all changes a link once" 0 $J record set adbraun.test linked A 10.1.1.2 --view all
contains "linked with internal"
expect_dig "both views" "10.1.1.2" -k $E/external.key linked.adbraun.test A
run "zone diff: what differs between the views" 0 $J zone diff adbraun.test
contains "ns1 *A *127.0.0.1 \\[local, id [0-9]*\\] *203.0.113.1 \\[local, id [0-9]*\\]"
contains "names and types differ, [0-9]* are the same; linked"
run "the compare API" 0 curl -sf -H "Authorization: Bearer $(cat $E/admin.token)" "http://127.0.0.1:$HTTP/api/v1/zones/adbraun.test/compare?view=internal&all=1"
run "zone diff: internal compared with external" 0 $J zone diff adbraun.test
contains "^adbraun.test in internal, compared with external$"
contains "^ linked: a difference is a view's own records"
contains "^ external: [1-9][0-9]* answered differently, [0-9]* only in internal, [0-9]* only in external, [0-9]* the same"
contains "^ANSWERED DIFFERENTLY"
contains "^ ns1 A$"
contains "^ internal 127.0.0.1 \\[local, id [0-9]*\\]"
contains "^ external 203.0.113.1 \\[local, id [0-9]*\\]"
contains "the same (--all lists them)"
run "zone diff from external" 0 $J zone diff adbraun.test --view external
contains "^adbraun.test in external, compared with internal"
run "zone diff for one name" 0 $J zone diff adbraun.test ns1 A
contains "^ ns1 A$"
not_contains "the same (--all"
run "a long TXT record" 0 $J record add adbraun.test longtxt TXT "$(printf 'x%.0s' $(seq 300))" --view internal --local
run "zone diff --wide shows it whole" 0 $J zone diff adbraun.test longtxt --wide
contains "x\\{250\\}"
run "the compare API" 0 curl -sf -H "Authorization: Bearer $(cat $E/admin.token)" "http://127.0.0.1:$HTTP/api/v1/zones/adbraun.test/compare?view=internal&with=external&all=1"
contains '"linked":true'
contains '"base":"internal"'
contains '"same_rows":\['
run "remove the long TXT" 0 $J record delete adbraun.test longtxt TXT --view internal -y
run "a shared delete" 0 $J record delete adbraun.test linked A --view external -y
expect_dig "gone from internal too" "" linked.adbraun.test A
run "zone unlink" 0 $J zone unlink adbraun.test --view external