Skip to content

simlock files moves files to and from a remote lease's folder #1643

Open

Description

@V3RON

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; put of a missing file; put of a folder; get to stdout and to -o; list; rm; each I11 case; 413 FILE_TOO_LARGE; 413 LEASE_FILES_FULL; 409 FILE_BUSY; 422 INSUFFICIENT_DISK_SPACE; 408 UPLOAD_STALLED; 404 UNKNOWN_LEASE; 404 UNKNOWN_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:changed passes, with every Tests line above as a test.
  • pnpm check passes, lazy-loading.test.ts included.
  • On a Mac with the Android SDK: scripts/slow-e2e.sh e2e/slow-remote-cli.test.ts passes 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, then adb install AppductPlayground.apk exits 0 and adb shell pm list packages names the app.
  • The website build passes: pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs.

Out of scope

Depends on

Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    task:readySpec checked. An agent may implement it once its Depends on allow.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions