Repository navigation
refactor: move package into emulator/ subdirectory (clean root) - #310
Merged
Merged
Conversation
Relocate all 286 package files (173 source + 113 test) plus the embedded ui.html from the repo root into emulator/, leaving a clean professional root (cmd/ emulator/ docs/ examples/ deploy/ configs/ python/ test/ + project files). - Rename package substrate → emulator (and substrate_test → emulator_test). - Public Go import path is now github.com/scttfrdmn/substrate/emulator with symbols emulator.X. cmd/substrate install path and the HTTP wire contract are unchanged; no runtime behaviour change. - Update the only in-repo Go importers: cmd/substrate, examples/*, test/e2e (import path; keep substrate alias), and the generated-fixture template in replay_export.go. Makefile ldflags now set …/emulator.Version. - Clean stray root artifacts (coverage*, binaries, *.db); gitignore coverage_main.out. No external consumers Go-import the package (all use the HTTP server), so the import-path change has zero external blast radius. make build/test(race)/lint/vet/e2e all green; go:embed ui.html still serves /ui.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Jun 3, 2026
scttfrdmn
added a commit
that referenced
this pull request
Jun 10, 2026
…327) The emulator/ reorg (#310) renamed the package clause substrate -> emulator but left five files' leading doc comments saying 'Package substrate' / 'Package substrate_test', which Go convention flags as a name mismatch. Update the comment lines (doc.go, doc_plugins.go, sns_types.go, coverage_test.go, v030_coverage_test.go); 'Substrate' as the product name in prose is unchanged. Doc-comment only; no code or behaviour change.
This was referenced Jul 26, 2026
scttfrdmn
added a commit
that referenced
this pull request
Jul 31, 2026
…FN types (#387, #388, #389) EC2 Fleet (#387) ---------------- Add CreateFleet, DescribeFleets, and DeleteFleets. Instances launch through the same runInstances path as a direct launch, so they are visible to DescribeInstances with subnet/security-group validation, placement groups, and launch-time tag propagation intact. LaunchTemplateConfigs[] x Overrides[] flatten into ordered capacity pools (sorted by Priority under a prioritized allocation strategy) and are fulfilled round-robin, so fleetInstanceSet carries one item per pool each with a *list* of instance IDs — the shape callers most often flatten incorrectly. An instant fleet returns instances and errors synchronously; request/maintain fleets return only the fleet ID, matching AWS. Partial fulfillment is seedable via POST/DELETE /v1/ec2/fleet-shortfall, keyed by launch-template ID/name or "*". A fleet that asks for 12 and receives 8 still returns a fleet ID and echoes the *request* in TotalTargetCapacity, so this is where callers most often go wrong — and it is rare and hard to trigger against real AWS. Seeding makes it instant and reproducible; the shortfall is reported per pool in errorSet with a configurable code and lifecycle. CFN wiring (#388) ----------------- Four resource types had working API handlers but fell through to deployGenericStub, so a stack deployed "successfully" while the resource was never created: - AWS::EC2::LaunchTemplate — Ref is the real lt-… ID, usable by CreateFleet - AWS::IAM::InstanceProfile — creates the profile and attaches each Roles entry - AWS::EC2::SecurityGroupIngress / ::SecurityGroupEgress — standalone rules, resolving Source/DestinationSecurityGroupId through Ref/GetAtt AWS::EC2::SecurityGroup now also authorizes its inline SecurityGroupIngress/ Egress rules, which were parsed but never applied — so previously *neither* spelling produced rules, and DescribeSecurityGroups reported an empty group regardless of how the template was written. This needed a type change: EC2IPPermission had no way to express a rule whose source is another security group (a self-referencing rule has no CIDR at all). Added UserIDGroupPairs, parsing of IpPermissions.N.Groups.M.GroupId, and groups>item rendering in DescribeSecurityGroups. While there, the rule parser now reads every IpPermissions.N entry and all of each entry's IpRanges.M rather than only the first of each, and revoke matches on source as well as ports. AWS::EC2::Instance passes through IamInstanceProfile, KeyName, and SecurityGroupIds — the profile reference is only resolvable now that AWS::IAM::InstanceProfile creates a real profile. The generic-stub warning reports whether the type's service plugin is loaded; it previously read as "substrate doesn't model this", misleading when the actions exist and only the wiring is missing. AWS::EC2::NetworkInterface is left stubbed — it needs a CreateNetworkInterface handler first, which #388 notes belongs in its own issue. Docs (#389) ----------- emulator/doc.go claimed 39 plugins and 23 S3 operations; the registry has 63 and s3_plugin.go 53. The counts that #364 made generated had drifted here, so doc.go now points at the generated docs/services.md rather than repeating a number that can drift. CLAUDE.md's key-files table pointed at four paths that moved to emulator/ in the #310 reorg and pinned a now-stale next version. All wire shapes were verified against the AWS API reference: the XML elements are fleetId/fleetInstanceSet/errorSet (not the boto3-facing names), and source security groups use IpPermissions.N.Groups.M.GroupId. Closes #387 Closes #388 Closes #389
scttfrdmn
added a commit
that referenced
this pull request
Aug 1, 2026
…FN types (#387, #388, #389) EC2 Fleet (#387) ---------------- Add CreateFleet, DescribeFleets, and DeleteFleets. Instances launch through the same runInstances path as a direct launch, so they are visible to DescribeInstances with subnet/security-group validation, placement groups, and launch-time tag propagation intact. LaunchTemplateConfigs[] x Overrides[] flatten into ordered capacity pools (sorted by Priority under a prioritized allocation strategy) and are fulfilled round-robin, so fleetInstanceSet carries one item per pool each with a *list* of instance IDs — the shape callers most often flatten incorrectly. An instant fleet returns instances and errors synchronously; request/maintain fleets return only the fleet ID, matching AWS. Partial fulfillment is seedable via POST/DELETE /v1/ec2/fleet-shortfall, keyed by launch-template ID/name or "*". A fleet that asks for 12 and receives 8 still returns a fleet ID and echoes the *request* in TotalTargetCapacity, so this is where callers most often go wrong — and it is rare and hard to trigger against real AWS. Seeding makes it instant and reproducible; the shortfall is reported per pool in errorSet with a configurable code and lifecycle. CFN wiring (#388) ----------------- Four resource types had working API handlers but fell through to deployGenericStub, so a stack deployed "successfully" while the resource was never created: - AWS::EC2::LaunchTemplate — Ref is the real lt-… ID, usable by CreateFleet - AWS::IAM::InstanceProfile — creates the profile and attaches each Roles entry - AWS::EC2::SecurityGroupIngress / ::SecurityGroupEgress — standalone rules, resolving Source/DestinationSecurityGroupId through Ref/GetAtt AWS::EC2::SecurityGroup now also authorizes its inline SecurityGroupIngress/ Egress rules, which were parsed but never applied — so previously *neither* spelling produced rules, and DescribeSecurityGroups reported an empty group regardless of how the template was written. This needed a type change: EC2IPPermission had no way to express a rule whose source is another security group (a self-referencing rule has no CIDR at all). Added UserIDGroupPairs, parsing of IpPermissions.N.Groups.M.GroupId, and groups>item rendering in DescribeSecurityGroups. While there, the rule parser now reads every IpPermissions.N entry and all of each entry's IpRanges.M rather than only the first of each, and revoke matches on source as well as ports. AWS::EC2::Instance passes through IamInstanceProfile, KeyName, and SecurityGroupIds — the profile reference is only resolvable now that AWS::IAM::InstanceProfile creates a real profile. The generic-stub warning reports whether the type's service plugin is loaded; it previously read as "substrate doesn't model this", misleading when the actions exist and only the wiring is missing. AWS::EC2::NetworkInterface is left stubbed — it needs a CreateNetworkInterface handler first, which #388 notes belongs in its own issue. Docs (#389) ----------- emulator/doc.go claimed 39 plugins and 23 S3 operations; the registry has 63 and s3_plugin.go 53. The counts that #364 made generated had drifted here, so doc.go now points at the generated docs/services.md rather than repeating a number that can drift. CLAUDE.md's key-files table pointed at four paths that moved to emulator/ in the #310 reorg and pinned a now-stale next version. All wire shapes were verified against the AWS API reference: the XML elements are fleetId/fleetInstanceSet/errorSet (not the boto3-facing names), and source security groups use IpPermissions.N.Groups.M.GroupId. Closes #387 Closes #388 Closes #389
scttfrdmn
added a commit
that referenced
this pull request
Aug 1, 2026
…FN types (#387, #388, #389) (#390) EC2 Fleet (#387) ---------------- Add CreateFleet, DescribeFleets, and DeleteFleets. Instances launch through the same runInstances path as a direct launch, so they are visible to DescribeInstances with subnet/security-group validation, placement groups, and launch-time tag propagation intact. LaunchTemplateConfigs[] x Overrides[] flatten into ordered capacity pools (sorted by Priority under a prioritized allocation strategy) and are fulfilled round-robin, so fleetInstanceSet carries one item per pool each with a *list* of instance IDs — the shape callers most often flatten incorrectly. An instant fleet returns instances and errors synchronously; request/maintain fleets return only the fleet ID, matching AWS. Partial fulfillment is seedable via POST/DELETE /v1/ec2/fleet-shortfall, keyed by launch-template ID/name or "*". A fleet that asks for 12 and receives 8 still returns a fleet ID and echoes the *request* in TotalTargetCapacity, so this is where callers most often go wrong — and it is rare and hard to trigger against real AWS. Seeding makes it instant and reproducible; the shortfall is reported per pool in errorSet with a configurable code and lifecycle. CFN wiring (#388) ----------------- Four resource types had working API handlers but fell through to deployGenericStub, so a stack deployed "successfully" while the resource was never created: - AWS::EC2::LaunchTemplate — Ref is the real lt-… ID, usable by CreateFleet - AWS::IAM::InstanceProfile — creates the profile and attaches each Roles entry - AWS::EC2::SecurityGroupIngress / ::SecurityGroupEgress — standalone rules, resolving Source/DestinationSecurityGroupId through Ref/GetAtt AWS::EC2::SecurityGroup now also authorizes its inline SecurityGroupIngress/ Egress rules, which were parsed but never applied — so previously *neither* spelling produced rules, and DescribeSecurityGroups reported an empty group regardless of how the template was written. This needed a type change: EC2IPPermission had no way to express a rule whose source is another security group (a self-referencing rule has no CIDR at all). Added UserIDGroupPairs, parsing of IpPermissions.N.Groups.M.GroupId, and groups>item rendering in DescribeSecurityGroups. While there, the rule parser now reads every IpPermissions.N entry and all of each entry's IpRanges.M rather than only the first of each, and revoke matches on source as well as ports. AWS::EC2::Instance passes through IamInstanceProfile, KeyName, and SecurityGroupIds — the profile reference is only resolvable now that AWS::IAM::InstanceProfile creates a real profile. The generic-stub warning reports whether the type's service plugin is loaded; it previously read as "substrate doesn't model this", misleading when the actions exist and only the wiring is missing. AWS::EC2::NetworkInterface is left stubbed — it needs a CreateNetworkInterface handler first, which #388 notes belongs in its own issue. Docs (#389) ----------- emulator/doc.go claimed 39 plugins and 23 S3 operations; the registry has 63 and s3_plugin.go 53. The counts that #364 made generated had drifted here, so doc.go now points at the generated docs/services.md rather than repeating a number that can drift. CLAUDE.md's key-files table pointed at four paths that moved to emulator/ in the #310 reorg and pinned a now-stale next version. All wire shapes were verified against the AWS API reference: the XML elements are fleetId/fleetInstanceSet/errorSet (not the boto3-facing names), and source security groups use IpPermissions.N.Groups.M.GroupId. Closes #387 Closes #388 Closes #389
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.
Part A of 3 (reorg → README → docs site). Layout-only change; no runtime behaviour change.
What
Moves all 286
package substratefiles (173 source + 113 test) + the embeddedui.htmlfrom the repo root intoemulator/, leaving a clean professional root:substrate→emulator(matches directory; idiomatic).github.com/scttfrdmn/substrate/emulator(symbolsemulator.X).go install …/cmd/substrateinstall path and the HTTP wire contract are unchanged.Why it's safe
The single-package-at-root layout was a constraint of being a Go library, not a choice — but no external project Go-imports the package (lagotto, queuezero, spawn, etc. all use the running emulator over HTTP). So the import-path change has zero external blast radius; only in-repo importers needed updating:
cmd/substrate,examples/*,test/e2e(import path; kept thesubstratealias to minimize churn)replay_export.goMakefileldflags →…/emulator.VersionAll 286 moves are tracked by git as renames (history preserved).
Not doing
No multi-package split —
emulatorstays one package in one directory (per project convention + solo-consumer reality). No wire/behaviour changes.Verification
make build/make test(race) /make lint/go vet ./.../make e2eall green.go:embed ui.htmlconfirmed still servingGET /ui(200). Grep confirms zero bare-root imports and zeropackage substrateclauses remain.