Skip to content

test(sweep): correct the DNS flag classifications - #701

Merged
scttfrdmn merged 1 commit into
mainfrom
chore/549-correct-dns-sweep-classification
Oct 5, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
chore/549-correct-dns-sweep-classification

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #549 as already fixed, with the verification — plus a correction to a classification I got wrong in #698 yesterday.

#549 is fully implemented

All three parts of the report are resolved:

1. --no-dns exists and is wired. cmd/launch_flags.go:330, passed into LoadDNSConfig at cmd/launch_single.go:889, and the guard at :892 skips registration with an explicit message. Its help text even addresses the reporter's specific complaint — that --wait-for-ssh=false was the only escape and also gave up the SSH wait:

Skip DNS registration entirely (unlike --wait-for-ssh=false, this does not also skip the SSH-readiness wait).

2. dns.enabled is read. DNSConfig.IsEnabled() resolves it, and shouldAttemptDNSRegistration consults it.

3. The tri-state concern is handled. The reporter noted that Enabled bool has no empty sentinel, so a config file present but silent on dns: would unmarshal to false and overwrite the true default — "inert today, but it means the field can never express 'inherit' once something does read it." It is now *bool, with nil meaning inherit:

func (c *DNSConfig) IsEnabled() bool { return c.Enabled == nil || *c.Enabled }

and the assignment is guarded on fileConfig.DNS.Enabled != nil, with a comment stating that an absent key must not disable DNS.

Six tests cover it, including the exact case raised: TestLoadDNSConfig_ConfigFilePresentButSilentOnDNS_StillEnabled, plus tri-state resolution, flag-overrides-config, and the both-set case. shouldAttemptDNSRegistration has its own table test.

The defaults: residual is moot, and that's what I got wrong

The reporter's third smaller point was that dns isn't among the keys pkg/config/defaults.go accepts. I classified --no-dns and the --dns* flags as sweep gaps in #698 on that basis — reasoning that a benchmark fleet means a sweep, and a sweep could therefore neither pass --no-dns nor set a default.

That reasoning was wrong, and checking rather than assuming is what showed it: sweeps never register DNS in the first place. config.DNSName is set only when the param file provides dns: or dns_name: (cmd/sweep.go:282), and with no spawn:dns-name tag spored skips registration outright — pkg/agent/agent.go:266, "No DNS name configured → nothing to register."

So on the sweep path the param file is the DNS route, and --no-dns has nothing to disable. These four flags are sweepNA, not gaps, and leaving them misclassified would have sent someone chasing a non-existent bug. Corrected here with the reason recorded.

What this PR contains

Only the classification fix. The feature needed no work; I verified it instead of re-implementing it, which is the whole reason I went looking before writing code.

gofmt -l empty, go test -short ./cmd/ . green, the three manifest gates pass.

--no-dns and --dns were classified as sweep gaps. They are not: a sweep
row gets spawn:dns-name only if the param file sets dns:/dns_name:, and
spored skips registration without that tag — so sweeps never register
DNS and there is nothing for --no-dns to disable.

Found while verifying #549, which is fully fixed: --no-dns is wired,
dns.enabled is read as a tri-state *bool (nil = inherit, so an absent
key cannot disable DNS), and six pkg/config tests plus a cmd-level guard
test cover every case the report raised.
@scttfrdmn
scttfrdmn merged commit b4b7670 into main Oct 5, 2026
6 checks passed
@scttfrdmn
scttfrdmn deleted the chore/549-correct-dns-sweep-classification branch October 5, 2026 01:31
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.

No way to skip DNS registration on a launch, and dns.enabled is parsed but never read

1 participant