Skip to content

test(picker): quiesce background fills before arming the awaited preview key - #3726

Merged
max-sixty merged 2 commits into
mainfrom
fix/issue-3725
Aug 3, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/issue-3725

Conversation

@worktrunk-bot

@worktrunk-bot worktrunk-bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

on_update_pokes_run_preview_only_when_the_visible_pane_changes failed once under code-coverage and passed on rerun of the same commit (#3725), counting an extra RunPreview at its final step.

The oracle counts pokes by draining skim's event channel between steps, but that channel has two producers. on_update's notify_pr_status_changed is the one under test; the other is PreviewOrchestrator::fill → notify_filled, driven here by the LOCAL_GIT_MODES precompute on_skeleton spawns for the row. (The comments fetch is the other notify_filled producer in production, but not in this test: make_handler's TestRepo has no remote, so ci_platform(None) resolves to None and spawn_worktree_comments_fetch takes the synchronous fill_external branch — nothing is spawned, nothing is left pending. It's also the second on_update that reaches that path at all, since maybe_spawn_comments returns early on the first step's is_priming row.)

That leaves exactly one overlap between the precompute's keys (WorkingTree, Log, BranchDiff, UpstreamDiff) and the keys the steps await (Pr, Comments, WorkingTree): ("feature", WorkingTree). Such a fill pokes legitimately (that is notify_filled's contract), but if it lands after its step's drain it is charged to the next step. Hence the polarity: an extra poke, misattributed one step later.

Solution

Wait for orchestrator idle before each note_awaiting, so every background fill lands while the awaited key is one none of them match (None before the first step, then a key of a different mode). The events carry no payload — Event::RunPreview is a unit variant — so asserting on poke identity isn't available; removing the second producer from each window is the structural equivalent.

Also adds the flake class to the No Retries taxonomy in tests/CLAUDE.md, alongside the existing timing / resource-pressure / shared-namespace entries.

Testing

The failure is deterministically reproducible by forcing the in-flight fill to land inside the test's own step boundaries, which is the only thing CI's slower llvm-cov run did by chance. Inserting handler.orchestrator.wait_for_idle() after the WorkingTree step's drain (before the fix) reproduces the exact CI panic — same assertion, same message, same polarity:

assertion `left == right` failed: an update to a row the cursor isn't on doesn't re-run the visible preview
  left: 1
 right: 0

Moving that same probe one line earlier — between the WorkingTree step's await_tab and its on_update — fails the WorkingTree step instead with left: 1, right: 0, confirming the producer is the precompute fill for ("feature", WorkingTree) rather than anything on_update does.

With the fix, both probe placements pass (nothing is left in flight at either point), as does the unmodified test: 300 solo iterations and 150 under a concurrent loop of the full commands::picker:: set, all green.


Closes #3725

…iew key

The RunPreview oracle in on_update_pokes_run_preview_only_when_the_visible_pane_changes
counts pokes by draining skim's event channel between steps, but two producers
feed that channel: on_update's notify_pr_status_changed (the behavior under
test) and PreviewOrchestrator::fill -> notify_filled, driven by the
LOCAL_GIT_MODES precompute on_skeleton spawns and the comments fetch on_update
spawns. A background fill for a key a later step awaits pokes legitimately, but
lands after that step's drain and is charged to the next step.

Wait for orchestrator idle before each note_awaiting, so those fills land while
no awaited key matches them.

Closes #3725

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The wait_for_idle() placement is right — the skeleton LOCAL_GIT_MODES precompute is the producer that can strand a ("feature", WorkingTree) fill past a step's drain, and arming after quiescing removes it from every counted window. Two accuracy fixes on the explanations, since a future reader debugging a recurrence will start from them: in this test the comments fetch is not a second in-flight producer. make_handler's TestRepo has no remote, so spawn_worktree_comments_fetch resolves ci_platform(None) to None and takes the synchronous fill_external branch — nothing is spawned, nothing is pending. (Verified with temporary probes in the test: right after the second on_update, ("feature", Comments) is already in the cache and the orchestrator's pending count is 0, and ci_platform(None).is_none() holds.) It's also the second on_update, not the first, that reaches the comments path at all — maybe_spawn_comments returns early on is_priming, which the first step's row sets.

That leaves exactly one overlap between the precompute's keys (WorkingTree, Log, BranchDiff, UpstreamDiff) and the keys the steps await (Pr, Comments, WorkingTree) — which matches the reproduction in the PR body, where the probe pinned the producer to the WorkingTree precompute.

Comment thread tests/CLAUDE.md Resolved
@max-sixty
max-sixty merged commit e898a10 into main Aug 3, 2026
42 checks passed
@max-sixty
max-sixty deleted the fix/issue-3725 branch August 3, 2026 15:27
max-sixty pushed a commit that referenced this pull request Aug 5, 2026
…innable (#3736)

Daily `review-runs` sweep of the 2026-08-03/04 window. One maintainer
correction in the window is generalizable repo knowledge, so it gets
codified here.

## What happened

Triaging [#3696](#3696)
("Allow selecting the `wt list` JSON schema on the command line"), the
bot read
[`resolve_json_schema`](https://github.com/max-sixty/worktrunk/blob/286004f1ebe5f6563c772be24987394144a29215/src/commands/list/mod.rs#L220),
saw it reads `repo.config().list.json_schema`, and
[posted](#3696 (comment))
that "there's no way to pin it per-invocation independent of that
config" — then went further and said the usual alias deflection "can't
substitute, since there's no composable way to select the schema without
this flag existing first".

max-sixty [corrected
it](#3696 (comment)):
"the need is real, but it's already met, so I'm not going to add the
flag" — `wt --config-set 'list.json-schema = 2' list --format=json` pins
it per invocation, and `WORKTRUNK_LIST__JSON_SCHEMA` does the same a
layer down. The proposed `--schema` flag was declined as "a third
spelling of the same thing on a surface I deliberately keep small". The
issue was closed on that basis.

`--config-set` has been documented since
[#3138](#3138) (2026-06-19),
in `after_long_help` in
[`src/cli/mod.rs`](https://github.com/max-sixty/worktrunk/blob/286004f1ebe5f6563c772be24987394144a29215/src/cli/mod.rs#L2558)
and its rendered mirror. It was available to read; the triage just never
looked above the resolver.

## Why codify it rather than log it

The specific miss is what the gates would call a single occurrence, but
the shape isn't a behavioural nudge that risks noise elsewhere — it's a
factual property of worktrunk's config layering, and the failure mode it
prevents is a **publicly posted false capability claim**, which is the
class `running-in-ci` treats as the most corrosive output failure. It's
also invisible: nothing fails, the reply just reads as authoritative and
wrong until a maintainer happens to catch it.

It sits directly above **Suggesting Aliases for Niche Feature Requests**
because it serves the same flag-growth limit that section already
encodes, and is the cheaper answer when the ask is "select an existing
config value per invocation" — the alias deflection is the fallback when
it isn't.

<details><summary>Window summary</summary>

46 token-bearing runs, **0 failed**, 0 near-timeout (longest job 68 min
against the 360-min cap). 3 bot PRs opened
([#3731](#3731),
[#3732](#3732),
[#3734](#3734)), 2 merged
([#3722](#3722),
[#3726](#3726)), 0 closed
without merge. [#3721](#3721)
— the PR stranded by the 08-03 outage — was reviewed and approved,
confirming yesterday's recovery worked. Full evidence in the tracking
issue [#3691](#3691).

</details>

---------

Co-authored-by: worktrunk-bot <[email protected]>

This branch was previously deployed

1 inactive deployment
tend — 847dc1ce Deployed Aug 3, 2026 by worktrunk-bot via review #3691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flaky: on_update_pokes_run_preview_only_when_the_visible_pane_changes counts an extra RunPreview under coverage

2 participants