Repository navigation
fix(spored): make status read-only — it was registering DNS on every call (#733) - #748
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…call `spored status` constructed a full agent, and NewAgent registers DNS as part of construction: an HTTP POST that mutates a Route53 record, plus an EC2 tag write via recordDNSStatus. So `spawn status`, a query, performed a control-plane WRITE on every invocation — and polling it in a loop (the normal way to watch a job, and what the demo guide tells presenters to do) meant one write per poll. The reported symptom looked cosmetic: spored's init lines leaking into the status output with "Warning: Failed to register DNS: DNS API returned HTTP 403" above the summary. Those lines were the symptom. The warning was only visible BECAUSE the write was failing — had it succeeded, nothing would have printed and the behaviour would still be wrong. NewAgentForQuery builds the agent with no side effect: no DNS registration, no EBS cost lookup (a tag write), no job-array registry registration, no heartbeat goroutine, no plugin loading, no init logging. State a query legitimately needs — dnsDomain, the notifier struct, the plugin runtime — is still constructed. Five non-daemon subcommands switch to it: status, reload, config get, config set, config list. The two mutating ones are included deliberately: `config set` does its own intended write and should not also register DNS. One constructor with the side effects behind a flag, not a parallel constructor that would drift. #540 was correct but could not have helped here: separating stdout from stderr does nothing about a side effect. Gates confirmed to fail on revert: DNS registration ungated, registry + peer discovery ungated, and — importantly — activation disabled for the DAEMON, which would "fix" #733 by breaking DNS registration entirely. That third one is why the test asserts both directions. My first version of the test hand-rolled a Provider and failed to compile against the interface (missing CheckSpotInterruption). It now embeds the package's existing stubProvider, so adding an interface method cannot break it.
scttfrdmn
force-pushed
the
fix/733-status-no-side-effects
branch
from
October 8, 2026 04:06
2c715ab to
686c2ec
Compare
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.
Closes #733. The last of the ten issues from the 2026-10-07 demo run.
It was not an output nit
spored statusconstructs a full agent, andNewAgentregisters DNS as partof construction: an HTTP POST that mutates a Route53 record, plus an EC2 tag
write via
recordDNSStatus. Sospawn status— a query — performed acontrol-plane write on every invocation. Polling it in a loop is the normal
way to watch a job, and the demo guide instructs presenters to do exactly that,
so each demo run made several of those writes.
The reported symptom was spored's initialization lines leaking into the status
output, with
Warning: Failed to register DNS: DNS API returned HTTP 403abovethe summary. Those lines were the symptom. The warning was only visible
because the write was failing — had it succeeded, nothing would have printed
and the behaviour would still have been wrong.
#540's fix was correct and could not have helped: separating stdout from stderr
does nothing about a side effect, and
emitStatuswas already careful about thestreams.
The fix
NewAgentForQuerybuilds the agent with no side effect:spawn:ebs-hourly-costState a query legitimately needs —
dnsDomain, the notifier struct, the pluginruntime — is still constructed, so the report can describe them.
Five non-daemon subcommands switch over:
status,reload,config get,config set,config list. The two mutating ones are deliberate:config setperforms its own intended write and should not also register DNS as a
side effect of setting a TTL.
One constructor with the side effects behind a flag, rather than the parallel
NewAgentForQuerythe issue floated — a second constructor duplicating all thatsetup would drift. The correct long-term shape is still splitting construction
from a
Start/Activatethe daemon calls; this is the narrow version of it.Verification
query mode built a DNS client, so the registration block ran — that is #733query mode discovered peers 1 time(s)+started a heartbeat goroutineNewAgent no longer discovers peers — activation was disabled, not relocatedThat third one is the one I most wanted. The cheap way to make this issue's
symptom go away is to stop registering DNS at all, which would break the feature
rather than relocate it — so the test asserts both directions.
My first version of the test hand-rolled a
Providerand failed to compileagainst the interface (missing
CheckSpotInterruption). It now embeds thepackage's existing
stubProvider, so adding a method toProvidercannot breakit — the kind of thing that looks like tidiness and is actually the difference
between a test that survives and one that gets deleted.
gofmt,go vet ./...,go test -short ./...(all green),make check-docs,changelog gate,
semgrep scan --config=auto --error(0 findings).On the shared fix with #741
You suggested #733 and #741 might share one fix, and I flagged it as unconfirmed.
Having now done both: they don't. #741's DNS registration shells out to
sshfrom the controller and was fixed by gating it on SSH readiness and bounding
its retry; this one is in-process in spored and is fixed by not doing it at
all in query mode. Same API at the far end, genuinely different call paths. Both
are now closed, but separately.
Next for the guide
Once this merges and ships, the note you added to hide the 403 can come out — the
write it warns about no longer happens on the status path.