feat(snapshots): expose imageUri end-to-end (spec, server, all SDKs)#1272
feat(snapshots): expose imageUri end-to-end (spec, server, all SDKs)#1272ferponse wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6057c898f7
ℹ️ 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".
6057c89 to
074d8d2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 074d8d2d32
ℹ️ 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".
Add the optional imageUri to the Snapshot schema and populate it from the record restore image in the server response, only once the snapshot is Ready (null/omitted otherwise).
Regenerate the lifecycle Snapshot model from the spec and map imageUri onto the domain SnapshotInfo in the converter.
Regenerate the lifecycle API types from the spec and add imageUri to the domain SnapshotInfo model.
074d8d2 to
dc6cf5d
Compare
Add imageUri to the domain SnapshotInfo and map it in SandboxModelConverter; the lifecycle client regenerates from the spec at build time. SnapshotInfo keeps a binary-compatibility constructor (with a default on name) so the pre-imageUri JVM constructor and its $default synthetic are preserved for already-compiled callers.
Add the ImageURI field to the hand-written SnapshotInfo type.
Add ImageUri to the SnapshotInfo model and parse imageUri from the response in SandboxesAdapter.
dc6cf5d to
a1efdd1
Compare
|
@Pangjiping could you review this PR when you have a moment? 🙏 Both Codex review comments from the earlier revision are addressed:
Validation: server |
Summary
Closes #1271.
In our organization we integrate with OpenSandbox through the official SDKs rather than calling the REST API directly — the typed client is our integration contract. When a field is missing from the SDK we are forced to drop down to raw HTTP, which adds complexity and couples our code to the wire protocol, hurting maintainability.
A
Readysnapshot already produces a portable OCI restore image internally, but it is never surfaced on the public snapshot contract, so callers cannot restore a sandbox from that image (e.g. to move a sandbox across clusters) through the SDK without bypassing it. This exposes it end-to-end asimageUri, across the spec, the server, and all SDKs.Spec
imageUrito theSnapshotschema inspecs/sandbox-lifecycle.yml.Server
image_uri/imageUrito theSnapshotresponse model and populate it from the record's restore image in_to_snapshot_response, only once the snapshot isReady.Generated clients (regenerated from the spec, not hand-edited)
Snapshotmodel withscripts/generate_api.py(openapi-python-client); mapped onto the domainSnapshotInfoin the converter.api/lifecycle.tswithpnpm gen:api(openapi-typescript); addedimageUrito the domain snapshot model.sandbox-apiOpenAPI generator); addedimageUrito the domainSnapshotInfoand mapped it inSandboxModelConverter.Hand-written clients (no spec codegen — field added by hand)
types.go(ImageURI stringwithjson:"imageUri,omitempty").Models/Sandboxes.csgetsstring? ImageUriandAdapters/SandboxesAdapter.csparsesimageUrifrom the response JSON.imageUriis optional and only populated once the snapshot isReady(null/omitted otherwise), so the change is additive and backward compatible.Commits
feat(snapshots): expose snapshot imageUri in spec and serverfeat(python): expose snapshot imageUri in the Python SDKfeat(javascript): expose snapshot imageUri in the JavaScript SDKfeat(kotlin): expose snapshot imageUri in the Kotlin SDKfeat(go): expose snapshot imageUri in the Go SDKfeat(csharp): expose snapshot imageUri in the C# SDKTesting
Not run (explain why)
Unit tests
Integration tests
e2e / manual verification
server:
uv run pytest tests/test_snapshot_service.py— asserts the response exposesimageUrionly whenReady. Green.kotlin:
./gradlew spotlessCheck :sandbox:test—SandboxesAdapterTest.getSnapshotparsesimageUri; the lifecycle client regenerated from the spec exposes the field. Green.csharp:
dotnet build+dotnet test— 132 passed.javascript:
pnpm run typecheckgreen;api/lifecycle.tsregenerated from the spec.python:
ruff checkclean; lifecycleSnapshotregenerated viascripts/generate_api.py.go: hand-written field; the SDK has no codegen step.
Breaking Changes
Additive optional field; null/omitted unless the snapshot is
Ready.Checklist
Ready, no new privileged data