feat(dns): N3 — marker-fenced /etc/hosts manager + dns CLI (spec 05) - #20
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chunk N3 (M5)
internal/dnsowns the devstack block in/etc/hostsfor<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/Missing—Applyreplaces (or appends, or creates) only the fenced block; content outside the fence is untouched;Apply(nil)removes it;Removerestores the original byte-for-byte; file mode preserved.dns setup|status|removederives hostnames from the proxy route table (N1); writing/etc/hostsneeds root → a permission failure maps to asudoremediation (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 cigreen (race).🤖 Generated with Claude Code