Repository navigation
Conversation
Two follow-ups from #2554, surfaced as deferred items at merge time. ## Dynamic span names `Span::new` now accepts `impl Into<Cow<'static, str>>` instead of `&'static str`. Literals stay borrowed (allocation-free), and `format!(...)` produces an owned span — useful when the name carries dynamic context. Threading that through the alias/hook surface: - `try_alias` → `try_alias:{name}` - `run_alias` → `run_alias:{name}` - `prepare_steps` → `prepare_steps:{alias}` - `template_render` → `template_render:{cmd.label}`, with the concurrent-group span moved into the `.map()` closure so each per-command render gets its own span (the previous single span hid per-command attribution). This unblocks per-pipeline attribution in chrome traces — previously all aliases shared the same span names so timeline tools couldn't tell them apart. ## `Cmd::run` and `Cmd::pipe_into` share `WtTraceLog` `WtTraceLog` (introduced in #2554 for `Cmd::stream`) gains a `record_result(&Result<Output>)` helper that emits the trace record and surfaces captured stdout/stderr to the debug log. `Cmd::run` and `Cmd::pipe_into` now use it instead of computing `t0`/`ts`/`tid` manually and calling the standalone `log_command_result`. `pipe_into` emits each child's record inside the `thread::scope` right after that child reaps, dropping the explicit per-child `dur_us` capture and post-scope batching. End times in the trace are now slightly more accurate (recorded at reap, not after scope exit). Trace tools sort by `ts` so log line order doesn't matter. Net: the standalone `log_command_result` helper is gone; all three `Cmd` modes share one emission path. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 3, 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.
Two follow-ups from #2554.
Dynamic span names
Span::newnow acceptsimpl Into<Cow<'static, str>>. Literals stay borrowed,format!(...)produces an owned span — useful when the name carries dynamic context.Threaded through the alias/hook surface so chrome traces can finally attribute time per pipeline:
try_alias→try_alias:{name}run_alias→run_alias:{name}prepare_steps→prepare_steps:{alias}template_render→template_render:{cmd.label}, with the concurrent-group span moved into the.map()closure (per-command render now gets its own span; the previous single span covering the whole map hid per-command attribution).Cmd::run/Cmd::pipe_intoshareWtTraceLogWtTraceLog(introduced in #2554 forCmd::stream) gains arecord_result(&Result<Output>)helper that does trace +log_output.Cmd::runandCmd::pipe_intonow constructWtTraceLog::new(...)instead of computingt0/ts/tidmanually and calling the standalonelog_command_result.pipe_intoemits each child's record insidethread::scoperight after that child reaps — drops the explicit per-childdur_uscapture and the post-scope emission step. End times are now recorded at reap rather than scope-exit (slightly more accurate). Trace tools sort bytsso the change in log-line order is invisible to them.log_command_resultdeleted. All threeCmdmodes share one emission path.Net: -36 lines.