8000 fix(picker): render a failed action's error once by dominikwozniak · Pull Request #119 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

fix(picker): render a failed action's error once - #119

Merged
dominikwozniak merged 1 commit into
mainfrom
fix/118-picker-double-error
Sep 20, 2026
Merged

dominikwozniak merged 1 commit into
mainfrom
fix/118-picker-double-error

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

An action picked in dw-mc says twice what went wrong with it. Two runs of the CLI stand between the action and the screen, and Command.runWith renders a UserError before it hands it on, so the run the picker dispatches through prints the sentence and the run standing outside prints it again. The dispatching run renders nothing instead, and the screen belongs to the outer run - the one a typed command reaches, which has always said it once.

What changes

  • src/cli/cli.ts — the run the picker dispatches through takes renderErrors: false, which is what Effect's own wizard sets when it re-runs a command inside another run.
  • src/adapters/picker.ts — recording collects what the CLI renders as a failure where a caller asks for it, instead of swallowing it.
  • src/cli/pick.test.ts — a picked action on a machine whose git refuses, counting what reached the screen.

Test plan

  • pnpm check — pass: 58 files, 817 tests, lint, format, typecheck and build
  • src/cli/pick.test.ts — 23/23, with "says once what went wrong with the action it dispatched" red at 2 renders before the fix
  • differential: the same failure typed out as dw-mc review dominikwozniak/dw-mc#1 renders once with and without the fix, so the picker is the only thing that doubled it

Risk

A failure the outer run does not render would now print nothing; Command.run delegates to the same runWith the test drives, so the outer render is the one under test.

Closes #118

🤖 Generated with Claude Code

Two runs of the CLI stand between a picked action and the screen, and both
rendered. `Command.runWith` prints a `UserError` through the formatter and
re-fails with it, so the run the picker dispatches through printed the
sentence, handed the same error on, and the run standing outside printed it
again. The same command typed out only ever crosses the outer run, which is
why it says it once.

The dispatching run is not the one that owns the screen, so it renders
nothing: `renderErrors` is what Effect's own wizard sets when it re-runs a
command inside another run.

Closes #118

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit 36a08e1 into main Sep 20, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the fix/118-picker-double-error branch September 20, 2026 08:01
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.

fix(picker): render a failed action's error once

1 participant

0