The REST API imports a master file into a zone, creates a zone from one, and exports a zone as a master file #183

Open
opened 2026-10-31 12:42:22 -04:00 by claude · 0 comments
Owner
  • Draft: PN-39
  • Priority: medium
  • Agent: coder
  • Depends on: #180, #182
  • Decisions: Q-PN-12

Why

Operators move zones in and out through the API and the console.

What changes

  • New ZoneFileImportService in src/dotnet/src/Ninlil.Dns.Server.Authoritative/: text → wire → RecordEntityCodec.FromWireRecord, in one unit of work. Modes: Replace (the zone's records become the file's) and Merge (adds records the zone lacks, never deletes); both take dryRun, which reports added, removed and unchanged counts and writes nothing.
    • Technical call: RRSIG, NSEC, NSEC3, NSEC3PARAM and DNSKEY records are skipped with a warning when Ninlil signs the zone itself. The SOA serial is kept monotonic, never moved backwards.
    • Records are published through the same zone-change path the REST record writes use, so IXFR, NOTIFY and cluster sync follow.
  • ZonesController:
    • GET api/zones/{id}/export (zones:read, media type text/dns per RFC 4027)
    • POST api/zones/{id}/import (zones:write, mode, dryRun, size cap)
    • POST api/zones/import (zones:write) creates a primary zone from a file whose origin comes from $ORIGIN or a parameter; 409 when the zone exists; dryRun supported.

Acceptance

  • This test fails first: Import_WithDryRun_ReportsRecordCountsAndWritesNothing in src/dotnet/tests/Ninlil.Web.Tests.
  • Tests: replace removes a record the file lacks; merge keeps it; create-from-file; 409 for an existing zone; signed-zone DNSSEC skip; export round trip; the size cap; a line error returns 400 with the line number.
  • Gate: dotnet test src/dotnet/tests/Ninlil.Dns.Server.Authoritative.Tests, dotnet test src/dotnet/tests/Ninlil.Web.Tests.

Source

audit-feature-parity.md §2A #16.
Owner decision 2026-10-31: "replace + merge (dry run) + create-from-file" (Q-PN-12).

- **Draft:** PN-39 - **Priority:** medium - **Agent:** coder - **Depends on:** #180, #182 - **Decisions:** Q-PN-12 ### Why Operators move zones in and out through the API and the console. ### What changes - New `ZoneFileImportService` in `src/dotnet/src/Ninlil.Dns.Server.Authoritative/`: text → wire → `RecordEntityCodec.FromWireRecord`, in one unit of work. Modes: `Replace` (the zone's records become the file's) and `Merge` (adds records the zone lacks, never deletes); both take `dryRun`, which reports added, removed and unchanged counts and writes nothing. - Technical call: RRSIG, NSEC, NSEC3, NSEC3PARAM and DNSKEY records are skipped with a warning when Ninlil signs the zone itself. The SOA serial is kept monotonic, never moved backwards. - Records are published through the same zone-change path the REST record writes use, so IXFR, NOTIFY and cluster sync follow. - `ZonesController`: - `GET api/zones/{id}/export` (`zones:read`, media type `text/dns` per RFC 4027) - `POST api/zones/{id}/import` (`zones:write`, `mode`, `dryRun`, size cap) - `POST api/zones/import` (`zones:write`) creates a primary zone from a file whose origin comes from `$ORIGIN` or a parameter; 409 when the zone exists; `dryRun` supported. ### Acceptance - [ ] This test fails first: `Import_WithDryRun_ReportsRecordCountsAndWritesNothing` in `src/dotnet/tests/Ninlil.Web.Tests`. - [ ] Tests: replace removes a record the file lacks; merge keeps it; create-from-file; 409 for an existing zone; signed-zone DNSSEC skip; export round trip; the size cap; a line error returns 400 with the line number. - [ ] Gate: `dotnet test src/dotnet/tests/Ninlil.Dns.Server.Authoritative.Tests`, `dotnet test src/dotnet/tests/Ninlil.Web.Tests`. ### Source `audit-feature-parity.md` §2A #16. Owner decision 2026-10-31: "replace + merge (dry run) + create-from-file" (Q-PN-12).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#183
No description provided.