Repository navigation
fix: JSON output follow-ups from --format=json rollout - #2001
Merged
Merged
Conversation
- Add filename tiebreaker to partition_log_files_json sort (matches render_log_table's sort stability) - Make for-each `error` field always present on failure, not just SpawnFailed — ExitCode now includes "exit code N" or "killed by signal" - Add test for config show --format=json outside a git repo - Add test for multi-remove --format=json with current worktree Co-Authored-By: Claude <noreply@anthropic.com>
worktrunk-bot
approved these changes
Apr 8, 2026
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
codecov/patch is failing on line 112 of src/commands/for_each.rs — the format!("spawn failed: {e}") expression inside the SpawnFailed arm. This arm was already uncovered on main; the PR only changed the return value format (from Some(e.clone()) to format!("spawn failed: {e}")).
The SpawnFailed path requires the user's shell binary to be unspawnable (the command itself is wrapped by the shell, so a nonexistent command gives exit code 127 via ExitCode, not SpawnFailed). This makes it impractical to test without fragile environment manipulation.
This is a false positive — pre-existing uncovered code where only the format string changed.
Move error message formatting to Display impl and exit code extraction to exit_code() method on CommandError. Add unit test covering all three variants (SpawnFailed, ExitCode, signal-killed). Co-Authored-By: Claude <noreply@anthropic.com>
worktrunk-bot
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four targeted fixes identified as follow-ups from the
--format=jsonrollout (#1969, #1998):Sort stability in
partition_log_files_json— added filename tiebreaker to matchrender_log_table's sort. Without this, entries with identical timestamps could appear in non-deterministic order in JSON output.for-each
errorfield always present on failure — previously, the"error"field only appeared forSpawnFailederrors, notExitCode. Consumers parsing the JSON had to handle two shapes. Now both variants include"error":"exit code N"for ExitCode,"spawn failed: ..."for SpawnFailed,"killed by signal"for signal termination. Error formatting lives inCommandError::Displayimpl with a unit test covering all three variants.Test:
config show --format=jsonoutside a git repo — verifies that project path/config arenullwhen not in a git repository.Test: multi-remove
--format=jsonwith current worktree — covers theplans.currentcode path where the current worktree appears in the multi-remove target list (deferred to last in output).