feat(snapshots): expose imageUri end-to-end (spec, server, all SDKs)#1053
feat(snapshots): expose imageUri end-to-end (spec, server, all SDKs)#1053ferponse wants to merge 3 commits into
Conversation
A Ready snapshot already produces a portable OCI restore image internally, but it was never surfaced on the public snapshot contract, so callers could not restore a sandbox from the image (e.g. to move it across clusters) without patching the server. Expose it as `imageUri`. - spec: add optional `imageUri` to the Snapshot schema in sandbox-lifecycle.yml. - server: add `image_uri`/`imageUri` to the Snapshot response model and populate it from the record's restore image in `_to_snapshot_response`; assert it on the Ready-snapshot service test. - kotlin sdk: add `imageUri` to SnapshotInfo and map it in the converter; assert it in SandboxesAdapterTest. - python sdk: add `image_uri` to the domain SnapshotInfo and map it in the converter; regenerate the lifecycle Snapshot model from the spec. Additive and optional (null/omitted until the snapshot is Ready), so it is backward compatible. Other language SDKs can surface the same field as a follow-up. Co-authored-by: Atenea Agent <srv_atenea_gitlab@ofidona.net>
|
Changed directories: sdks、server、specs. 📋 Recommended labels (based on changed files):
Other available labels:
💡 Tip: Use cc @ferponse |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39aabdd50e
ℹ️ 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".
- server: only serialize imageUri when the snapshot is Ready, so a Ready snapshot later marked Deleting/Failed no longer leaks its restore image; add a test asserting the gate. - kotlin: add a binary-compatibility secondary constructor to SnapshotInfo preserving the pre-imageUri JVM signature for already-compiled callers. - sdk parity: surface imageUri on the Go (SnapshotInfo struct), C# (SnapshotInfo model + ParseSnapshotInfo converter) and JavaScript (SnapshotInfo type) snapshot models so the spec field is end-to-end and not silently dropped by those clients. Co-authored-by: Atenea Agent <srv_atenea_gitlab@ofidona.net>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68a65f9398
ℹ️ 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".
Keep the checked-in artifacts generated from sandbox-lifecycle.yml in sync with the new imageUri field: - regenerate the JS lifecycle OpenAPI types (Snapshot schema) so ApiGetSnapshotOk / the internal LifecyclePaths contract expose imageUri. - regenerate docs/public/api/spec-inline.js (the published API reference bundle) via scripts/spec-doc/generate-spec.js. Co-authored-by: Atenea Agent <srv_atenea_gitlab@ofidona.net>
Summary
Closes #1077.
A Ready snapshot 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) without patching the server. This exposes it end-to-end as
imageUri, across the spec, the server, and all SDKs.Spec
imageUrito theSnapshotschema inspecs/sandbox-lifecycle.yml(the source of truth the SDK clients generate from).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)
Snapshotmodel (openapi-python-client); mapped onto the domainSnapshotInfoin the converter.api/lifecycle.ts(openapi-typescript); mapped onto the domain snapshot model.imageUritoSnapshotInfoand maps it inSandboxModelConverter.Hand-written clients (no spec codegen — field added by hand)
types.go(ImageURI string \json:"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.Testing
Per SDK + server (all green):
./gradlew spotlessCheck :sandbox:test;SandboxesAdapterTestassertsgetSnapshotparsesimageUri.uv run ruff check/pyright/pytest -k snapshot; lifecycleSnapshotregenerated viascripts/generate_api.py.build/vet/test.dotnet test.pytest tests/test_snapshot_service.py tests/test_routes_snapshots.py; the service test asserts the response exposesimageUrionly whenReady.Breaking Changes
Additive optional field; null/omitted unless the snapshot is
Ready.Checklist
docs/public/api/spec-inline.js) fromsandbox-lifecycle.ymlReady, no new privileged dataCo-authored-by: Atenea Agent srv_atenea_gitlab@ofidona.net