Skip to content

test(switch): guard the on_update preview poke at the producer site - #3251

Merged
max-sixty merged 2 commits into
mainfrom
picker-preview-auto-refresh
Jun 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
picker-preview-auto-refresh

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

What

A fast, producer-site regression guard for the picker preview auto-refresh wiring that landed in #3247 — test-only, no production change.

Why

#3247 closed two preview auto-refresh loops with different protection:

  • Orchestrator cache fills route through one choke point — PreviewOrchestrator::fill — which calls notify_filled. A producer physically cannot fill the cache without notifying, so that path is self-guarding.
  • The live CI-status path (on_update mirrors a row's pr_status / local_content, then pokes notify_row_changed) wires the poke as a separate call at the tail of the mirror block, with no compile-time tie to the writes it surfaces. Only the slow end-to-end PTY test (test_switch_picker_pr_tab_auto_resolves_from_fetching) guarded it.

That asymmetry is exactly how the CI-status loop got left keystroke-driven in the first pass of #3247. This adds a fast guard at the producer site so a future edit that drops the poke turns red immediately rather than stranding the pr / comments tab on "Fetching PR status…".

Change

  • on_update_pokes_run_preview_for_the_selected_row asserts on_update injects Event::RunPreview for the selected row when its live CI status lands, and stays silent for a row the cursor isn't on (the no-thrash half). Verified to fail (the positive assertion panics) when the poke is removed.
  • make_handler now shares one render_tx between the orchestrator's notifier and the handler — matching handle_picker — so the test observes the poke on the same channel skim's loop uses. This also closes a test-fidelity gap where the harness diverged from production by building two separate senders.

🤖 Generated with Claude Code

max-sixty and others added 2 commits June 25, 2026 15:18
Add a fast unit test asserting `on_update` injects `Event::RunPreview` for the
selected row when its live CI status lands (and stays silent for a row the
cursor isn't on), so the `pr`/`comments` auto-refresh wiring can't be dropped
without a red test — verified to fail when the poke is removed. Also share one
`render_tx` between the orchestrator's notifier and the handler in
`make_handler`, matching `handle_picker`, so the test can observe the poke on
the same channel skim's loop uses.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
# Conflicts:
#	src/commands/picker/progressive_handler.rs
@max-sixty
max-sixty merged commit 2fee2d4 into main Jun 26, 2026
36 checks passed
@max-sixty
max-sixty deleted the picker-preview-auto-refresh branch June 26, 2026 00:05
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.

2 participants