Skip to content

feat: upload, freeze, and export context bundles for Moca - #52

Merged
moonlight16 merged 1 commit into
mainfrom
feat/context-upload-freeze-export
Oct 9, 2026
Merged

moonlight16 merged 1 commit into
mainfrom
feat/context-upload-freeze-export

Conversation

@moonlight16

Copy link
Copy Markdown
Member

Part of the work split out of rossoctl/moca#455 (the original context-delegation PR). Ports the upload and freeze work from #50 (the original upload/freeze PR, kept open as a reference) onto main after #51 (removed sandbox pools).

Moca delivers context to its shared, long-running sandboxes as a bundle. This PR adds what it needs:

Call What it does
POST /internal/v1/contexts Moca creates a Context owned by the user it acts for
POST {ctx}/upload-capabilities One-time upload URL and token for the client (5 minutes, single use)
PUT /v1/uploads/{id} The client uploads a .context bundle; a short-lived helper Pod validates it and writes a revision
POST /internal{ctx}/freeze Pins that exact revision; later uploads are rejected
GET /internal{ctx}/revisions/{sha}/bundle New: streams the frozen revision back to Moca
DELETE /internal{ctx} Deletes the Context

{ctx} is /v1/namespaces/{ns}/contexts/{name}. Trusted calls require Moca's service token (CS_CONTROL_PLANE_TOKEN) and the user Moca acts for (X-Context-Subject). docs/context-upload.md has the flow diagram and the limits.

Differences from #50:

Known limits:

  • Upload capabilities live in memory, so run one replica.
  • Freeze blocks uploads and new revisions, but not snapshot restore, clone, or direct PVC sync. Follow-up.

🤖 Generated with Claude Code

Moca creates a Context, gives the client a one-time upload capability, freezes the uploaded revision, and downloads that frozen revision as a portable bundle. Context Service stores the bytes and never creates sandboxes.

Ported from #50 without the PVC attachment endpoint, which bundle delivery does not need. Adds the frozen-bundle export endpoint, aborts a failed export instead of returning a truncated 200, and starts without a helper image (upload and export are then unavailable).

Part of the work split out of rossoctl/moca#455.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Jeremy Cohn <Jeremy.Cohn@ibm.com>
@moonlight16
moonlight16 merged commit a0ddd62 into main Oct 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant