Lease files: push a file or folder into an app's container

未关闭
#2,006 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
android, ios, typescript

调研方向

This spans the CLI, HTTP route, lease-files service, daemon, core driver catalog, and iOS and Android drivers; start with the linked technical spec at commit d95c152c6 and the listed seams in src/daemon/lease-files.test.ts, src/drivers/android/index-device-tcp.test.ts, and src/drivers/ios/device-tcp.test.ts. Follow the module flow from src/cli/commands/files.ts through the gateway to each driver, then use the listed real-device slow-lane checks to confirm files can be pushed and read back while container modes remain intact.

由索引模型根据 Issue 内容生成。

描述

task:ready

Part of #1636.

Scope

simlock files push <name> --app <id> --to <path> copies a stored file or folder into the data container of an app on the lease's iOS simulator, Android emulator or Android phone, on a worker and through a gateway.

If it goes wrong, files land outside the app's container or in another app, the app can no longer be reached by run-as, or a lease's end hangs on a copy.

Technical spec

Commit d95c152c6.

Rows
  • Behaviours: B11, B12, B13, B14, B15, B16
  • Stored state: S4
  • Interfaces: I6, I7, I12, I13
  • Existing code: X3, X5, X7, X10, X12, X13, X14
Facts
# Fact Source
F1 With a debuggable app on the Android 15 default and the Android 16 Play image, the commands of I6 and I9 exit 0 and every byte comes back, path with a space and a quote included the rows' own command lines through adb -s emulator-5690, 2026-11-30, both images: untar 0, tar 0, equal shasum
F2 An archive with a ./ entry of mode 755 unarchived into . makes run-as refuse the app; one with entries for files, links and empty folders only, under umask 022, leaves the modes of . and files, twice in a row the same emulators: run-as: /data/user/0/dev.t1636dbg readable or writable by others: 40755 before, drwx------ . and drwxrwx--x files after
F3 run-as exits 1 with package not debuggable: X, unknown package: X or package not an application: X on stderr the same emulators, adb shell "run-as <app> sh -c :"
F4 simctl get_app_container <udid> <app> data exits 2 for an unknown app, and prints (null) with exit 0 for a system app xcrun simctl get_app_container on iOS 27.2, 2026-11-30
F5 A relay waits 330 s for an answer src/gateway/relay.ts:42
F6 The Android fixture app is debuggable, and the iOS one is a simulator build aapt2 dump badging e2e/fixtures/appduct/android/AppductPlayground.apk: application-debuggable
F7 DeviceTcp is the capability to model on: the driver member, the catalog call, the fake src/core/driver.ts:408, src/core/driver-catalog.ts:141, src/core/fake-device-tcp.ts
Modules touched

core (app-files.ts, driver.ts, driver-catalog.ts, fake-driver.ts, testing.ts), drivers/ios (app-files.ts, index.ts), drivers/android (app-files.ts, index.ts, passthrough-rules.ts, physical-handler.ts), lease-files, http (lease-declarations.ts, app.ts), contract (errors.ts, the protocol bump), daemon (worker-composition.ts, gateway-lease-files.ts), ports (http-stream.ts), cli (commands/files.ts, the help in src/cli/index.ts), website (copy-files, cli, errors, the OpenAPI document), e2e/slow-remote-cli.test.ts. Searches: rg -l DeviceTcp src, rg "runAdbOn|runAdb\b" src, rg "HttpStreamRequest" src.

flowchart LR
  C[cli files push] --> H[http route]
  H --> L[lease-files]
  L --> W[daemon worker-composition]
  W --> K[core driver catalog]
  K --> I[drivers/ios app-files]
  K --> A[drivers/android app-files]
Rules in play
  • ADR 0100 §3, §4: an archive on the worker's disk, adb push, no file through adb shell, no change of the device's state.
  • src/drivers/AGENTS.md: the capability takes core's shapes; no driver imports lease-files or the contract.
  • ADR 0048 and src/drivers/ios/AGENTS.md: simctl runs on the device set the driver is scoped to.
  • .dependency-cruiser.mjs lease-files-imports-little: lease-files takes appFiles as a dependency and never sees a driver.
  • Safety rule 10: app, to and the body are bounded before they reach a command line.
  • src/contract/AGENTS.md Protocol version: one bump for the three new codes.
  • Documentation rule 9: the pages above and the codes in the errors reference; the docs say to stop the app before a push.
Tests

Seams: createLeaseFiles with FakeAppFiles (model: src/daemon/lease-files.test.ts), the drivers with ScriptedProcessRunner (src/drivers/android/index-device-tcp.test.ts, src/drivers/ios/device-tcp.test.ts), runCli (src/cli/index-files.test.ts), the gateway pair (src/daemon/relay-gateway-files.e2e.test.ts).

  • B11: An HTTP caller pushes a stored file or folder through I7; sees 200, the driver was handed an archive of it, and no archive is left: folder's contents; empty folder; one file; link out left out; each refused path of Examples; Documents/ echoed as Documents; a bad app id; a body that is no JSON, too long or without a field; unknown stored name; no driver capability or an iPhone (APP_FILES_UNSUPPORTED); UNKNOWN_APP; APP_FILES_FAILED; a file that shrinks while it is archived; disk low; 300 s (answered though the driver has not returned); caller goes away (runs on); lease ends during it
  • B12: The iOS driver writes the archive into the simulator's data container: new and existing folders; a file replaced; others kept; app unknown (exit 2); (null) printed; another simctl failure; link in the path that leads out; . ; aborted; physical device unsupported
  • B13: The Android driver pushes the archive and has the device unarchive it, on an emulator and a phone, and removes its temporary folder after a success and after a failure: emulator; phone; path with a space and a quote; an archive with no entry (the folder is made, nothing is pushed); what an earlier copy left is removed first; unknown package; package that is no application; not debuggable; adb push fails; unarchiving fails; the removal fails (the copy still succeeds); emulator without a serial; phone behind a closed gate; a step that times out; aborted; two copies on one device run one after the other, on two devices together
  • B14: simlock files push prints the reply of How it works: success; an answer after 200 s; none after 360 s (REMOTE_UNREACHABLE); missing --app or --to (exit 2); a name that is no file name (exit 2, nothing sent); BAD_REQUEST exits 2, each other error of I7 keeps its code and exits 1
  • B15: A gateway relays a push, and its refusals carry the caller's lease id: success; UNKNOWN_APP; worker not connected
  • B16: simlock files push then a read in the container, on a real simulator and a real emulator with a debuggable app: iOS; Android; on Android a folder with files/ in it to ., twice, after which the container and files have the modes they had

Done when

  • The Android driver spawns no streaming child for a copy: rg spawnStreaming src/drivers/android/app-files.ts prints nothing.
  • website/scripts/check-openapi.mjs passes with POST /v1/leases/{id}/files/{name}/push.
  • Slow lane (real simulator and real emulator): new cases in e2e/slow-remote-cli.test.ts push a folder into the container of the Appduct fixture app and read it back with simctl get_app_container and adb shell run-as; the emulator's also pushes a folder holding files/ to . twice and compares the modes of the container and files.

Out of scope

Real iPhones and iPads, release Android apps, stopping the app, app groups. Pulling (#2007).

Depends on

  • #2004 because: TreeArchive and the route action of LeaseFiles.handle
  • #2005 because: PROTOCOL_VERSION_RANGE and openFile in src/lease-files/store.ts

Written by an agent.

主要语言
TypeScript
星标
730
派生
44
平均合并
15 小时 28 分钟
30 天内合并 PR
387

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/simlock 的其他 Issue

查看 callstackincubator/simlock 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。