Repository navigation
feat(ec2): stamp aws:ec2:fleet-id on fleet instances (#443) - #447
Merged
Merged
Conversation
CreateFleet launched its instances through runInstances but never tagged them with the fleet that created them, so there was no route from a fleet ID back to its instances. For an instant fleet that tag is the only route: DescribeFleetInstances rejects instant fleets outright, and the fleetInstanceSet a fleet response echoes is a record of what was launched rather than what is running — it never drops terminated instances. A consumer enumerating an instant fleet therefore saw a fully-provisioned, running fleet as empty, which reads as "the instances are gone" rather than "substrate didn't record this". fleetIDTagSpec appends the tag past whatever passthroughFleetTagSpecs emitted, because that function renumbers its output from 1 and reusing an occupied TagSpecification index would silently overwrite a caller's own launch-time tag. It runs per pool, so a multi-pool fleet tags all of its instances. Source note, stated plainly because CLAUDE.md makes AWS docs authoritative: aws:ec2:fleet-id appears in neither the EC2 API reference nor the fleet tagging/describe/delete pages. The authority here is observed real-AWS behavior reported by the parsl-aws-provider consumer, whose fleet-to-instance lookup is built on it — not a documented API contract. That provenance is recorded in the code comment, the docs and the changelog rather than implied away. Deliberately out of scope: CreateTags still accepts an aws:-prefixed key that real EC2 rejects with InvalidParameterValue. That acceptance is currently the workaround this change removes the need for, so tightening it in the same release would break the reporter on upgrade with no overlap window. Tracked as a follow-up. Tests cover the tag landing on every instance, the DescribeInstances tag:aws:ec2:fleet-id filter returning exactly one fleet's instances (which also pins that the colon-bearing key is not split by the filter's prefix cut), coexistence with caller tags, multi-pool fleets, and a fully unfulfilled fleet. Each was mutation-tested against the unfixed code. Closes #443
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Aug 1, 2026
Merged
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.
Problem
CreateFleetlaunched its instances throughrunInstancesbut never tagged them with the fleet that created them, so there was no route from a fleet ID back to its instances.For an
instantfleet that tag is the only route:DescribeFleetInstancesrejects instant fleets outright.fleetInstanceSeta fleet response echoes is a record of what was launched, not what is running — it never drops terminated instances.So a consumer enumerating an instant fleet saw a fully-provisioned, running fleet as empty. That reads as "the instances are gone" rather than "substrate didn't record this", which is why the reporter debugged their own code first.
Change
fleetIDTagSpecappendsaws:ec2:fleet-idto the syntheticRunInstancesparamslaunchFleetPoolalready builds, at an index past whateverpassthroughFleetTagSpecsemitted — that function renumbers its output from 1, and reusing an occupiedTagSpecificationindex would silently overwrite a caller's own launch-time tag. It runs per pool, so a multi-pool fleet tags all of its instances.Source note
Stated plainly, because CLAUDE.md makes AWS docs authoritative:
aws:ec2:fleet-idappears in neither the EC2 API reference nor the fleet tagging/describe/delete user-guide pages. The authority is observed real-AWS behavior reported by the parsl-aws-provider consumer, whoseget_ec2_fleet_instance_ids()is built on it — not a documented API contract. That provenance is recorded in the code comment,docs/services.mdand the changelog rather than implied away.What is documented authoritatively, and noted in the docs: the
aws:prefix is reserved, such a tag cannot be edited or deleted by a caller, and it does not count against the 50-tag limit.Deliberately out of scope
CreateTagsstill accepts anaws:-prefixed key that real EC2 rejects withInvalidParameterValue. That acceptance is currently the workaround this change removes the need for, so tightening it in the same release would break the reporter on upgrade with no overlap window. Filed as a follow-up.Tests
Five tests in
emulator/ec2_fleet_test.go:FleetIdDescribeInstances --filters tag:aws:ec2:fleet-idreturns exactly one fleet's instances — the assertion that actually matters, and it also pins that the colon-bearing key survives the filter'stag:prefix cut rather than being split on every colonTagSpecificationtags survive alongside the reserved tag, and the fleet-scoped tag still does not leak (the regression the index arithmetic can break)Each was mutation-tested: with the fix removed, four of the five fail.
Verification
gofmt,go build,go vet,golangci-lint run ./...(0 issues),make test(race),test/e2e,make docs-reference-check docs-versions— all clean.Closes #443