Repository navigation
Description
Part of #1635.
Scope
In remote mode simlock files put, get, list and rm move files to and from the lease's folder on its worker, so simlock files put app-debug.apk then simlock adb install app-debug.apk installs a local build. A transfer of any size goes on while bytes move and ends after 60 s of silence. A folder is refused with a pointer to #1636. A remote simctl or adb that fails after naming a path on this machine prints one hint saying the command ran on the worker.
A user would notice: an upload cut while it was still moving, a file landing under another lease, a download written partly, or a hint on a command that succeeded.
Technical spec
Commit 1cd9315.
Rows
Behaviours: B8, B9
Interfaces: I8, I9
Existing code: X14, X15, X29, X30, X19 (reference/cli.mdx (a simlock files section), using-devices/remote-agents.mdx lease files)
Facts
| # | Fact | Source |
|---|---|---|
| F1 | The upload route takes the file's raw bytes as the body, up to 2 GiB a file and 4 GiB a lease, answers 201, and lists UPLOAD_STALLED, FILE_BUSY, FILE_TOO_LARGE, LEASE_FILES_FULL, INSUFFICIENT_DISK_SPACE |
src/http/lease-declarations.ts:387-446 |
| F2 | get and rm answer UNKNOWN_FILE for a name the folder lacks |
src/http/lease-declarations.ts:423, :434 |
| F3 | A lease file name is 1 to 128 characters of letters, digits, ., _ and -, starting with a letter or digit |
src/contract/operations-leases.ts:93 |
| F4 | The CLI's HTTP port today is GET only, 10 s per call, 1 MiB body | src/ports/http-json.ts:1, :10 |
| F5 | A remote passthrough's output arrives as separate stdout and stderr chunks and ends with the tool's exit code | src/cli/commands/passthrough.ts:61-73 |
Modules touched
src/cli/ (commands/files.ts (new), tree.ts (the files node and its children), index.ts (the files lines of USAGE), commands/passthrough.ts (the hint), environment.ts (the streaming port and a local stat), types.ts, lazy-loading.test.ts, AGENTS.md), src/ports/ (a streaming HTTP adapter beside http-json.ts, its fake, index.ts or testing.ts, AGENTS.md), e2e/slow-remote-cli.test.ts (its Android case), and the website pages reference/cli.mdx and using-devices/remote-agents.mdx. Searches: HttpJson, httpJson, /files, LEASE_FILE_NAME_PATTERN, runRemotePassthrough, tree.ts command nodes.
Rules in play
- ADR 0067: the routes and their limits are the farm's; files stay flat and single (§ "not in this decision": no unpacking).
src/ports/AGENTS.md: a new adapter with its fake; every wait bounded (connect 10 s, 60 s silence).src/cli/AGENTS.md: a new command node; the router loads nothing; errors as one JSON line.- Documentation rule 9: the two website pages.
Tests
Seam: runCli with a fake streaming HTTP port answering the lease-files routes and a fake filesystem, with the fake clock (models: src/cli/tunnel.test.ts for the HTTP fake, src/cli/passthrough.test.ts).
- B8:
simlock files:put;put --name;putof a missing file;putof a folder;getto stdout and to-o;list;rm; each I11 case; 413FILE_TOO_LARGE; 413LEASE_FILES_FULL; 409FILE_BUSY; 422INSUFFICIENT_DISK_SPACE; 408UPLOAD_STALLED; 404UNKNOWN_LEASE; 404UNKNOWN_FILE; 401; unreachable; 60 s silent; a long upload with bytes moving; local mode - B9: the remote path hint: a local file and exit 1; a local folder and exit 1; exit 0; no such local path; two local paths; local mode
Done when
pnpm test:changedpasses, with every Tests line above as a test.pnpm checkpasses,lazy-loading.test.tsincluded.- On a Mac with the Android SDK:
scripts/slow-e2e.sh e2e/slow-remote-cli.test.tspasses its Android case. A CLI in remote mode against a worker's HTTP address leases an emulator,files put e2e/fixtures/appduct/android/AppductPlayground.apk, thenadb install AppductPlayground.apkexits 0 andadb shell pm list packagesnames the app. - The website build passes:
pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs.
Out of scope
- Uploading a folder or unpacking an archive (Upload a folder or a build once for many leases, and put files into an app's container #1636).
Depends on
Written by an agent.
Activity