cloud-mock-boat
boat.dev as a cloud-mock world: an account's sandboxes behaving the way boat's
documentation says, on a virtual clock, with every request and answer checked against boat's own
OpenAPI document. It replaces jevgent's hand-written boat fake and drives the real sandbox-boat
adapter, in-process or over a socket.
let mock = cloud_mock_boat::mock(cloud_mock_boat::DEFAULT_KEY); // checked against the document
let boat = sandbox_boat::Boat::new(mock.io(), DEFAULT_KEY).with_base(mock.world(|w| w.api_url()));
// drive the adapter; its sleeps move the world's clock
mock.assert_conforms();
mock.world(|w| ...) reaches the world: w.config (durations, plan, balance, out_of_capacity),
w.on_command(hook) to decide a command and how long it takes in virtual time, w.fail(id, why),
w.take_deliveries() for signed webhook deliveries, w.set_origin(url) with a socket.
What is modelled
| Part | What |
|---|---|
| Lifecycle | provisioning, ready, archiving, archived, cloning, error; stop saves the disk and removes the machine, resume lands on a new machine with a new address and host key, fork copies the newest snapshot, recover, delete as a background operation |
| Auto-stop | default one hour, ttlSeconds at create, resume and PATCH; a new deadline replaces the old; a stopped disk is kept 14 days (snapshot_data_expired) |
| Snapshots | one each minute after a write while running, one at every stop (not a forced one), named snapshots (saving, ready, a reused name replaces the old once ready), the sandbox's own list and its newest |
| Limits | running at once, starts per minute/hour/day, the trial, xlarge, balance (402), no capacity (503), failFast, idempotency keys, GET /limits, GET /sandboxes/{id}/usage |
| Machine | commands over a real sh on the sandbox's disk or scripted (waited for, timed out, detached, status, stop), files inline (5 MiB) and by signed URL, SSH keys and host keys, hosted ports; a command sent while the machine starts waits up to 60 s of virtual time |
| Commands | waited for, detached, streamed (application/x-ndjson), attached to by offset, stopped (a detached command shows nothing until it ends, unless its Finished::writing says what it had written by each moment, which GET commands/{id}?stdoutOffset=&stderrOffset= then returns as it goes); history with stored output; the process list; artifacts; 409 monitoring_off (src/commands.rs) |
| Account | /me, organizations and the wallet new sandboxes bill, data retention (zero data retention, snapshots off and monitoring off, per account and per sandbox; a stop erases a snapshots-off sandbox), repositories, secrets, environments with immutable versions (a sandbox is pinned to one; upgrade moves it), the session token (403 session_required) (src/identity.rs) |
| Keys | the account key, scoped keys by action, sandbox and environment, TTL, rotate, revoke, usage; OpenTelemetry export; credential profiles; the AI credentials proxy and AI usage (src/keys.rs) |
| Agents | prompt, prompt status, conversations (parallel, one turn at a time in each), events with a cursor, steer (native or fallback by harness, 409 no_running_turn with its reason), interrupt (one conversation or all), provider_not_configured, scripted turns (src/agent.rs) |
| Sharing, desktop | share and unshare of an organization sandbox (shared/private, logins wiped at the next start), share codes of a named snapshot (shown once, from takes one, revoke), the desktop and noVNC URL (src/share.rs) |
| Snapshot contents | the account-wide snapshot list, a snapshot's tree, a file with Range or a folder as a tar, signed download chunks, deleting one snapshot or all of a sandbox's with X-Ascii-Confirm-Delete (src/contents.rs) |
| Webhooks | endpoints (HTTPS 443, ten at most, secret shown once, rotate), signed deliveries made at each state change and handed to the test |
| Contract | spec/boat-v1.yaml (vendor's) and its JSON conversion; every request and answer under /api/v1 is checked |
What is still 501
Nothing in the document: every operation is modelled. An operation the document does not have answers
501 naming it. The sweep test (src/tests_sweep.rs) walks the whole document and holds the (empty)
list of operations that answer 501, and fails on any answer the document does not allow.
How the agent routes behave without a harness: a turn is scripted (BoatWorld::on_prompt gives a
Reply: text, tool calls, how long it takes, or a failure); without a script the agent echoes the prompt
after Config::agent_turn. The state machine, the event stream and its cursor, steering and interrupting
follow docs.boat.dev/integrated-agents*.md (src/agent.rs).
Where the docs are silent
Searched 2026-10-21: the vendor's pages (primary: https://docs.boat.dev, the OpenAPI file) and a web search for the delete header, machine sizes and plan limits (nothing beyond the vendor: a listing site, https://www.toolify.ai/tool/boat, secondary, gives the $20 plan and the free trial only). Where nothing was found the mock's own choice is marked.
| Question | Answer | Source |
|---|---|---|
A bash -lc command | runs as bash -c: a login shell would read this machine's own profile into the output | mock's choice |
| Error code of a delete without the confirm header | confirm_delete (409) | mock's choice; the status is the document's |
| Code of a command to a stopped or failing sandbox | machine_not_running, sandbox_error, sandbox_not_ready (409) | machine_not_running is named by docs.boat.dev/api/v1.md for host; the rest the mock's choice |
| Code when a file is missing | file_not_found (404) | the OpenAPI document |
xlarge without the plan | machine_type_not_available (403) | mock's choice |
| Error codes, checked against docs.boat.dev/api/v1.md's error table (2026-10-25) | unknown_environment (400), snapshots_disabled (409: resume, fork or save of a sandbox with snapshots off), provider_not_configured, sandbox_not_promptable, prompt_required, fast_mode_not_supported, no_running_turn (reasons turn_ended, turn_not_started, no_turn, not_running from the steer page), snapshot_not_found | the vendor's pages (primary). The table gives the code, not always the operation that raises it: which operation raises snapshots_disabled is the mock's reading |
| Error codes the documents do not give (guesses) | confirm_delete (409, a missing or wrong X-Ascii-Confirm-Delete; the status is the document's), invalid_conversation, conversation_not_found, prompt_not_found, invalid_provider, not_organization_sandbox, share_not_found, 416 range_not_satisfiable, interrupt of a sandbox with nothing running answering status: "idle" | mock's choice |
| How many endpoints before a webhook is refused | ten, webhook_limit_reached (409) | the number is docs.boat.dev/webhooks.md (primary), the code the mock's |
| What a signed file URL looks like | /_machine/{id}/file?path&method&exp&sig, a hash of a made-up secret | mock's choice |
| Fork of a sandbox with no snapshot yet | 409 fork_failed | mock's choice; the first snapshot is taken at ready |
| How long each transition takes | provision 3 s, clone 4 s, stop 4 s, hydrate 10 s, named save 40 s, delete 2 s | mock's choice, in Config |
| Start limits | paid 12/60/200, trial 5/25/75 | docs.boat.dev/limits.md for the paid and trial rows' shape; the numbers beyond the fixtures are the mock's |
| The wait after a rate limit | in the body (window, limit); no Retry-After header | the OpenAPI document and its error model |
Files
| Path | What |
|---|---|
src/world.rs | state, config, events, dispatch |
src/sandboxes.rs | sandbox routes, the lifecycle and snapshots on the clock |
src/machine.rs | commands, files, signed URLs, SSH, ports |
src/snapshots.rs, src/account.rs | named snapshots; limits, webhooks, deliveries |
src/commands.rs | commands as boat keeps them: processes, history, streams, artifacts |
src/agent.rs, src/share.rs, src/contents.rs | the integrated agents; sharing and the desktop; what a snapshot holds |
src/identity.rs, src/keys.rs | the account, environments, retention; keys, telemetry, profiles, the AI proxy |
src/tests_*.rs | the gaps, commands, account and the sweep over the whole document |
src/spec.rs, spec/ | the contract and its pinned document (spec/SOURCE.md) |
src/tests.rs, tests/adapter.rs | the world's own tests; the real adapter against the world |