Skip to content

Reserve a tag slot for every tag spored writes after launch (#1355) - #1427

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/1355-spored-tag-reserve
Oct 29, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/1355-spored-tag-reserve

Conversation

@scttfrdmn

@scttfrdmn scttfrdmn commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1355

Sets the tag reserve that #1359 item 4 asked for. It is computed from one list of every tag written on an instance after RunInstances, and the #1336 check enforces it.

What changed

  • pkg/aws/post_launch_tags.go, postLaunchInstanceTags: one list of every tag key written on an instance after launch. It covers spored (heartbeat, compute-seconds, version, session count, the 3 footprint tags, flush/DNS/ready/FSx status), spawn's launch code (Spot price, the ephemeral FSx's mount tags) and the commands that edit a running instance (spawn extend, stop/start, spored config set, spawn dns register, upgrade-spored, spawn plugin install). Each entry names its writer and when it applies (Spot, DNS, a web app or DCV, a task, a pending FSx). Exported as aws.PostLaunchTagKeys().
  • The reserve is every entry that is written without anyone running a command, applies to this launch, and isn't a key the launch already writes. An update to an existing key needs no slot. It replaces buildTags does not refuse a launch over AWS's 50-tag limit; maximal launch + all #1308 spored settings = 54 tags #1336's postLaunchTags. buildTags and ValidateTagCount (and so every pre-flight) refuse a launch whose launch-time count plus the reserve is over 50. TagLimitError gains Spored, and the message says N slot(s) spored needs for the tags it writes once running (...).
  • Tags written only by a command are on the list (so discovery covers them) but are not reserved: the command reports a failed write to whoever ran it. Reserving them would raise a plain launch's reserve from 7 to 20, and the maximal launch's from 13 to 17.
  • The ttl-reaper writes no instance tag. Its spawn:reaper-first-seen stamp goes on security groups, placement groups and EIPs.
  • costmodel.FootprintTags was added so pkg/aws can name the footprint keys without breaking TestNoCostRateTagReadOutsideTheModel.

Numbers

Gates (each watched failing against a compiling revert)

  1. Discovery: TestEveryPostLaunchTagIsListed (root). Every CreateTags/UpdateInstanceTags/putTags call is found. Its function must be classified. Every key written or spelled in spored's code and in each instance writer must be on the list, and no list key can be stale. Reuses Launch-fixed spored settings move to a per-launch config object; freeze the latest spored (#1359, #1419) #1420's tag-contract scanner, which now also records keys it can't place as reads or writes (mentionsIn).
    • Revert: add spawn:heartbeat-seq to writeHeartbeatTag. Result: FAIL, "spawn:heartbeat-seq is written on an instance after launch ... but is not on postLaunchInstanceTags".
    • Revert: add a new unclassified UpdateInstanceTags caller in cmd. Result: FAIL, "is not classified".
  2. No room, refused before any AWS call: TestALaunchLeavesSporedItsSlots (pkg/aws) and TestLaunchLeavingSporedNoRoomMakesNoAWSCall (cmd, through runLaunch against a recording fake). Revert to buildTags does not refuse a launch over AWS's 50-tag limit; maximal launch + all #1308 spored settings = 54 tags #1336 semantics (the reserve skips spored's entries). Result: pkg/aws fails "ValidateTagCount() = ". The cmd test fails because the launch goes on to SSM GetParameter.
  3. Maximal launch fits: TestMaximalLaunchTagCount, TestMonitoringSettingsFitOnAMaximalLaunch. Revert: reserve command-only tags too. Result: both FAIL (17 reserved, 54 tags). Dropping the "minus keys the launch writes" rule also fails TestTheReserveSkipsKeysTheLaunchWrites.

Checks

make check and make lint (0 issues, 10 modules) from /private/tmp, semgrep scan --config=auto --error . clean, and make api-snapshot regenerated (additions only: PostLaunchTagKeys, TagLimitError.Spored). No AWS calls.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/post_launch_tags.go 75.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

…1355)

One list, pkg/aws postLaunchInstanceTags, of every tag written on an
instance after RunInstances (spored, spawn's launch code, and the commands
that edit a running instance). The launch's reserve is the entries written
without a command that apply to the launch, less the keys it writes itself;
buildTags and ValidateTagCount refuse a launch that leaves fewer slots, naming
how many spored needs. Replaces #1336's postLaunchTags. A discovery gate
(tag_reserve_test.go) finds every tag-writing call and fails on a key that is
not on the list.
@scttfrdmn
scttfrdmn force-pushed the feat/1355-spored-tag-reserve branch from 7a33d44 to 79a3aeb Compare October 29, 2026 19:46
@scttfrdmn
scttfrdmn merged commit 0b85336 into main Oct 29, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the feat/1355-spored-tag-reserve branch October 29, 2026 20:09
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.

spored's runtime tags have no room on an instance launched at the 50-tag limit (spawn:compute-seconds, spawn:last-heartbeat)

1 participant