Repository navigation
fix(sandbox): let a Live sandbox register through a setup package and link from a Worker (ALIEN-1236) - #890
Merged
Conversation
… link from a Worker
|
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.
Summary
A Sandbox added as Live failed when its Terraform or CloudFormation setup registered, because initial setup refused the sandbox record the setup package hands over. This PR leaves that record to the sandbox's runtime controller, and lets a Worker link a Live sandbox.
Step-by-step flow when a setup package registers a stack with a Live sandbox:
This PR changes "a Live sandbox cannot be installed through a setup package" to "it installs, and a Worker can use it".
What was broken
Initial setup runs only the Frozen resources, and it refused any registered record it does not run. Setup always renders a sandbox's build role, so a Live sandbox is registered too, and the install failed with
IMPORTED_SETUP_STATE_INVALIDafter Terraform had already applied. Every sandbox built from a Dockerfile is Live, so none of them could be installed this way. Separately, the preflight still refused a Worker that links a Live sandbox, although the Worker controller waits for the sandbox and reads its binding at runtime.What I did
continue_importedaccepts a record outside the lifecycle filter only when the stack declares it, its type renders setup scaffolding for its lifecycle (today only a sandbox), and it arrives at the start of its create flow (Provisioning, with controller state). Everything else is refused as before, including a Live sandbox registered as already built.Files touched
crates/alien-infra/src/core/executor.rs: the guard incontinue_imported.crates/alien-infra/src/core/executor_tests/update_tests.rs: four tests for the guard.crates/alien-preflights/src/compile_time/frozen_resource_lifecycle.rs: a Worker may link a Live sandbox; the refusal test now uses a Build.How I tested
Imported setup contains unexpected resource 'test-sandbox'after Terraform applied. With the fix it reached Running, the Worker's sandbox binding carriedimageArnandimageVersion, and a request to the Worker created a sandbox session, ran a command, moved a file in and out, and ended the session. Same result with a sandbox built from a Dockerfile. Those runs used the first version of the guard, which accepted any declared record; the final guard accepts the record the AWS importer builds for a Live sandbox, and the unit test builds it with that importer.imported_continuation_leaves_a_registered_live_sandbox_to_runtimefails on main with the same error and passes here. Removing the scaffolding check failsimported_continuation_refuses_a_live_resource_setup_does_not_render; removing the Provisioning check failsimported_continuation_refuses_a_live_sandbox_registered_as_built.cargo nextest run -p alien-infra --features all-platforms,test-utils: 853/853.cargo nextest run -p alien-preflights: 409/409.Safe because a record setup does not render, or a Live sandbox registered as already built, is still refused. Proven by the two refusal tests above.