Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0af41b0c51
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
184cf5e to
2d1abe0
Compare
- Add GET /snapshots/{snapshotID}: returns SnapshotInfo for a single snapshot
- Add DELETE /snapshots/{snapshotID}: soft-deletes a snapshot template (reuses
softDeleteTemplate, invalidates template cache)
- Extend SnapshotInfo with cpuCount, memoryMB, diskSizeMB, createdAt fields
- Update GET /snapshots list to populate the new fields
- Update spec/openapi.yml and regenerate api.gen.go accordingly
Closes e2b-dev#3456
… create response
POST /sandboxes/{id}/snapshots was returning zero values for the four new
required SnapshotInfo fields. Populate them from the source sandbox, which
already has VCpu, RamMB, TotalDiskSizeMB in memory at the point of return.
2d1abe0 to
b23c42f
Compare
|
Thanks @AdaAibaby for the work on a fuller snapshot CRUD surface and richer SnapshotInfo; the handler split was easy to follow. This PR has been inactive since early August and now conflicts with main, which has moved a lot in the API handlers and the OpenAPI spec since. I'm closing it for now rather than leave it open. Whether the API should grow this way is a maintainer call. If you'd like to continue, a rebased PR against current main is welcome and can be reopened or replaced. |
…reatedAt GET /snapshots returns only snapshotID and names, so a caller cannot see a snapshot templates specs or age without a second lookup. Add four optional fields to SnapshotInfo, populated from the row ListTeamSnapshotTemplates already returns - no new DB query: - cpuCount <- Vcpu - memoryMB <- RamMb - diskSizeMB <- TotalDiskSizeMb (nullable; omitted when not recorded) - createdAt <- CreatedAt All four are optional/omitempty, so the change is backward compatible. The large api.gen.go diff is the regenerated embedded-spec blob; no handwritten Go beyond the SnapshotInfo struct changes. This is the low-risk slice of the earlier snapshot work (e2b-dev#3457); the GET/DELETE single-snapshot CRUD from that PR is left out pending a maintainer design call (tracked separately).
Summary
Fixes #3456
Depends on #3441 (must merge first — this branch includes the fork endpoint commit as its parent)
GET /snapshots/{snapshotID}— retrieve a single snapshot by ID or alias (404 if not found/not owned)DELETE /snapshots/{snapshotID}— soft-delete a snapshot template and release its aliases (204 on success)SnapshotInfo— addscpuCount,memoryMB,diskSizeMB,createdAtto both the new GET endpoint and the existing list endpointNo new DB queries: all fields come from the existing
ListTeamSnapshotTemplatesrow.Changes
spec/openapi.ymlGET/DELETE/snapshots/{snapshotID}paths; add 4 fields toSnapshotInfoschemaapi/internal/api/api.gen.goSnapshotInfostruct; add server/client interface methods, request builders, response parsers, and gin routes for both new endpointshandlers/snapshot_get.goListTeamSnapshotTemplates(limit 1) → JSON responsehandlers/snapshot_delete.gosoftDeleteTemplatereuse → cache invalidationhandlers/snapshot_template_list.goSnapshotInfofields in the list mapperTest plan
GET /snapshots/{snapshotID}returns 200 with all fields populatedGET /snapshots/{snapshotID}returns 404 for unknown snapshotDELETE /snapshots/{snapshotID}returns 204 and removes snapshotGETafterDELETEreturns 404DELETEGET /snapshotslist now includescpuCount,memoryMB,diskSizeMB,createdAt