Skip to content

Commit 57dfc78

Browse files
committed
chore(gates): centralize SDK default host capture ownership
1 parent bde50c1 commit 57dfc78

3 files changed

Lines changed: 22 additions & 20 deletions

File tree

‎docs/agents/code-ownership.md‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# Code ownership
22

3-
Read this for shared contracts, package boundaries, request routing, or diagnostics.
43
Before you edit a module with many callers, run `pnpm depgraph affected <path>` to identify callers and guarantees.
54

65
## Declarations
76

8-
Read the owner. Do not copy its policy into consumers.
9-
107
| Question | Owner |
118
| --- | --- |
129
| Command names | `packages/command-registry/src/catalog.ts` |
@@ -15,8 +12,11 @@ Read the owner. Do not copy its policy into consumers.
1512
| Interaction guarantees | `packages/contracts/src/interaction-guarantees.ts` |
1613
| Runtime-fact admission | `packages/daemon/src/core/runtime-admission.ts`, `src/platform-runtime-gateway.ts` |
1714
| Input fields and audiences | `src/commands/common-input-fields.ts`, `src/commands/input-audience.ts` |
15+
| Released SDK default hosts | `src/sdk/host.ts` |
1816

19-
Shared selectors belong in `@agent-device/selectors`.
17+
For SDK entries `android-adb`, `artifacts`, `limrun`, `metro`, and `remote-config`, use `captureSdkHost` for defaults.
18+
For command-host readers, use `withSdkHost`.
19+
Keep provider callbacks on their supplied host.
2020
Request cancellation and progress belong in `@agent-device/host-kit/request`.
2121
Per-call abort guards belong beside transports in `src/daemon-client/daemon-client-transport.ts`.
2222
Contracts shared across layers belong in `packages/contracts/src`.
@@ -32,16 +32,9 @@ Before you add behavior, split files over 1,000 lines, except generated or fixtu
3232
Split a source module and its tests together.
3333
Do not extend legacy interaction or platform index test aggregations.
3434
Keep tests beside their named module. Put repository artifact guards in `test/repo-guards/`.
35-
Shared helpers belong in `@agent-device/test-kit`, a devDependency.
36-
Production code never imports test-kit.
37-
Test-kit never depends on:
38-
39-
- Platforms.
40-
- Providers.
41-
- The daemon.
42-
- Root.
43-
44-
Do not export test support from production packages.
35+
Shared test support belongs in `@agent-device/test-kit`, a devDependency.
36+
Production code must not import test-kit.
37+
Test-kit must not depend on platforms, providers, the daemon, or root.
4538

4639
## Diagnostics
4740

‎scripts/layering/process-globals-policy.test.ts‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ test('entry declarations permit process reads but do not permit ambient command-
5757
'packages/capture-kit/src/png-worker.ts',
5858
'packages/maestro/src/daemon-port/run-script-http-child.ts',
5959
'packages/react-native/src/companion/client-companion-tunnel-worker.ts',
60-
'src/sdk/android-adb.ts',
60+
'src/sdk/host.ts',
6161
'src/io.ts',
6262
]) {
6363
assert.deepEqual(check('process.env; process.on("SIGINT", stop);', file), [], file);
@@ -120,7 +120,19 @@ test('bare process values are captures in calls, aliases, spreads, returns and c
120120
"import * as p from 'node:process'; captureHostEnvironment(p.default);",
121121
]) {
122122
assert.equal(check(source).length, 1, source);
123-
assert.deepEqual(check(source, 'src/sdk/android-adb.ts'), [], source);
123+
assert.deepEqual(check(source, 'src/sdk/host.ts'), [], source);
124+
}
125+
});
126+
127+
test('SDK adapters capture their default host only through the shared entry', () => {
128+
for (const file of [
129+
'src/sdk/android-adb.ts',
130+
'src/sdk/artifacts.ts',
131+
'src/sdk/metro.ts',
132+
'src/sdk/remote-config.ts',
133+
'src/provider-limrun-runtime.ts',
134+
]) {
135+
assert.equal(check('captureHostEnvironment(process);', file).length, 1, file);
124136
}
125137
});
126138

‎scripts/layering/process-globals-policy.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ const PROCESS_ENTRIES = new Set([
1717
'packages/maestro/src/daemon-port/run-script-http-child.ts',
1818
// Released SDK defaults; #3759 removes these captures after agent-device/host ships (#3757).
1919
'src/io.ts',
20-
'src/sdk/remote-config.ts',
21-
'src/sdk/android-adb.ts',
22-
'src/sdk/metro.ts',
23-
'src/provider-limrun-runtime.ts',
20+
'src/sdk/host.ts',
2421
'src/mcp/command-tools.ts',
2522
'src/daemon-client/daemon-client.ts',
2623
'src/daemon-client/daemon-client-ensure.ts',

0 commit comments

Comments
 (0)