Clarify the stable Container snapshot and Directory contract · Issue #7862 · cloudflare/workerd · GitHub
Skip to content

Clarify the stable Container snapshot and Directory contract #7862

Open

Description

@elliothux

The public documentation and the measured hosted behavior disagree in two places.
The exported Directory types also lack a verified stable producer.
These contract gaps prevent a complete compatibility claim.

Omitted snapshot options

The Container API documentation requires an options object.
The documented exception also rejects an omitted argument.
The page states a last update of 2026-09-30.
The review retrieved the page on 2026-10-21.
Documentation PR #33767 includes a source comment to remove the omitted-options restriction when no-argument calls work.
That PR merged on 2026-09-30, after the optional-argument workerd change.

The fixed @cloudflare/workers-types version 5.20260930.2 accepts an omitted argument.
The matching workerd declaration also accepts an omitted argument.
Its implementation reads a name only when an options object exists.
Upstream PR #7453 made options optional on 2026-09-21.

A retained hosted observation from 2026-10-12 also created a snapshot without an argument.
That observation does not establish behavior for every error condition.

Question: Should callers be able to use container.snapshotContainer() without an options object?
If the answer depends on a compatibility date or flag, specify the boundary.

Image metadata after snapshot restore

The inspect documentation describes an empty image field after snapshot restore.

A controlled hosted experiment completed on 2026-10-12.
The experiment captured two snapshots with different file contents from one running source container.
Each snapshot restored into a fresh Durable Object.
Both restores preserved the expected file contents and SHA-256 values.
This experiment did not measure restored file modes.
Both restored containers reported the same nonempty image reference.
The source container retained its original managed-image reference.

Documentation PR #33825 merged on 2026-09-30.
Its description says that inspection uses the requested startup image and that snapshot restore therefore returns an empty image.
The description cites an internal implementation file; this review did not inspect that file.
The retained hosted observation below occurred after that merge.

The experiment does not identify the restored reference as a base image or a derived image.
The experiment also does not establish a reference-generation formula.

Question: What should ContainerInfo.image return after a successful snapshot restore?
Distinguish the startup transition from the state after an exec readiness check.
If the result is an opaque reference, specify which comparisons callers can rely on.

Stable Directory inputs and their producer

The fixed @cloudflare/workers-types version 5.20260930.2 exports Directory snapshot structures.
ContainerStartupOptions.directorySnapshots accepts these structures.
A restore parameter permits either a snapshot or a mount point without a snapshot.

The same stable Container declaration has no snapshotDirectory() method.
The workerdExperimental flag controls the native method registration.
Upstream PR #7123 placed the method behind that flag on 2026-09-01.
The maintainer states that the method would not ship initially.

The inspected runtime guide and public Containers management API reference identify no stable Directory producer.
The pinned cf CLI command search and Container command modules also expose no Directory snapshot operation.
A search of the installed Cloudflare SDK resources found no Directory snapshot producer.
This bounded review does not prove that no other producer exists.
The review did not fabricate a snapshot ID or enable an experimental producer.

Question: Are the exported Directory structures and directorySnapshots supported stable inputs for this release?
If they are, identify the supported producer and the behavior of a mount-point-only entry.
If availability depends on a date or flag, specify that boundary.

Scope of the evidence

The experiment used the public Durable Object Container API with the durable_object scheduling policy.
The Worker compatibility date was 2026-09-08.
The source image was the documented cloudflare/debian-trixie managed image.
The experiment did not use an experimental Directory producer.

The experiment deleted its Worker and application and restored its three resource inventories.
Those deletions do not prove deletion of the stored snapshot bytes or the end of snapshot billing.
This report contains no account ID, Worker name, snapshot ID, registry reference, credential, or local evidence path.

The review did not rerun the snapshot experiment on 2026-10-21.
A separate resource-input experiment on that date did not call a snapshot API.
The review did not change the runtime, the fixed types, or the compatibility status.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions