Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(snapshot): add inspect command for local snapshots#331

Open
gtsiolis wants to merge 1 commit into
mainlocalstack/lstk:mainfrom
pro-322-add-inspect-command-for-local-snapshotslocalstack/lstk:pro-322-add-inspect-command-for-local-snapshotsCopy head branch name to clipboard
Open

feat(snapshot): add inspect command for local snapshots#331
gtsiolis wants to merge 1 commit into
mainlocalstack/lstk:mainfrom
pro-322-add-inspect-command-for-local-snapshotslocalstack/lstk:pro-322-add-inspect-command-for-local-snapshotsCopy head branch name to clipboard

Conversation

@gtsiolis

@gtsiolis gtsiolis commented Jun 19, 2026

Copy link
Copy Markdown
Member

What

Adds lstk snapshot inspect <file> — an offline, per-service size breakdown of a local .snapshot archive.

No running emulator, no platform call, no auth.

$ lstk snapshot inspect ./checkpoint.snapshot

  ~ Snapshot analysis for checkpoint.snapshot
    4.5 MB
  s3                 3.9 MB   87%
  dynamodb         172.4 KB    4%
  iam              107.4 KB    2%
  cloudfront        78.4 KB    2%
  ...
  ───────────────────────────────
  TOTAL              4.5 MB  100%

Why

snapshot show is cloud-only and reports resource counts plus one aggregate size — it can't answer "what's eating the space in my local snapshot?". inspect reads the archive directly and attributes bytes per service, combining each service's control-plane state (api_states/) and data payloads (assets/), aggregated across accounts and regions.

Details

  • Opens the .snapshot ZIP with stdlib archive/zip and tallies sizes per entry — no emulator, platform, or auth.
  • One row per service, sorted largest-first, with % of total and a grand total.
  • --json emits the same data (raw bytes) for scripts and agents.
  • Cloud (pod:) refs are rejected and pointed at snapshot show.
  • New typed SnapshotInspectedEvent with plain + TUI rendering parity. Unit + integration tests; no Docker required.

Fix PRO-322.

CURRENT inspect NEW inspect
Screenshot 2026-06-19 at 14 35 50 Screenshot 2026-06-19 at 14 59 17

Add `lstk snapshot inspect <file>`, an offline size breakdown of a local
.snapshot archive — no running emulator, no platform call, no auth.

It opens the ZIP and tallies bytes per service, combining each service's
control-plane state (api_states/) and data-asset payloads (assets/) and
aggregating across accounts and regions. Output is one row per service,
sorted largest-first, with percentages and a grand total; --json emits the
same data for scripts and agents. Cloud (pod:) refs are rejected and pointed
at `snapshot show`.

Complements `snapshot show`, which reports cloud metadata and resource counts.
@gtsiolis gtsiolis self-assigned this Jun 19, 2026
@gtsiolis gtsiolis added semver: patch docs: needed Pull request requires documentation updates labels Jun 19, 2026
@carole-lavillonniere

Copy link
Copy Markdown
Collaborator

We are adding json output format for the first time here. What about removing it from here, but do an overall implementation later over all commands that return structured data? My biggest worry is that this becomes the contract we have to stick to as soon as we release it and we should be deliberate about how we format this json (case, structure etc).

gtsiolis commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

Good observation! 😁

Absolutely, already tracked in PRO-307 (draft branch).

I will remove from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.