fix(output): correct user-output consistency defects#2867
Conversation
Audit of user-visible strings against the writing-user-outputs skill:
- error.rs: RefCreateConflict hint used "To switch to it:" — "it" is a
cross-message-referent pronoun and the colon form deviates from the
skill's "To X, run Y" command-hint pattern. Now self-contained:
"To switch to the existing branch, run wt switch pr:N".
- shell_integration.rs: "All shells already configured" used
success_message (✓); it acknowledges existing state without changing
anything, so it is an info message (○) — matches the skill's
Success-vs-Info table ("All commands already approved" → info).
- config/show.rs: the version check rendered "Up to date" with
success_message (✓) while its sibling arm "Update available" uses
info_message (○); both are state reports of one check. Now info.
- relocate.rs: show_summary keyed message type on whether any worktrees
were skipped, rendering the same outcome (worktrees relocated) two
ways. Now keys on whether anything was relocated — success when a
change happened, info when only skips.
- diagnostic.rs: "Diagnostic saved: <path>" used info_message although a
file was created (a state change → success), and ": " before the path
instead of the codebase's "@" path convention. Now
success_message("Diagnostic saved @ <path>").
- command_approval.rs: dropped the trailing period from the only
single-line message in the codebase that had one.
Snapshots updated for the affected switch, config_show, step_relocate,
approval_pty, and configure_shell tests.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
worktrunk-bot
left a comment
There was a problem hiding this comment.
codecov/patch is failing on src/commands/relocate.rs:714 — the bare return; line in show_summary's defensive early-return. The old form if relocated > 0 || skipped > 0 { … } collapsed the no-op into the implicit "fall off the end of the if" path; the new early-return is its own line and the existing tests never exercise show_summary(0, 0) (the sole caller at step/relocate.rs:153 runs after validated.is_empty() returned false, so at least one of relocated_count / skipped_count is always ≥ 1).
Simplest fix: restore the wrap form, keeping the new success-vs-info logic inside it:
pub fn show_summary(relocated: usize, skipped: usize) {
if relocated > 0 || skipped > 0 {
eprintln!();
let plural = |n: usize| if n == 1 { "worktree" } else { "worktrees" };
let msg = if skipped == 0 {
format!("Relocated {relocated} {}", plural(relocated))
} else {
format!(
"Relocated {relocated} {}, skipped {skipped} {}",
plural(relocated),
plural(skipped)
)
};
// Success when worktrees moved; info when only skips (no change made).
if relocated > 0 {
eprintln!("{}", success_message(msg));
} else {
eprintln!("{}", info_message(msg));
}
}
}Behavior is identical; the (0, 0) no-op falls out of the if instead of returning explicitly, so there's no isolated line to cover. Happy to push this if you want.
Dismissing my approval per the codecov/patch merge gate in CLAUDE.md.
codecov/patch failed — line 714 of relocate.rs uncovered
codecov/patch flagged the `return;` inside `if relocated == 0 && skipped == 0` as uncovered. The guard is dead: show_summary is only called at step/relocate.rs:153, reached only after the `validated.is_empty()` early-return — so at least one candidate exists, and every candidate either relocates or is skipped, giving `relocated + skipped >= 1`. Per the project's no-defensive-programming policy, delete the guard and document the invariant in a docstring contract rather than compensating for a state that cannot occur. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
show_all_skipped carried the same dead defensive guard removed from its sibling show_summary in the previous commit. It is called only inside the `validated.is_empty()` branch of step/relocate.rs, reached after the `candidates.is_empty()` early-return — so every candidate was skipped and `skipped >= 1` always. Remove the guard and document the invariant in a docstring contract, matching show_summary so the two sibling functions read consistently. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
codecov/patch flagged the "Up to date" arm of render_version_check (src/commands/config/show.rs) as uncovered. The arm is exercised by the config_show_full integration tests, but those measure coverage through a spawned wt subprocess, which the CI coverage upload picks up only intermittently — the same byte-identical line went fail/pass/fail across the three commits on this branch. Extract the version comparison and message rendering into a pure format_version_status(latest) helper and add an in-process unit test that hits both the update-available and up-to-date arms. In-process tests are measured deterministically, so the line is now reliably covered. render_version_check shrinks to a single render site, and the comparison logic is testable without injecting a version through the environment (which would mutate process-global state). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
An audit of `wt`'s user-visible strings against the repo's
`writing-user-outputs` skill. Six consistency corrections, each matching
a rule the skill states — and, in most cases, a sibling message that
already follows it:
- `RefCreateConflict` hint: dropped the cross-message pronoun ("it") and
switched to the skill's `"To X, run Y"` command-hint form.
- `"All shells already configured"` and the version-check `"Up to
date"`: `success ✓` → `info ○` — both acknowledge existing state without
changing anything.
- `relocate` summary: keyed the message type on whether anything was
*relocated*, not on whether anything was *skipped* (the same outcome was
rendered two ways).
- `"Diagnostic saved"`: → `success` (a file was created) and the
`@`-before-path convention.
- Removed a stray trailing period — the only single-line message in the
codebase that had one.
`--no-verify` is deliberately untouched (handled in the
`canonical-paths` PR). Snapshot tests updated.
> _This was written by Claude Code on behalf of Maximilian Roos_
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
An audit of
wt's user-visible strings against the repo'swriting-user-outputsskill. Six consistency corrections, each matching a rule the skill states — and, in most cases, a sibling message that already follows it:RefCreateConflicthint: dropped the cross-message pronoun ("it") and switched to the skill's"To X, run Y"command-hint form."All shells already configured"and the version-check"Up to date":success ✓→info ○— both acknowledge existing state without changing anything.relocatesummary: keyed the message type on whether anything was relocated, not on whether anything was skipped (the same outcome was rendered two ways)."Diagnostic saved": →success(a file was created) and the@-before-path convention.--no-verifyis deliberately untouched (handled in thecanonical-pathsPR). Snapshot tests updated.