google / google/capsem

Byte-safe REST payloads for exec and file routes

Open
#210 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
72
Forks
13
Avg merge
1d 2h
Merged PRs (30d)
5

Description

## Problem

JSON routes on the public HTTP API turn arbitrary bytes into lossy UTF-8:

- `/vms/{id}/exec` and `/run` return `stdout`/`stderr` as `String` (`crates/capsem-service/src/vm_files.rs`, `crates/capsem-api/src/execution.rs`), so binary output is corrupted.
- `/vms/{id}/files/read` returns `String`.
- `/vms/{id}/files/write` accepts `content: String` (there is an open TODO in `crates/capsem-api/src/files.rs`).

Only `/vms/{id}/files/content` carries raw `application/octet-stream`.

## Outcome

Byte-exact REST payloads. Either:

- use the existing raw-body route for file content and an explicit encoding field for exec output, or
- steer byte-oriented clients to the `capsem.stream.v1` stream API from #207.

This changes the public contract and SDK types, so it has to be sequenced with #199 (typed SDKs) and include a migration note.

## Depends on

#207, #199.

Contributor guide

Open the contributing guide

Research direction

Start by reading crates/capsem-service/src/vm_files.rs, crates/capsem-api/src/execution.rs, and crates/capsem-api/src/files.rs, including the open write-content TODO. Review #207 and #199 before choosing how the exec and file routes should represent arbitrary bytes. Done means byte-exact REST payloads, aligned SDK types, and a migration note for the changed public contract.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.