Skip to content

Fix raw debug output for negative estimated end durations - #848

Draft
rootkiller6788 wants to merge 1 commit into
rust-lang:masterfrom
rootkiller6788:fix-estimated-end-debug-output
Draft

Fix raw debug output for negative estimated end durations#848
rootkiller6788 wants to merge 1 commit into
rust-lang:masterfrom
rootkiller6788:fix-estimated-end-debug-output

Conversation

@rootkiller6788

Copy link
Copy Markdown

Fixes #761.

Problem

On the experiment page, the Estimated end field sometimes showed the raw debug representation of a chrono::Duration, e.g.:

Estimated end:  TimeDelta { secs: -1, nanos: 884994194 }

Root cause

In src/server/routes/ui/experiments.rs, endpoint_experiment computes the estimated remaining time as:

job_duration * (total_jobs as i32 - completed_jobs as i32)

total_jobs is crates_len * 2 while completed_jobs is the count of rows in the results table. Retried or extra result rows can make completed_jobs exceed total_jobs, producing a negative duration. chrono::Duration::to_std() rejects negative values, so humanize() fell through to format!("{duration:?}"), leaking the internal TimeDelta representation into the UI.

Fix

humanize() now reports a negative (unrepresentable) duration as 0 seconds instead of the raw debug output.

Verification

  • Confirmed raw_progress returns (results_len, crates_len * 2), so completed_jobs > total_jobs is reachable when extra result rows exist (e.g. retried jobs).
  • Confirmed chrono 0.4.45 Duration (a TimeDelta alias) debug-prints as TimeDelta { secs: ..., nanos: ... }, matching the screenshot in the issue.

When an experiment's completed job count exceeds its expected total
(e.g. after jobs are retried), the "estimated end" duration computed in
endpoint_experiment becomes negative. chrono::Duration::to_std() rejects
negative durations, so humanize() fell back to the raw Debug formatting,
producing output like `TimeDelta { secs: -1, nanos: 884994194 }` on the
experiment page.

Report such durations as "0 seconds" instead of leaking the internal
TimeDelta representation.
@oli-obk

oli-obk commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The account has been banned for spamming and will not be responding further to this PR

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.

Estimated end sometimes has strange Debug ouput in it

2 participants