feat(snapshots): expose imageUri end-to-end (spec + server + Kotlin/Python SDK)#1053
feat(snapshots): expose imageUri end-to-end (spec + server + Kotlin/Python SDK)#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
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.imageUrito theSnapshotschema inspecs/sandbox-lifecycle.yml(the source of truth the SDK clients generate from).image_uri/imageUrito theSnapshotresponse model and populate it from the record's restore image in_to_snapshot_response.imageUritoSnapshotInfoand map it inSandboxModelConverter.image_urito the domainSnapshotInfoand map it in the converter; regenerate the lifecycleSnapshotmodel from the spec.imageUriis optional and only populated once the snapshot isReady(null/omitted otherwise), so the change is additive and backward compatible.Testing
./gradlew spotlessCheck :sandbox:test— green;SandboxesAdapterTestassertsgetSnapshotparsesimageUri.uv run ruff check/pyright/pytest -k snapshot— green; lifecycleSnapshotregenerated viascripts/generate_api.py.uv run pytest tests/test_snapshot_service.py tests/test_routes_snapshots.py— 28 passed; the Ready-snapshot service test asserts the response exposesimageUri.Breaking Changes
None. Additive optional field.
Checklist
Co-authored-by: Atenea Agent srv_atenea_gitlab@ofidona.net