fix: spawn:version reflects the actual running spawn, and spawn:completion-file requires spawn:on-complete - #523
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
scttfrdmn
force-pushed
the
fix/515-tag-correctness
branch
2 times, most recently
from
August 19, 2026 05:40
7791e74 to
9f27e7f
Compare
…etion-file requires spawn:on-complete
buildTags hard-coded spawn:version to the literal "0.1.0" regardless of
the actual running spawn's version, on every instance spawn has ever
launched. It now reads LaunchConfig.SpawnVersion, populated once from
cmd.version()/pkg/buildinfo via a new aws.CallerVersion seam (pkg/aws
can't import cmd directly without a cycle), and omits the tag rather
than writing a false placeholder when a caller doesn't supply a
version.
Separately, spawn:completion-file was written whenever
--completion-file was non-empty, but that flag has a non-empty
default ("/tmp/SPAWN_COMPLETE") -- so a launch that never passed
--on-complete still got a completion-file tag with no action attached.
The two tags now write atomically: completion-file only alongside
on-complete. spored's own config load already defaults the file path
when on-complete is set but no file was tagged, so callers who did ask
for completion handling are unaffected.
Fixes #515
scttfrdmn
force-pushed
the
fix/515-tag-correctness
branch
from
August 19, 2026 05:49
9f27e7f to
ad33a4d
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.
Summary
Two independent one-line defects in
pkg/aws/tags.go, per the issue:spawn:versionwas a hardcoded literal.buildTags's "base identity (always present)" block wrotespawn:version = "0.1.0"unconditionally — every instance spawn has ever launched carries that value regardless of the actual running spawn. Nothing in the codebase could reachcmd.Version/cmd.version()frompkg/awswithout an import cycle (cmdimportspkg/aws), so I added aLaunchConfig.SpawnVersionfield and anaws.CallerVersionpackage var thatcmd.Execute()sets once at startup fromversion()(which itself resolves viapkg/buildinfo, matching the CLI's own reported version).Client.LaunchdefaultslaunchConfig.SpawnVersionfromCallerVersionwhen the caller didn't set it explicitly (so SDK callers likepkg/launcherthat build their ownLaunchConfigcan still opt in). When no version is available at all, the tag is omitted, not written as a false placeholder — per the issue, absence is a better signal than a plausible-looking wrong answer.spawn:completion-filewas written whenever--completion-filewas non-empty, but--completion-filehas a non-empty flag default (/tmp/SPAWN_COMPLETE,cmd/launch_flags.go) — so a launch that only passed--ttland nothing else got aspawn:completion-filetag with nospawn:on-completeto act on it: a watch with no action attached. Implemented the issue's preferred fix (option 1):spawn:completion-fileis now only written inside theOnComplete != ""branch, so the pair is atomic. Verifiedpkg/provider/ec2.go:615already defaultsCompletionFileto/tmp/SPAWN_COMPLETEwhenOnCompleteis set but no file was tagged, so a caller who did ask for completion handling is unaffected — only the false-signal-with-no-action case is fixed.Did not implement the issue's noted-but-not-a-bug-report item (a pre-#502 role staying broken until the next launch, since
ensureSporedBaselinePolicyonly runs inside a launch) — the issue itself frames that as low-priority/latent and a candidate for a futurespawn doctor/--iam-preflight, not something this PR's scope covers.Test plan
go build ./...,go vet ./...,gofmt -l .(clean)go test ./pkg/aws/... ./cmd/...TestBuildTags_VersionIsNotHardcoded(3 subtests: caller-supplied version written verbatim, omitted when unset, never the old literal) andTestBuildTags_CompletionFileRequiresOnComplete(3 subtests covering the no-action, both-tags-together, and file-defaulted-by-spored cases)pkg/aws/tags.go, confirmed 4/6 subtests fail with exactly the reported symptom, restored the fix)golangci-lint run ./pkg/aws/... ./cmd/...— no new findings in touched files[Unreleased]Fixes #515