Repository navigation
fix(sandbox): read stack state stored before the lifecycle rename (ALIEN-1184) - #828
Conversation
A Sandbox was stored with `session` and `idleSuspendSeconds` until those fields were renamed to `lifecycle` and `idlePauseSeconds`. The type rejects unknown fields, so a stack state or release stored before the rename no longer deserializes, and a deployment that holds one cannot be updated or deleted: every attempt fails while reading its own state. Accept the old names when reading. Writing keeps the current names, so a state is rewritten in the current form the next time it is saved.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b17b2786ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
What changes
A deployment that declared a Sandbox before #615 has
session(and, when set,idleSuspendSeconds) in its stored stack state and in its release. #615 renamed those fields tolifecycleandidlePauseSeconds, andSandboxrejects unknown fields, so that stored state has not deserialized since:The manager reads a deployment's state before it does anything with it, so such a deployment cannot be updated or deleted, and the manager fails the same way on every loop tick.
Sandbox.lifecyclenow also readssession, andSandboxLifecyclePolicy.idle_pause_secondsalso readsidleSuspendSeconds. Writing is unchanged, so the state is stored under the current names the next time it is saved.Why the type stays strict
Only the two old names are accepted. A field this version does not know is still refused, for two reasons:
The bug was the rename of a stored field without keeping the old name readable, not the strictness.
What the next maintainer inherits
Two
#[serde(alias)]attributes, the same mechanismAwsSandboxControlleralready uses forimageVersion. They can go once no stored state from before #615 remains. Renaming a field of a type that is stored in stack state or a release needs the same treatment.Verification
stack_state_written_before_the_lifecycle_rename_still_readsdeserializes a stack-state resource entry in the stored form (identifiers replaced), checks it equals the sandbox it describes, and checks the next write useslifecycle/idlePauseSeconds.cargo test -p alien-core --lib resources::sandbox: 42 passed. The existingunknown_fields_are_rejectedtest still passes.mainlogs the error above for the same deployment on every tick.Linear: ALIEN-1184