IF Commons GitHub

DNS plugin: the commands

0002Active

0002-dns-command · owner if · domain commons

Requirements

FR-001checkpassing

The plugin MUST contribute the branch dns with the verbs plan and apply to the program it is given (archon by default) and take a function that gives, for a zone and the options the person gave, the records wanted and the provider, or a refusal with a code, an exit and the words; a refusal MUST end the command with that exit and name that code, and the options of the fleet's own MUST reach the function.

Enforced (check): .github: cd commons/archon-dns && bun run verify — suite/command.test.ts

Proved by: archon-dns/suite/command.test.ts

Written in: archon-dns/src/config.ts, archon-dns/src/mod.ts

Tests: passed: suite/command.test.ts the plugin composes with the verbs plan and apply, and a zone that is not for it to change

FR-002checkpassing

plan MUST read the zone only (never a change), say each record to create, update and remove, and print the hash of the plan, ending with 4 where there is something to approve and 0 where the plan is empty.

Enforced (check): .github: cd commons/archon-dns && bun run verify — suite/command.test.ts

Proved by: archon-dns/suite/command.test.ts

Written in: archon-dns/src/commands.ts, archon-dns/src/plan.ts

Tests: passed: suite/command.test.ts plan reads only and prints a hash, an apply of another hash or of a zone that changed is r

FR-003checkpassing

apply MUST carry out exactly the plan of the hash it is given and refuse another (the plan changed) with nothing changed, and refuse a plan that removes a record unless --allow-removal yes is given.

Enforced (check): .github: cd commons/archon-dns && bun run verify — suite/command.test.ts

Proved by: archon-dns/suite/command.test.ts

Written in: archon-dns/src/commands.ts, archon-dns/src/plan.ts

Tests: passed: suite/command.test.ts plan reads only and prints a hash, an apply of another hash or of a zone that changed is r

FR-004checkpassing

After an apply the plan MUST be made again and, where it is not empty, the command MUST end with 1 and say so; a provider that fails MUST end the command with 3 and the reason, with no token in it.

Enforced (check): .github: cd commons/archon-dns && bun run verify — suite/command.test.ts

Proved by: archon-dns/suite/command.test.ts

Written in: archon-dns/src/commands.ts

Tests: passed: suite/command.test.ts plan reads only and prints a hash, an apply of another hash or of a zone that changed is r; passed: suite/command.test.ts a provider that fails ends the command with 3 and the reason, with the token in none of wh

Acceptance scenarios

  1. Given a zone and the records wanted, When plan is run and then apply with its hash, Then the zone has the records and the next plan is empty, per FR-002 to FR-004.
  2. Given a plan that was approved and a zone that changed since, When apply is run, Then it is refused and nothing changed, per FR-003.

Out of scope

  • The provider, its token and the records themselves: the fleet's, with the library linux-services.

Edge cases

  • A record of another owner in the zone: never changed, per FR-002 (the plan of the library linux-services removes only the records it claims).
  • A removal not approved: refused with 2, per FR-003.

Assumptions

  • The provider answers over the network; a provider that does not is an exit of 3.

Open questions

  • None.

Key entities

  • Plan hash, Zone, Provider.

Success criteria

SC-001success criterion

A zone made as the fleet says has a second plan that is empty.

Review & acceptance checklist

  • [x] Every requirement is testable (MUST / MUST NOT), not aspirational
  • [x] No company fact is asserted here
  • [x] Every open item is marked, not silently decided

Titles, headings, exports, tables, columns and requirements. Esc closes.