Repository navigation
feat(lifecycle): snapshot at deep depth, and say which depth it was (#1267) - #1270
Merged
Merged
Conversation
…1267) A snapshot recorded identity — logical name, type, physical id, status — plus the stack's CloudFormation exports. It carried no per-resource properties, so nothing that folds over topology could be answered from one. `webServer`, `publicSubnet` and `webSecurityGroup` in the same snapshot all held an identical `attributes` blob of stack exports. `observeResourcesDeep` already existed and was already wired into `lifecycle diff --live`. Only the snapshot path never called it. `chant lifecycle snapshot <env> --deep` now records each resource's normalized property tree beside the identity it already kept. Thin stays the default: a deep read is more provider calls and a larger record, so it is asked for. Depth is recorded, not inferred. `depth` is absent on a thin snapshot, because every snapshot written before this was thin and treating a missing field as unknown would invalidate them all. `lifecycle show` states it, so a reader knows what a snapshot can answer before asking. Degradation is explicit at every step, following #1089's rule that an unread resource is a hole with a reason and never a clean empty answer: - a lexicon with no deep reader warns and records identity - a deep read returning nothing warns and keeps the identity snapshot rather than discarding one that was already good - a type outside the Cloud Control allowlist is recorded unobserved, per entity, with the kind named The deep path was region-blind — `observeResourcesDeep` took no region at any layer, so a multi-region estate read every stack against the ambient one and the out-of-region stacks came back empty. Thread it the same way #1262 did for thin, through DeepObserveOptions, the lexicon interface, and the AWS reader's describe-stack-resources and cloudcontrol get-resource calls. Verified against a four-stack estate across three regions. Coverage is now the constraint rather than the mechanism: the allowlist holds four types and the EC2 topology types are not among them, so the folds still cannot be answered from a snapshot. Filed as #1269. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J3xEUD47xeEX2AK9xSvBug
Both sides add to the same lifecycle surfaces and neither replaces the other: main brought --at/--ambient and observed edges, this branch brings --deep and the recorded depth. Conflicts resolved by keeping both — the snapshot options object carries cwd/stack/region/deep/ambient/ambientKinds, LifecycleSnapshot carries depth, properties and edges, and the CLI accepts all the flags.
This was referenced Aug 1, 2026
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.
Closes #1267. Stacked on #1262 — targets
fix/lifecycle-snapshot-region, since the deep path reuses the per-stack region that fix threads through. Retarget tomainonce #1262 merges.Why
A snapshot recorded identity — logical name, type, physical id, status — plus the stack's CloudFormation exports. It carried no per-resource properties, so nothing that folds over topology could be answered from one.
That
attributesblob is the stack's exports and is identical for every resource in the stack. Verified:webServer,publicSubnetandwebSecurityGroupin the same snapshot all carry the same one. No subnet for an instance, no attached security groups, no route-table associations, no ingress rules.observeResourcesDeepalready existed, and was already wired intolifecycle diff --live. Only the snapshot path never called it.What changed
chant lifecycle snapshot <env> --deeprecords each resource's normalized property tree beside the identity it already kept. Thin stays the default — a deep read is more provider calls and a larger record, so it should be asked for.Depth is recorded, not inferred.
depthis absent on a thin snapshot rather than set to"identity", because every snapshot written before this was thin and treating a missing field as unknown would invalidate all of them.lifecycle showstates it:propertiessits besideresources, not merged into it, so a reader that only wants identity does not have to learn a new shape and old and new snapshots parse the same way.Degradation is explicit at every step, following #1089's rule that an unread resource is a hole with a reason and never a clean empty answer:
Region, again
The deep path was region-blind in a way the thin path no longer is.
observeResourcesDeeptook no region at any layer — not the core interface, notDeepObserveOptions, not the AWS reader — so a multi-region estate read every stack against the ambient region and the out-of-region ones came back empty. Threaded the same way #1262 did for thin, down todescribe-stack-resourcesandcloudcontrol get-resource.Verification
Against a four-stack estate spanning
us-east-1×2,us-west-1andus-west-2:The west stacks degrade honestly rather than silently:
Tests
Six added: thin by default with no depth written; deep records trees alongside identity; no deep reader warns and stays thin; an empty deep read downgrades rather than discarding; unreadable entities are reported; and the stack's region reaches the deep reader.
just buildandnpx eslint packages/ lexicons/aws/srcclean; 1535 tests pass acrosslifecycle,cli/handlersand the AWS lexicon.What this does not do yet
Coverage is now the constraint rather than the mechanism.
DEEP_READABLE_TYPESholds four types and none of the EC2 topology types are among them, sointernetFacingandeffectiveIngressstill cannot be answered from a snapshot. Filed as #1269, and it is the remaining blocker for snapshot-backed search (#1266).🤖 Generated with Claude Code
https://claude.ai/code/session_01J3xEUD47xeEX2AK9xSvBug