Skip to content

feat(dns): N3 — marker-fenced /etc/hosts manager + dns CLI (spec 05) - #20

Merged
gustavobertoi merged 1 commit into
mainfrom
nightly/N3
Jun 29, 2026
Merged

feat(dns): N3 — marker-fenced /etc/hosts manager + dns CLI (spec 05)#20
gustavobertoi merged 1 commit into
mainfrom
nightly/N3

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

Chunk N3 (M5)

internal/dns owns the devstack block in /etc/hosts for <service>.<project>.localhost (the only consistently reliable mechanism cross-platform — spec 05). Idempotent, operates on an injectable path (fully temp-file-testable):

  • Block/Apply/Remove/Present/MissingApply replaces (or appends, or creates) only the fenced block; content outside the fence is untouched; Apply(nil) removes it; Remove restores the original byte-for-byte; file mode preserved.
  • CLI dns setup|status|remove derives hostnames from the proxy route table (N1); writing /etc/hosts needs root → a permission failure maps to a sudo remediation (locked decision feat(config): C3a — healthcheck/dependsOn/hooks schema structs (spec 10/11) #3: build the logic, temp-file tests, flag the human/sudo step).

Tests

Temp-file: insert-preserving-original, idempotent re-apply, replace-not-append, remove-strips-only + exact restore, Apply(nil) removes, Present/Missing diff, create-when-absent. CLI: registration + status reports the route host.

Gate

make ci green (race).

🤖 Generated with Claude Code

internal/dns owns the devstack block in /etc/hosts for resolving
<service>.<project>.localhost on OS-resolver clients (the only consistently
reliable mechanism cross-platform — spec 05 gotchas). All ops are idempotent and
operate on an injectable path (fully temp-file-testable):

- Block/Apply/Remove/Present/Missing: Apply replaces (or appends, or on absent
  creates) ONLY the fenced block — content outside the fence is never touched;
  Apply(nil) removes it; Remove restores the original byte-for-byte; the file's
  mode is preserved.
- CLI `dns setup|status|remove` derives hostnames from the proxy route table
  (network.proxy.engine: caddy); writing /etc/hosts needs root, so a permission
  failure maps to a `sudo` remediation (per locked decision #3: build the logic,
  test with temp files, flag the human/sudo step).

Unit tests (temp file): insert preserving original content, idempotent re-apply,
replace-not-append, remove-strips-block-only + exact restore, Apply(nil) removes,
Present/Missing diff, create-when-absent. CLI tests: registration + status
reports the route host.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gustavobertoi
gustavobertoi merged commit 8628134 into main Jun 29, 2026
2 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/N3 branch June 29, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant