Skip to content

Stamp each stderr line with the local time - #185

Merged
JacobStephens2 merged 4 commits into
mainfrom
issue-153
Sep 30, 2026
Merged

JacobStephens2 merged 4 commits into
mainfrom
issue-153

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

Every line thirdshift prints on stderr now starts with the local time, so a quiet terminal shows how long the Run has been on its last step:

thirdshift: 12:14:49 implement: $ cargo test 2>&1 | tail -40
thirdshift: 12:25:03 CI on 26c8b06: 2 of 5 checks still running
 progress::step(message)
-  writeln "thirdshift: {message}"
+  writeln "thirdshift: {HH:MM:SS now} {message}"

 spec_run::finish_ticket  (relays a Ticket's child stderr)
-  strip "thirdshift: ", then step("#N: {line}")
+  progress::relay("#N", line)
+    keep the child's stamp: "thirdshift: {child's time} #N: {message}"
+    (no stamp from the child → stamp it now)
+    return the message, without the stamp, for the Ticket's failure cause
  • branch.rs's one direct eprintln! goes through progress::step now, so it gets stamped as well.
  • In the tests, RunResult.stderr has the stamps removed by unstamped(), so the existing stderr assertions pass unchanged. The stamped text is kept as stamped_stderr.
  • The README explains the stamp and adds it to the Failed spec run example.

The Run notification, the Failed run comment, the PR body and session logs don't change: none of them read the stamped stderr.

Evidence

New tests, which fail on main and pass here:

progress_lines::every_line_starts_with_the_local_time_it_was_printed
  run an issue
  each stamped stderr line == "thirdshift: HH:MM:SS …", with a time between the clock readings taken before and after the Run

spec_run::each_relayed_ticket_line_has_exactly_one_time
  run a Spec
  each "#21: " line has one stamp before "#21: " and none after it

progress::tests::a_stamped_line_splits_into_its_time_and_message
progress::tests::a_line_without_a_stamp_does_not_split

cargo clippy --all-targets is clean. With cargo test, every test file passes except spec_run: in two full-suite runs, one timing-sensitive concurrency test failed each time, a different one each run. Both passed when run alone, and all 44 spec_run tests passed on a separate run:

  • the_parallel_flag_wins_over_spec_parallel: its sessions wait up to 10s for each other, and it failed under full-suite load.
  • without_a_limit_at_most_three_tickets_run_at_once: #23: git fetch origin issue-20 failed: fatal: bad object worktrees/widgets-issue-21/HEAD. This is a git race between parallel Tickets sharing the Launch directory, and this change doesn't touch it.

Merge Danger

Door: two-way

Blast Radius: cosmetic

The format of stderr lines changes. A script that matches lines starting with thirdshift: <message> now has to allow for the time. stdout, exit codes and everything posted to GitHub or sent by email stay the same.

Unaddressed findings

Standards

  • The HH:MM:SS check is written twice, in src/progress.rs and tests/support/mod.rs: thirdshift is a binary crate, so the integration tests can't call progress::split_stamp. The test copy now has the same name and shape, and its doc comment says which function it mirrors.
  • progress::relay both prints and returns the message: removing the prefix and stamp belongs in progress, next to the code that adds them. Splitting it would make spec_run handle the stamp format itself.

Spec

  • A message with a newline in it is stamped on its first line only: this already happens with the thirdshift: prefix. Stamping every line would mean changing how multi-line errors print, which the issue doesn't ask for.
  • Setup's questions (questions.rs) and the help text after an argument error are printed unstamped: these are interactive prompts and usage text, not progress lines during a Run.
  • claude's own stderr passes through unstamped: it is output from claude, not a line thirdshift prints.

Closes #153

🤖 Generated with Claude Code

JacobStephens2 and others added 4 commits September 30, 2026 12:51
A Spec run relays a Ticket's lines with the Ticket's own stamp rather
than adding a second one. Tests match stderr with the stamps removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 76ab73b into main Sep 30, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-153 branch September 30, 2026 13:37
@JacobStephens2 JacobStephens2 linked an issue Sep 30, 2026 that may be closed by this pull request
@JacobStephens2 JacobStephens2 mentioned this pull request Sep 30, 2026
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.

add timestamps to thirdshift stderr output to see if stalled

1 participant