Skip to content

fix(spored): install the launching spawn's own spored from spawn/versions/<ver>/ (#1412) - #1416

Merged
scttfrdmn merged 5 commits into
mainfrom
fix/1412-pin-spored-version
Oct 29, 2026
Merged

scttfrdmn merged 5 commits into
mainfrom
fix/1412-pin-spored-version

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1412

Every install path now installs the spored of the spawn that rendered it, from spawn/versions/<ver>/spored-<os>-<arch> (plus .sha256 and .sig, signature check unchanged): the same version launcher.CallerVersion / PublishedBodyVersion pins the bootstrap body to (#1274). Dev and unversioned builds keep the latest paths.

Mechanism

  • pkg/sporedinstall: new shell function spore_install_spored_from_buckets <binary> <regional-bucket> <fallback-bucket>, defined by VerifiedInstallFunc. With SPAWN_SPORED_VERSION set, the only sources are <regional>/spawn/versions/<v> then <us-east-1>/spawn/versions/<v>. There is no latest fallback, so a missing or unverifiable versioned object fails the install the same way a bad signature does. With it empty, the four latest sources apply, in the old order. PinScript(version) emits the single-quoted assignment, and ReleaseVersion is now the one release regex (pkg/launcher uses it).
  • launcher.SporedVersion() (new export, in api-snapshot) is PublishedBodyVersion without the key condition. The pin goes into the per-launch prefix, so the published body stays version-independent. The body bytes change once in this PR, as they do with any body edit.
  • Every caller now uses the function, and every caller is pinned:
    • the Linux stub and inline bootstrap. This covers launch, sweeps (the detached CLI-rendered path too), task run/tasklaunch, burst, pool and launcher.Provision. A library caller pins to the spawn module it was built against, the way its body already does.
    • the Windows bootstrap: WindowsInstallScript(keyPEM, version) gets the versioned regional source, then us-east-1. Nothing is installed if neither verifies, the same as a bad signature.
    • cmd/app.go, both templates: on failure they warn and keep the AMI's spored, as for a bad signature.
    • the pipeline orchestrator: pinned to its own build's release (VCS-stamped by make build at a tag, "" otherwise). The stage runner is spored run-pipeline-stage, so the two form one contract.
    • the sweep orchestrator's legacy-params members (Redeployed sweep orchestrator refuses every sweep and schedule from a v0.146.0-or-older CLI (#1323/#1330 checks) #1368): applyVersion already sets launcher.CallerVersion = Version, so they pin to the orchestrator's release.
    • spawn upgrade-spored uses the same function, pinned to its target.
  • upgrade-spored now defaults to this spawn's own version instead of the latest GitHub release. A dev build still asks GitHub. Reasons: it brings an instance to the CLI/spored pair this spawn ships and launches with; it needs no GitHub round-trip; and after Instance tags are spored's config file: move launch-fixed settings to a per-launch config object, keep tags for mutable/filterable state #1359 a spored newer than the instance's launching CLI may not read that CLI's config, so "latest" is the riskier default. --version must be MAJOR.MINOR.PATCH. It was rendered with %q into double quotes, where $(...) expands. A default-target downgrade refusal now tells the user why.
  • scripts/install-spored.ps1 (standalone, no launching spawn) still installs the latest.

Sizes

Bare launch, before → after:

  • stub: 4764 → 4796 raw (+32), 1792 → 1797 gzipped (+5), budget 3072
  • inline: 27526 → 27819 raw (+293), 8023 → 8102 gzipped (+79), budget 8192 (90 bytes headroom left)
  • published body: 25179 → 25447 (+268)

Gates

Each was watched failing against a compiling revert:

Gate Revert Failed
pkg/sporedinstall TestAPinnedInstallFetchesOnlyItsOwnVersion, TestAPinnedInstallNeverFallsBackToLatest, TestAnUnpinnedInstallFetchesLatest (executed bash, request paths recorded) function ignores the pin / pinned branch appends latest bases / dev branch pins yes, all three
pkg/launcher TestAReleaseBootstrapInstallsItsOwnSpored (whole inline bootstrap in the boot sandbox: own spored installs, only-latest published retires with zero latest hits, dev installs latest) same three, plus prefix PinScript("") yes
pkg/launcher TestTheSporedPinIsTheCallersRelease (rendered pin == CallerVersion == SPAWN_BS_VERSION, assigned before the body; dev, pseudo and dirty builds unpinned) prefix PinScript("") yes
pkg/sporedinstall TestWindowsPinnedInstallFetchesOnlyItsOwnVersion (pwsh, fake aws records every s3 URL) Windows ignores the version / dev pins yes
cmd TestWindowsBootstrapInstallsThisSpawnsSpored launch_config.go passes "" yes
cmd discovery: TestEverySporedDownloaderUsesTheVerifiedInstaller (must call the bucket function, never spore_install_verified_spored with its own bases, must emit PinScript), TestEveryVerifiedInstallCallerIsPinned (every VerifiedInstallFunc() caller), TestEveryWindowsInstallPathIsPinned (every WindowsInstallScript caller passes launcher.SporedVersion()) app.go unpinned / app.go direct latest call / Windows caller "" yes
cmd TestGeneratedAppUserDataInstallsSporedVerified + dev variant, TestUpgradeScriptIsFailClosed (pin), TestUpgradeSporedDefaultsToThisSpawnsVersion app unpinned / upgrade PinScript("") / default back to latest yes
lambda/pipeline-orchestrator TestUserData_InstallsThisReleasesSpored (executed, every spored curl URL) PinScript("") yes
lambda/sweep-orchestrator TestLegacyMemberInstallsTheOrchestratorsSpored prefix unpinned yes

Release and deploy notes

  • Body: the next release's body hash changes (new install logic), as it does with any body edit. The publish/verify mechanics are unchanged: the body takes no version, so go run . bootstrap-body without ldflags (deploy-sweep-orchestrator.sh's check) still prints the published bytes.
  • verify step: spored is now load-bearing at spawn/versions/<v>/ and no longer at spawn/. The verify should sha- and sig-check the versioned copies too, plus an anonymous HTTPS fetch the way the instance does. The release's own upload is unchanged; it already writes the versioned objects.
  • Ordering: the versioned spored is uploaded after GoReleaser publishes the CLI and taps. Launches by the new CLI retire in that window, and every launch retires if the upload fails. Filed as release: publish the versioned spored before the CLI is installable (launches pinned by #1412 retire until it lands) #1415, not fixed here.
  • Lambdas: the sweep orchestrator needs no redeploy for CLI-rendered members, since the CLI pins them. Its legacy-params members, and every pipeline stage, pin only after a redeploy built from the release tag. Until then they behave as today (latest). The pipeline orchestrator takes its version from the Go VCS stamp, so build it from a clean tag. go version -m build/bootstrap should show mod github.com/spore-host/spawn v0.X.Y, not a pseudo-version or +dirty, or it installs the latest.
  • No new IAM: the buckets are already read anonymously at spawn/versions/<v>/ (the stub fetches the body there).

make check, make lint (0 issues, 10 modules), semgrep scan --config=auto --error . (0 findings), make api-snapshot, make gen-docs and check-docs all pass.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.32258% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/upgrade_spored.go 66.66% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn force-pushed the fix/1412-pin-spored-version branch from 8941ec1 to 88c7df4 Compare October 29, 2026 06:00
@scttfrdmn
scttfrdmn merged commit a7ec8d6 into main Oct 29, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1412-pin-spored-version branch October 29, 2026 06:20
@scttfrdmn scttfrdmn mentioned this pull request Oct 29, 2026
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.

Pin spored to the launching CLI's version (install from spawn/versions/<ver>/), not the unversioned latest

1 participant