Skip to content

Commit d43b18d

Browse files
committed
docs(help): shorten the stale-state and runtime eval guidance
1 parent d907af0 commit d43b18d

3 files changed

Lines changed: 14 additions & 24 deletions

File tree

‎src/commands/schema/cli-help-react-native.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ CDP memory routing:
6666
Use perf memory sample or perf memory snapshot for native/process memory; use cdp only for JavaScript heap evidence.
6767
6868
Stale state:
69-
If a wrong or stale value may come from app state or storage, read the value. Do not navigate the UI to infer it.
70-
Read JS state through Metro with help cdp. It owns the runtime eval command shape and which globals the expression can reach.
71-
Stored AsyncStorage files are a fallback for debuggable builds on a local simulator or emulator only. They need host shell access, so they do not work on a remote lease. Use help cdp there.
72-
iOS simulator, AsyncStorage 1.x/2.x layout: Library/Application Support/<bundle-id>/RCTAsyncLocalStorage_V1 under the data container from xcrun simctl get_app_container <udid> <bundle-id> data.
73-
Android, AsyncStorage 1.x/2.x layout: databases/RKStorage through adb shell run-as <package>. run-as needs a debuggable package.
74-
If those files are missing, the app may use a newer store (AsyncStorage 3.x uses SQLite). Do not conclude the value is absent; read it through help cdp instead.
69+
If a wrong or stale value may come from app state or storage, read the value. Do not navigate the UI to infer it. Read JS values with help cdp (runtime eval).
70+
Fallback for debuggable builds on a local simulator or emulator, not a remote lease: read the AsyncStorage 1.x/2.x files.
71+
iOS: Library/Application Support/<bundle-id>/RCTAsyncLocalStorage_V1 in xcrun simctl get_app_container <udid> <bundle-id> data
72+
Android: databases/RKStorage through adb shell run-as <package>
73+
Missing files can mean a newer store (AsyncStorage 3.x). Do not conclude that the value is absent.
7574
7675
Slow-flow investigation:
7776
Keep one session, open the app first, and snapshot -i before interacting.

‎src/commands/schema/cli-help-topics.test.ts‎

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,8 @@ test('usageForCommand resolves cdp help topic', async () => {
586586
assert.match(help, /Avoid cdp profile cpu, trace, network, and console by default/);
587587
assert.match(help, /React Native\/Hermes implements a subset of browser CDP/);
588588
assert.match(help, /agent-device cdp runtime eval --expr '<expression>' --await/);
589-
assert.match(help, /--expr runs in the selected target's JS global scope/);
590-
assert.match(help, /including AsyncStorage, are not globals unless the app exposes them/);
589+
assert.match(help, /--expr reaches only globals the app exposes/);
590+
assert.match(help, /Module imports, such as AsyncStorage, are not globals/);
591591
});
592592

593593
test('usageForCommand resolves react-native help topic', async () => {
@@ -628,19 +628,11 @@ test('usageForCommand resolves react-native help topic', async () => {
628628
assert.match(help, /verifies the overlay is gone with a fresh post-dismiss snapshot -i/);
629629
assert.match(help, /Do not use a plain snapshot after dismiss-overlay/);
630630
assert.doesNotMatch(help, /runtime eval --expr/);
631-
assert.match(help, /Read JS state through Metro with help cdp/);
632-
assert.match(help, /debuggable builds on a local simulator or emulator only/);
633-
assert.match(help, /so they do not work on a remote lease/);
634-
assert.match(
635-
help,
636-
/AsyncStorage 1\.x\/2\.x layout: Library\/Application Support\/<bundle-id>\/RCTAsyncLocalStorage_V1/,
637-
);
638-
assert.match(
639-
help,
640-
/AsyncStorage 1\.x\/2\.x layout: databases\/RKStorage through adb shell run-as <package>/,
641-
);
642-
assert.match(help, /run-as needs a debuggable package/);
643-
assert.match(help, /newer store \(AsyncStorage 3\.x uses SQLite\)/);
631+
assert.match(help, /Read JS values with help cdp/);
632+
assert.match(help, /debuggable builds on a local simulator or emulator, not a remote lease/);
633+
assert.match(help, /iOS: Library\/Application Support\/<bundle-id>\/RCTAsyncLocalStorage_V1/);
634+
assert.match(help, /Android: databases\/RKStorage through adb shell run-as <package>/);
635+
assert.match(help, /Missing files can mean a newer store/);
644636
assert.match(help, /When overlay evidence is required before continuing/);
645637
assert.match(help, /overlay is still visible/);
646638
assert.match(help, /Do not manually press warning\/error text bodies/);

‎src/commands/schema/cli-help.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,8 @@ Recommended subset:
362362
Avoid cdp profile cpu, trace, network, and console by default because agent-device already has perf cpu, trace, network, logs, and react-devtools guidance for those areas.
363363
364364
Runtime eval:
365-
Read a JS value after cdp target select. This route does not depend on the host shell, the storage layout, or the app being local:
366-
agent-device cdp runtime eval --expr '<expression>' --await
367-
--expr runs in the selected target's JS global scope. It reaches only values the app exposes there. Module imports, including AsyncStorage, are not globals unless the app exposes them. If the expression cannot reach the value, report that. Do not guess.
365+
After cdp target select, read a JS value: agent-device cdp runtime eval --expr '<expression>' --await
366+
--expr reaches only globals the app exposes. Module imports, such as AsyncStorage, are not globals. If it cannot reach the value, report that. Do not guess.
368367
369368
Output contract:
370369
Until cdp has a compact leak report command, synthesize one from memory usage diff, snapshot diff, leak-triplet, and retainers. Report heap deltas, top retained classes/shapes, leak-triplet rows that stayed high after cleanup, and the shortest useful retaining paths. Do not paste raw heap snapshots or large allocation profiles into the response; use exported artifacts only when the user asks for raw data.

0 commit comments

Comments
 (0)