Thanks to visit codestin.com
Credit goes to github.com

Skip to content

docs: align snapshot fallback and actions guidance - #1713

Merged
thymikee merged 2 commits into
mainfrom
claude/github-issue-1689-ozzobu
Aug 10, 2026
Merged

docs: align snapshot fallback and actions guidance#1713
thymikee merged 2 commits into
mainfrom
claude/github-issue-1689-ozzobu

Conversation

@thymikee

@thymikee thymikee commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

Two website pages described snapshot in ways that no longer match the shipped command, so an agent reading them would misdiagnose a recovered capture and never discover --actions.

Snapshot guide claimed regular iOS capture never falls back:

Note: If XCTest returns 0 nodes (foreground app changed), agent-device fails explicitly. It does not automatically switch to AX.

Regular capture actually runs a bounded recursiveTree → querySweep → privateAX recovery ladder (regularVisiblePlan in RunnerTests+SnapshotCapturePlan.swift, per ADR 0004). The page now has an iOS capture behavior section written from the accepted decision and the live plan: the regular visible strategy recovers through the ladder when XCTest returns sparse output; the ladder is bounded by the capture budget; recovered/sparse results stay observable through quality warnings and --json snapshotQuality rather than being presented as an empty UI; --raw selects the raw diagnostic strategy, which stays tree-first and preserves strict capture failures. Private-AX recovery and custom-action reads are documented as simulator-specific — physical devices bound the XCTest work with a probe instead. Capture tiers are described as internal, not as user-selectable backends (the old xctest / ax "Backends (iOS)" list read like a choice; it isn't one).

Command reference published a three-flag usage line while the CLI has grown three more flags:

-agent-device snapshot [--diff] [-i] [-d <depth>] [-s <scope>] [--raw]
+agent-device snapshot [--diff] [-i] [-d <depth>] [-s <scope>] [--raw] [--actions] [--force-full] [--timeout <ms>]

--actions is now documented on both pages as iOS-simulator-only and planning-only. It names the affordances an element merged away (UIAccessibilityCustomAction, React Native accessibilityActions) so a card whose reply/options controls are not separate elements still lists them — but there is no API to trigger one, so the docs route readers to the detail screen, an equivalent labeled element, or coordinates from the rect. The guide also records the per-element accessibility round trip, the partial-coverage disclosure, and that --actions is mutually exclusive with --raw: customActionFlagsResponse in src/daemon/request-router.ts rejects the pair as INVALID_ARGS at the shared request seam, before any session or device work, so CLI, Node client, and MCP all give the same answer.

To stop the usage line drifting a third time, src/__tests__/command-doc-coverage.test.ts gains a schema-derived gate: commands.md must publish exactly what buildCommandUsage('snapshot', getCliCommandSchema('snapshot')) returns. The flag list is never restated in the test — the schema stays the single source of truth, so adding a snapshot flag fails the gate until the reference is updated. The fence walker the existing token checks already used is extracted so both checks parse code blocks one way.

Closes #1689

Validation

Docs-only for behavior — no runtime, CLI, grammar, ADR, or runner code changed, so there is no device-facing path to verify on a simulator; the two prose pages are checked against ADR 0004, the live regularVisiblePlan/rawDiagnosticPlan, the request-router flag guard, and the --actions field description rather than against a device.

The new gate was proven red before the docs edit, failing as command reference doc coverage > commands.md publishes the canonical snapshot CLI usage and naming the missing line verbatim; it passes after. A companion test plants a drifted usage line to prove the gate can still fail. check:affected selected format, lint, typecheck, fallow, and the related-vitest run — all green — and the Rspress site builds clean.

Two notes for the reviewer:

  • The plan's drift check flagged commands.md as changed since 13bc70f24, but the drift is confined to the HarmonyOS, install, and cloud sections; every in-scope excerpt still matched live code, so this was not treated as a stop.
  • website/doc_build/ is not gitignored, so pnpm --dir website build leaves ~2,300 untracked generated files in the worktree. check:affected folds untracked files into its change set, so the build output fails format:check on a clean tree and makes the gate unrunnable until the directory is deleted by hand. I removed the output rather than adding an ignore rule, since .gitignore is outside this change's scope — but the missing entry looks worth a follow-up.

3 files changed; scope stayed within the two website pages and their gate.

The snapshot guide claimed a zero-node XCTest result fails without ever
switching to AX, but regular iOS capture has an explicit recursive-tree →
query-sweep → private-AX recovery plan (ADR 0004,
RunnerTests+SnapshotCapturePlan.swift). The public CLI also exposes
`--actions`, `--force-full`, and `--timeout`, while both website reference
pages published a three-flag snapshot usage line.

- Add a schema-derived gate: `commands.md` must publish the exact usage
  `buildCommandUsage('snapshot', getCliCommandSchema('snapshot'))` produces,
  so the canonical invocation cannot drift from the command schema again. The
  flag list is never restated in the test. Proven red against the pre-fix
  `commands.md`.
- Extract the fence walker both doc checks now share, and prove the new gate
  fails on a planted usage drift.
- Publish the canonical snapshot usage in the command reference and describe
  `--actions` as iOS-simulator-only and planning-only.
- Replace the "Backends (iOS)" list with an iOS capture behavior section
  written from ADR 0004 and the live capture plan: regular visible strategy
  with a bounded recovery ladder, raw diagnostic strategy preserving strict
  capture failures, and recovered/sparse/degraded output staying observable
  through quality warnings. Capture tiers are documented as internal, not as
  user-selectable backends.

Custom-action discovery stays separate from invocation: the runner can read
names but cannot trigger them (RunnerAXSnapshotBridge.h), so neither page
implies otherwise.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014VzyMim5q4jbp1xDMm3jVo
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-10 14:46 UTC

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.05 MB 2.05 MB 0 B
JS gzip 665.2 kB 665.2 kB 0 B
npm tarball 802.2 kB 802.2 kB 0 B
npm unpacked 2.80 MB 2.80 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 30.0 ms 29.5 ms -0.5 ms
CLI --help 70.0 ms 69.0 ms -1.0 ms

Top changed chunks: no changes in the largest emitted chunks.

@thymikee

Copy link
Copy Markdown
Member Author

Exact-head review at 143baefc9: not ready. P1 public-doc contradiction: snapshots.md and the PR body say --raw --actions returns a raw tree without actions, but shipped request routing rejects that pair before device work with INVALID_ARGS (--actions and --raw are mutually exclusive), pinned by request-router-custom-action-flags.test.ts. Linked #1689 explicitly requires documenting incompatibility. Update both docs/summary to say the combination is rejected and users must choose either --raw or --actions. Other capture-plan/actions claims match ADR 0004 and production, the schema-derived usage gate is meaningful, and docs-only device evidence is N/A. No ready label applied.

Both pages described the combination as a silent no-op ("returns a raw
tree without them"), which cannot happen: `customActionFlagsResponse` in
src/daemon/request-router.ts rejects `snapshotCustomActions` + `snapshotRaw`
with INVALID_ARGS at the shared request seam, before any session or device
work, so CLI, Node client, and MCP all get the same answer. Pinned by
src/daemon/__tests__/request-router-custom-action-flags.test.ts.

The underlying reason was right and is kept — custom actions are only
readable through the private-AX capture path, which the raw diagnostic
strategy does not take — but the user-visible outcome is a rejection, not a
degraded capture, so both pages now say to choose one flag or the other.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014VzyMim5q4jbp1xDMm3jVo

Copy link
Copy Markdown
Member Author

You're right, and thanks for catching it — fixed in aef59fdd8.

I'd searched for the guard and concluded no rejection existed. My grep was scoped to customActions occurrences carrying reject/error wording, which misses customActionFlagsResponse in src/daemon/request-router.ts:356-365 entirely: it keys on the flag names snapshotCustomActions / snapshotRaw, not the input field. Having convinced myself there was no hard rule, I documented the mechanism I could see — raw stays tree-first, only private-AX reads actions — and wrote up its consequence as a silent no-op. The reasoning was sound; it just described a path the request seam never lets you reach. A negative grep result was not evidence of absence, and I treated it as such.

Both pages now say the pair is rejected as INVALID_ARGS before any device work, on CLI, Node client, and MCP alike, and that users must choose one flag or the other. The underlying reason is kept, since it explains why the pair is refused rather than merged. The PR summary carried the same wrong claim and has been corrected too.

pnpm check:command-docs, pnpm --dir website build, and pnpm check:affected --run are green on the new head.


Generated by Claude Code

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Aug 10, 2026
@thymikee

thymikee commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

Exact-head re-review at aef59fdd8: clean / ready. The corrected guide, command reference, and PR body now match the shared production contract: --actions and --raw are mutually exclusive and rejected as INVALID_ARGS before device work. The remaining capture-plan and custom-action claims match ADR 0004 and live routing, the schema-derived usage regression is meaningful, and all substantive checks plus the docs preview are green. No ready label applied by this reviewer.

@thymikee
thymikee merged commit 4279d4c into main Aug 10, 2026
32 checks passed
@thymikee
thymikee deleted the claude/github-issue-1689-ozzobu branch August 10, 2026 14:45
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.

Correct snapshot backend and custom-action documentation

2 participants