e2b-dev / e2b-dev/runtime

feat(api): Snapshot complete CRUD + enhanced SnapshotInfo

Open
#3,456 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.6k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Problem

GET /snapshots lists snapshots but there is no way to retrieve a single snapshot by ID or delete one. The SnapshotInfo schema only exposes snapshotID and names — users cannot see resource specs (vCPU, RAM, disk) or creation time without listing all snapshots and filtering client-side.

Proposed changes

New endpoints
  • GET /snapshots/{snapshotID} — return SnapshotInfo for a single snapshot (404 if not found or not owned by team)
  • DELETE /snapshots/{snapshotID} — soft-delete a snapshot template, release its aliases, return 204
Enhanced SnapshotInfo

Add four fields populated from the existing ListTeamSnapshotTemplatesRow query result (no new DB queries needed):

Field Source column
cpuCount vcpu
memoryMB ram_mb
diskSizeMB total_disk_size_mb
createdAt created_at

Implementation notes

  • GET handler resolves the alias via templateCache.ResolveAlias (same path as POST /snapshots/{id}/fork) then calls ListTeamSnapshotTemplates with PageLimit=1.
  • DELETE handler reuses the existing unexported softDeleteTemplate helper from template_delete.go and invalidates the template cache.
  • api.gen.go is manually maintained (not regenerated from spec); updated by hand following existing patterns.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing POST /snapshots/{id}/fork path and its templateCache.ResolveAlias usage, then inspect template_delete.go for softDeleteTemplate. Update api.gen.go by following its existing patterns and use ListTeamSnapshotTemplates with PageLimit=1. Done means single-snapshot GET and soft-delete DELETE behavior match the stated ownership, 404, 204, alias-release, cache-invalidation, and SnapshotInfo field requirements.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.