Skip to content

Launch config object (spawn:config) + spored 0.150.0, with the #1355 tag reserve - #112

Merged
scttfrdmn merged 3 commits into
mainfrom
feat/110-launch-config-object
Oct 30, 2026
Merged

scttfrdmn merged 3 commits into
mainfrom
feat/110-launch-config-object

Conversation

@scttfrdmn

@scttfrdmn scttfrdmn commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #110
Fixes #113
Refs #108

spawn v0.150.0 is released (ed74003). This PR is now rendered from the published module, not from spawn#1420's pre-release head.

What

On a real launch, spawn-ts now writes the launch config object that spored v0.150.0 reads, in place of the tags spored v0.150.0 ignores, and moves the pin to 0.150.0. The pin and the object only work together, so they change in one commit.

  • Settings moved. The nine settings spawn-ts writes that are in launchconfig.Settings leave the tags: spot-webhook-url, webhook-correlation, webhook-timeout, notify-url, notify-platform, notify-command, active-processes, active-ports and idle-cpu. pre-stop stays a tag, because the reaper reads it.
  • Object format. It is launchconfig.Encode's bytes exactly: {"schema":1,"settings":{...}}, keys sorted, no HTML escaping, no trailing newline, empty values dropped. The instance is tagged spawn:config=<sha256>. A launch with none of the settings has no object and no tag. Tests compare spawn-ts's bytes and sha with Go's for each fixture, and compare the settings list with launchconfig.SettingKeys(). pkg/launchconfig is unchanged between #1420's head 2a47def and tag v0.150.0.
  • Transport: seeded in user data, not stored in S3. The bootstrap writes the object to /etc/spawn/launch-config.json (0600) before the body starts spored. This is Go's own seed block (perLaunchPreBody, rendered byte-identically). spored's launchconfig.Load reads that cache first and uses it only if it hashes to the instance's own spawn:config.

Pinned body: the published v0.150.0

scripts/gen-go-fixtures.sh 0.150.0, run without SPAWN_SRC so the source comes from the module proxy, prints BOOTSTRAP_BODY_SHA256 = 925521a3c0b1707f749eb55cceaef059a526d56a9dbce198e8c389d7f976fc30. Checked independently:

$ curl -fsS https://spawn-binaries-us-east-1.s3.amazonaws.com/spawn/versions/0.150.0/bootstrap.sh | shasum -a 256
925521a3c0b1707f749eb55cceaef059a526d56a9dbce198e8c389d7f976fc30  -
$ GOTOOLCHAIN=go1.27.3 go run github.com/spore-host/[email protected] bootstrap-body | shasum -a 256
925521a3c0b1707f749eb55cceaef059a526d56a9dbce198e8c389d7f976fc30  -

The body moved from the pre-release b73c9811…6b1c because of spawn#1422, which moved heredoc comments out of the data. In the stub fixtures only the SPAWN_BS_SHA256= line changed (decodedBytes changes by 1–4 bytes because the gzip output differs). launchconfig-setting-keys.go.json and gojson-vectors.go.json did not move.

Tag reserve (Go spawn#1355, #1428)

The 50-tag check counted only the RunInstances set. spored writes tags of its own once running: spawn:last-heartbeat, spawn:spored-version, spawn:logged-in-count and spawn:cost-footprint, plus spawn:dns-status and spawn:dns-error when the launch has DNS. A tag write past 50 fails whole. So a spawn-ts launch that filled all 50 left spored unable to record its heartbeat or the cost footprint. Since #1428 the footprint is one tag in spored 0.150.0, which is the spored this PR pins.

  • Ported Go's postLaunchInstanceTags and tagReserve (pkg/aws/post_launch_tags.go, v0.150.0) into core/tags.ts. The generator now writes src/core/testdata/post-launch-tags.go.json, which holds the key, writer, command flag and an applies probe (always / dns / spot / other) for each Go entry. A test requires the spawn-ts table to match it in order. Go's "other" entries (task, web app/DCV, FSx) are never here, because spawn-ts launches none of those.
  • Only spored's entries are reserved, since spored runs on a spawn-ts instance exactly as it does on a Go one. The spawn-written entries come from Go's own launch code (the Spot price, ephemeral FSx tags) and its commands. spawn-ts writes none of them after RunInstances.
  • checkTagLimit counts the reserve, and the refusal names it the way Go's TagLimitError.Error does. A launch with DNS keeps 6 slots.
  • The sweep parameter budget also leaves the reserve free, matching Go's launchTagLimit. It now counts the launch config object as one tag, as Go's buildTags does, instead of counting its nine pre-split settings. The old count dropped up to 8 parameters more than it needed to.
  • The refusal's flag map is Go's verbatim (--metrics). --idle-cpu is in the object, adds no tag, and is no longer offered as droppable.

spawn:created-by (#113)

The comment in core/tags.ts used to say no reader compares the value for equality. That is no longer true: since spawn#1423, tagsReadingSpored in spawn upgrade-spored trusts spawn:version only when created-by == "spawn", and for spawn-ts instances it falls back to spawn:spored-version. The comment now says the value is part of the contract and must stay stable. Existing tests already pin it to spawn-ts.

Why the seed and not the staging bucket

  • CORS. A browser PutObject into spawn-staging-<account>-<region> needs a CORS configuration the bucket does not have. EnsureStagingBucket creates it without one, and spawn-ts would have to change a Go-managed bucket's configuration to add it.
  • Bucket setup. Go's storeLaunchConfigObject first runs EnsureStagingBucket: create, BPA, SSE, ownership, tagging and lifecycle. That is about ten more IAM actions on the caller.
  • Instance role. spored's S3 GET needs s3:GetObject on launch-config/config-*.json. Go grants it on the roles it creates, but spawn-ts launches with a caller-supplied profile.
  • What the seed gives up. The object is not in S3, so a persistent-Spot replacement could not read its notification settings, and Go's reaper deleter has nothing of ours to delete. spawn-ts makes only one-time Spot requests (Go parity (spawn v0.149.0): pinned signed bootstrap stub, pre-launch refusals, terminate-on-error #111 refuses a Spot launch that would need a stop), so it has no replacements. And not creating an S3 object leaves nothing behind to clean up.

Visible change

list()/get() of a real instance no longer report those nine settings, because they are not tags. The instance returned by launch() still carries them.

Gates (each FAIL against a revert that type-checks)

gate revert result
object bytes == Go's HTML escaping on FAIL
empty values kept FAIL
settings leave the tags split moves nothing 3 FAIL
seed present, hashes to spawn:config seed not passed to the bootstrap FAIL
tag written under another key FAIL
seed before plugins/body (Go's order) seed after plugins FAIL
pin and object move together pin left at 0.149.0 8 FAIL
tag reserve counted checkTagLimit ignores the reserve 3 FAIL
sweep budget ignores the reserve 3 FAIL
sweep budget counts pre-split settings (old count) 3 FAIL
a key the launch already writes takes a slot FAIL
DNS tags never reserved FAIL
Go spawn's own post-launch tags reserved too FAIL
table == Go's footprint under a legacy key 3 FAIL
refusal names the reserve message omits it FAIL
--idle-cpu not droppable back in the flag map FAIL

Checks

typecheck, test (802), build, build:lib, check:exports, check:imports: pass. semgrep: clean.

@scttfrdmn
scttfrdmn deleted the branch chore/go-parity-2026-10 October 29, 2026 18:40
@scttfrdmn scttfrdmn closed this Oct 29, 2026
@scttfrdmn scttfrdmn reopened this Oct 29, 2026
@scttfrdmn
scttfrdmn changed the base branch from chore/go-parity-2026-10 to main October 29, 2026 18:41
…50.0 (#110)

DEPENDS ON spawn v0.150.0 (spore-host/spawn#1420, unmerged). The body sha and
fixtures were rendered from PR #1420's head (2a47def) with
SPAWN_SRC=... scripts/gen-go-fixtures.sh 0.150.0; re-run without SPAWN_SRC
against the v0.150.0 tag before merging.
@scttfrdmn
scttfrdmn force-pushed the feat/110-launch-config-object branch from c2f0cdc to 568d7ef Compare October 29, 2026 18:41
… sha 925521a3

Rendered with scripts/gen-go-fixtures.sh 0.150.0 from the module proxy (no
SPAWN_SRC). The body moved since #1420's head 2a47def by spawn #1422 (heredoc
comments moved out of the data). launchconfig-setting-keys and gojson vectors
did not move. The generator now also writes post-launch-tags.go.json (spawn
#1355's postLaunchInstanceTags). created-by comment updated for spawn #1423.
…Go spawn#1355)

checkTagLimit counted only the RunInstances set. spored writes its heartbeat,
spored-version, logged-in-count, cost footprint (one tag since #1428) and, with
DNS, dns-status/dns-error after launch, and a write past 50 fails whole. Port
Go's postLaunchInstanceTags/tagReserve (v0.150.0), pinned by a generated
fixture; reserve spored's entries only (spawn-ts writes none of Go spawn's own
post-launch tags). The sweep parameter budget leaves the reserve free and now
counts the launch config object as one tag, as Go's buildTags does. The flag
map is Go's (--metrics); --idle-cpu is in the object and adds no tag.
Docs moved to the 0.150.0 pin.
@scttfrdmn scttfrdmn changed the title Launch config object (spawn:config) + spored 0.150.0 [depends on spawn v0.150.0] Launch config object (spawn:config) + spored 0.150.0, with the #1355 tag reserve Oct 30, 2026
@scttfrdmn
scttfrdmn marked this pull request as ready for review October 30, 2026 03:43
@scttfrdmn
scttfrdmn merged commit d6dc971 into main Oct 30, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the feat/110-launch-config-object branch October 30, 2026 03:44
@scttfrdmn scttfrdmn mentioned this pull request Oct 30, 2026
scttfrdmn added a commit that referenced this pull request Oct 30, 2026
Promote [Unreleased] to [0.8.0] — 2026-10-29 with the breaking changes called
out (the #111 refusals, terminate-on-error by default, #112's config object),
bump package.json and LIB_VERSION, and ship NOTICE (Apache-2.0 §4(d)), as
truffle-ts#87 and lagotto-ts do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant