Conversation
a788f4a to
be86e28
Compare
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds a containers snapshot API: snapshotDirectory() to create snapshots and snapshots option in start() to restore them, backed by Docker volumes and the Docker archive API for the local dev implementation.
Findings (ranked by severity):
- [MEDIUM] Snapshot restore path nesting — archive read from
/mntintroduces extra directory level - [LOW]
dockerApiBinaryRequestreads entire response into memory unbounded before size check - [LOW] Deserialized snapshot
idis not validated before use in Docker volume names
These review comments were generated by an AI assistant and may not be perfect.
|
I'm Bonk, and I've done a quick review of your PR. This PR adds a containers snapshot API: I posted 3 inline review comments on PR #6337, ranked by severity:
The overall design is sound — the serialization, compat flag gating, capnp schema additions, and test coverage all look good. The |
|
The generated output of |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6337 +/- ##
==========================================
- Coverage 70.71% 70.55% -0.16%
==========================================
Files 420 420
Lines 112752 113229 +477
Branches 18483 18570 +87
==========================================
+ Hits 79729 79894 +165
- Misses 22021 22297 +276
- Partials 11002 11038 +36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
be86e28 to
509974a
Compare
|
/bonk review |
There was a problem hiding this comment.
Findings from detailed review (ranked by severity):
- [MEDIUM]
dockerApiBinaryRequestdefaultmaxResponseSize = kj::maxValue— PUT response bodies read without explicit limit - [MEDIUM]
cleanupSnapshotVolumesconstructs JSON filter without escapingprefix - [LOW] Deserialized
sizenot validated inDirectorySnapshot::deserialize— could yield adoublethat doesn't round-trip exactly for very large values - [LOW] Unnecessary
staticon free functionvalidateSnapshotDir(minor style)
Re: kentonv's JSG_STRUCT question — gpanders's reply is correct: JSG_SERIALIZABLE requires JSG_RESOURCE_TYPE (it references jsgSuper which only JSG_RESOURCE_TYPE defines). There are zero examples of JSG_STRUCT + JSG_SERIALIZABLE in the codebase, and the JSG README explicitly documents this constraint.
The overall design is sound: the snapshot create/restore round-trip via Docker volumes and the archive API is correct, the compat-flag gating is proper, the serialization format is versioned, and the cleanup logic (KJ_DEFER + volumeCommitted flag) handles partial failures well. The path nesting fix in the latest commit correctly addresses the earlier review finding.
These review comments were generated by an AI assistant and may not be perfect.
|
Review posted on PR #6337. Here's a summary of what was posted: Review body (top-level comment, review ID 3963586130):
3 inline comments:
1 reply to kentonv's comment:
|
85da82b to
a3cf897
Compare
|
/bonk Review this PR again |
There was a problem hiding this comment.
Findings from detailed review (ranked by severity):
- [MEDIUM]
latest/TypeScript types exposesnapshots?: DirectorySnapshot[]onContainerStartupOptions— the non-experimental TS override (lines 67-71 ofcontainer.h) explicitly excludes it, but the generated snapshot includes it - [LOW] The experimental guard for
snapshotsinstart()(lines 61-63 ofcontainer.c++) was flagged as redundant by gabivlj — gpanders acknowledged but hasn't removed it yet. However, the guard provides defense-in-depth since users can manually constructDirectorySnapshotobjects (it's aJSG_STRUCT) without calling the experimental-gatedsnapshotDirectory().
The snapshot create/restore round-trip logic is correct: I traced paths like /app/data, /data, and /a/b/c/d through validateSnapshotDir, the archive root extraction, mount path computation, and the Docker archive API PUT/GET cycle — all produce the correct file layout. The KJ_DEFER cleanup pattern with volumeCommitted handles partial failures well, and the ID validation (hex + hyphens, max 64 chars) is solid.
Previous findings from my earlier reviews have been addressed: the maxResponseSize default was removed (callers now pass explicit limits), and JSON filter construction uses the capnp JSON codec instead of string interpolation.
These review comments were generated by an AI assistant and may not be perfect.
|
Review posted on PR #6337. Here's a summary: Review body (top-level comment):
1 inline comment:
Key verification results:
|
Incorrect, @gabivlj's comment was about the |
This is not correct, the type generator is launched with the workerd/types/scripts/build-types.ts Line 117 in a3cf897 This is a pre-existing issue with the type generation pipeline, not a regression in this PR. |
kentonv
left a comment
There was a problem hiding this comment.
Approving API, didn't carefully read implementation.
|
After talking with containers team internally (@IRCody, @spahl) we also need the ability to restore a directory snapshot to an arbitrary mount point (the implementation as-is always mount a snapshot to the same directory that was snapshotted). So the StartParams will actually change to accepting an array of |
The check happens in the single threaded workerd event loop so there is no risk of a race.
61f88a4 to
705de4d
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
Reviewed the updates to the typings on behalf of the wrangler team.
|
@gpanders while confusing based on approvals, this PR wasn't properly reviewed. |
Implement the first draft of the containers snapshot API. It is experimental for now.
Local dev snapshots are implemented using Docker volumes and the Docker archive API.