Skip to content

fix: preserve scoped Android snapshot refs#456

Merged
thymikee merged 1 commit intomainfrom
fix/android-scoped-snapshot-refs
Apr 27, 2026
Merged

fix: preserve scoped Android snapshot refs#456
thymikee merged 1 commit intomainfrom
fix/android-scoped-snapshot-refs

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

@thymikee thymikee commented Apr 27, 2026

Summary

Fix Android scoped snapshots so snapshot -s @ref resolves against the prior ref source without double-filtering by the raw ref.
Render hidden-below list hints after visible descendants and keep scoped snapshot fallback state from leaking after unrelated snapshot refreshes.

Review and CI follow-up: centralized session snapshot replacement through setSessionSnapshot, cleared the scope source for replay-heal refreshes too, moved scoped-ref coverage into a focused test file to keep Fallow clean, and updated the stale find metadata expectation.

Touched files: 15. Scope stayed within snapshot/session formatting and session snapshot refresh paths.

Validation

  • pnpm exec vitest run src/daemon/handlers/__tests__/find.test.ts
  • pnpm exec vitest run src/daemon/handlers/__tests__/snapshot-scoped-refs.test.ts
  • pnpm exec vitest run src/daemon/handlers/__tests__/snapshot-handler.test.ts
  • pnpm format
  • pnpm check:quick
  • pnpm check:fallow
  • pnpm check:unit

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-456/

Built to branch gh-pages at 2026-04-27 18:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@thymikee thymikee force-pushed the fix/android-scoped-snapshot-refs branch from 91e6d43 to c649c61 Compare April 27, 2026 17:41
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91e6d432ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +365 to +368
const candidates = [
session.snapshot,
...(session.snapshotScopeSource ? [session.snapshotScopeSource] : []),
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Invalidate stale scope source before resolving @refs

resolveSnapshotScope now falls back to session.snapshotScopeSource, but that cache is not invalidated on every snapshot-refresh path (for example, replay healing rewrites session.snapshot in src/daemon/handlers/session-replay-heal.ts without clearing snapshotScopeSource). In flows like scoped snapshot -> replay heal (replay -u) -> snapshot -s @ref, ref lookup can resolve against stale pre-heal nodes and scope to the wrong label instead of the current tree, which makes subsequent snapshot results inconsistent with the live UI.

Useful? React with 👍 / 👎.

@thymikee thymikee force-pushed the fix/android-scoped-snapshot-refs branch 2 times, most recently from 6151848 to 0658e11 Compare April 27, 2026 18:16
@thymikee
Copy link
Copy Markdown
Contributor Author

Addressed this in the latest push. Replay heal now uses the centralized setSessionSnapshot helper, which clears snapshotScopeSource whenever it replaces session.snapshot. I also added a regression test in replay-heal.test.ts that seeds a stale scope source, runs heal snapshot refresh, and asserts the source is cleared.

@thymikee thymikee force-pushed the fix/android-scoped-snapshot-refs branch from 0658e11 to 46367f2 Compare April 27, 2026 18:28
@thymikee thymikee merged commit 83042cc into main Apr 27, 2026
16 checks passed
@thymikee thymikee deleted the fix/android-scoped-snapshot-refs branch April 27, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant