Skip to content

docs(help): route stale React Native state to reads, not UI navigation - #4231

Merged
thymikee merged 3 commits into
mainfrom
docs/rn-help-stale-state
Nov 6, 2026
Merged

thymikee merged 3 commits into
mainfrom
docs/rn-help-stale-state

Conversation

@thymikee

@thymikee thymikee commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • help react-native gains a short Stale state section and a routing line. When a wrong or stale value may come from app state or storage (AsyncStorage, MMKV, a feature flag), the agent reads the value instead of navigating the UI to infer it: agent-device cdp runtime eval --expr '<expression>' --await for JS state, and the AsyncStorage location on an iOS simulator or Android.
  • Reason: in an external benchmark (Claude Code + Sonnet, React Native runtime bugs), agent-device was the slowest and costliest setup only on a stale-AsyncStorage bug (median 95 s, $0.32, 20 device calls vs 76 s, $0.17 for a bare shell that read the storage files). The capability exists through cdp; the routing was missing.
  • Scope expansion: the react-native topic moves verbatim to src/commands/schema/cli-help-react-native.ts, because the addition pushed cli-help.ts past the 1000-line lint limit. Same pattern as the gestures and foldable topics.
  • 3 files changed. No linked issue.

Validation

  • Tested SHA: a5052c55736413293824cd8df58f057259d22fb1
  • pnpm check:affected --run --head a5052c55736413293824cd8df58f057259d22fb1: format, lint, typecheck, layering, fallow, build, vitest-related and unit passed (exactCommit=true).
  • cli-help-topics.test.ts asserts the new eval command and the AsyncStorage path.
  • The moved topic text was diffed against origin/main: identical except the added lines.
  • Help-text change only, so no device run. Not measured: whether the new routing shortens a stale-storage run. Self-review was a cold diff read, with no independent reviewer.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.14 MB 6.14 MB +1.0 kB
Package (unpacked) 6.14 MB 6.14 MB +1.0 kB
Package (download) 1.86 MB 1.86 MB +267 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 29.1 ms 23.9 ms -5.2 ms
CLI --help 65.4 ms 50.2 ms -15.2 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Apex Sentinel

Verdict: approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No findings.

Not in the reviewers' prompt (3 files)
  • src/commands/schema/cli-help-react-native.ts: no reviewer was selected for this change
  • src/commands/schema/cli-help-topics.test.ts: no reviewer was selected for this change
  • src/commands/schema/cli-help.ts: no reviewer was selected for this change

Reviewed with this repository's own Sentinel configuration (b42c7c265f07).

Reply under an inline comment with @apex-sentinel-staging note ... or @apex-sentinel-staging pivot ... to re-check that finding.
Comment @apex-sentinel-staging review on this conversation to run a full review.

Earlier reviews

Review of 5b9d7699 · 05.11.2026 18:17 UTC

Apex Sentinel

Verdict: approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No findings.

Reviewed with this repository's own Sentinel configuration (22bd671066f2).

Review of a5052c55 · 05.11.2026 09:09 UTC

Apex Sentinel

Verdict: approve

No findings.

Not in the reviewers' prompt (3 files)
  • src/commands/schema/cli-help-react-native.ts: no reviewer was selected for this change
  • src/commands/schema/cli-help-topics.test.ts: no reviewer was selected for this change
  • src/commands/schema/cli-help.ts: no reviewer was selected for this change

Reviewed with this repository's own Sentinel configuration (495e0e5b26fd).

@thymikee

thymikee commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

At a5052c5, the routing rule is right and the react-native topic move looks verbatim. There are no conflicts. The Coverage log stops at "building macOS helper" with no failing test named, the same cut-off seen on other PRs, and this diff only changes help strings and one help test, so the failure looks unrelated; a re-run should settle it.

Three things in the new Stale state text are worth fixing before merge, since this help is what gets followed literally:

  1. The storage line in cli-help-react-native.ts:72 states one AsyncStorage layout as fact (RCTAsyncLocalStorage_V1, databases/RKStorage). That is the 1.x/2.x layout; AsyncStorage 3.x uses a new SQLite store, so on a 3.x app this route reads nothing or an old value, which is the stale-value problem the section is meant to solve. Could the line name the version it describes, say that a missing file means a newer store, and point to the cdp eval read as the version-independent route?
  2. The Android recipe omits that run-as needs a debuggable package and gives no read command, and both storage recipes need host shell access, so they do not apply to a remote lease. Could the step say "debuggable builds, local simulator or emulator only" and name cdp runtime eval as the supported read otherwise? src/platform-runtime-runtime-hints.ts already states this limit.
  3. The topic routes deeper questions to the owning help topic, yet this section holds the only runtime eval --expr ... --await shape, while help cdp only says "targeted runtime eval". Would it be simpler to put that line, plus a note on which globals --expr can reach, in the cdp topic, and keep this section to the rule plus help cdp? The help test would then assert the qualified text.

The three open inline threads (the test pin, the AsyncStorage layout and the run-as qualification) still apply and line up with the points above. I did not run cdp runtime eval against a live Metro target, so whether the Hermes global scope reaches AsyncStorage is unverified.

@thymikee
thymikee force-pushed the docs/rn-help-stale-state branch 2 times, most recently from 3fb46de to 5b9d769 Compare November 5, 2026 18:10
@thymikee

thymikee commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Fixes at 5b9d769 for the three review points:

  1. AsyncStorage layout: the storage lines now say "AsyncStorage 1.x/2.x layout". A missing file means a newer store (3.x uses SQLite), and the text points to help cdp for a version-independent read.
  2. Android run-as: the section says "debuggable builds on a local simulator or emulator only" and "run-as needs a debuggable package". The storage files need host shell access, so remote leases use help cdp.
  3. Ownership: the runtime eval --expr ... --await shape moved to a new Runtime eval section in the cdp topic. The react-native section keeps the rule plus help cdp, and both help tests assert the qualified text.

Whether --expr reaches AsyncStorage is unverified. The cdp note says module imports are not globals unless the app exposes them, and it makes no promise about AsyncStorage.

@thymikee

thymikee commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

At 5b9d769, pnpm check:affected --run --head 5b9d769 passed on the exact head. The first run failed two unrelated Android snapshot-helper tests (a 5s timeout and a missing diagnostic). Those tests pass in isolation and the diff touches only help text, so I reran, and the rerun passed. Coverage failed again at the same "building macOS helper" cut-off with no failing test named. The other checks are green and all review threads are resolved.

@thymikee

thymikee commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

At 5b9d769, the code looks good. All three points from the earlier review are fixed: the storage line is scoped to the AsyncStorage 1.x/2.x layout, run-as is qualified as debuggable and local-only, and the runtime eval --expr ... --await shape now lives in the cdp topic with tests asserting the qualified text. There are no conflicts.

The Coverage job fails, but this diff only changes help strings and one help test, so it looks like the platform-apple launch-confirmation timing failure seen on other PRs; a re-run should settle it. I could not check the cdp runtime eval flag shape against code, since cdp passes through to an external CLI.

@thymikee
thymikee force-pushed the docs/rn-help-stale-state branch from 5b9d769 to d43b18d Compare November 6, 2026 04:52
@thymikee

thymikee commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Rebased on main at d43b18d. The Coverage failure was the launch-confirmation.test.ts turn-bound flake, fixed on main by #4225; this PR's help changes were not involved.

Also shortened the guidance without dropping a limit: Stale state is now 5 lines (read the value, use help cdp for JS values; file fallback only for debuggable builds on a local simulator or emulator, not a remote lease; AsyncStorage 1.x/2.x paths; missing files can mean a newer store). The cdp Runtime eval section is 2 lines (globals only, module imports are not globals, report instead of guessing). No lint limit, baseline, or waiver changed.

@thymikee

thymikee commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

I found no problems at d43b18d, and the review at 5b9d769 still holds. The new commit only shortens help text, and the qualifiers the earlier fixes added (debuggable, local-only, 1.x/2.x, newer store) are still in the Stale state section of cli-help-react-native.ts. The cdp runtime eval flags match the published agent-cdp 1.6.1 package.

All 17 checks pass and there are no conflicts. The earlier Coverage failure was the launch-confirmation flake fixed on main by #4225. Nothing else needs to happen before merge.

@thymikee
thymikee merged commit 90c9595 into main Nov 6, 2026
17 checks passed
@thymikee
thymikee deleted the docs/rn-help-stale-state branch November 6, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant