Round a Retry-After date up to the whole second

Merged
JE
2mo ago
+48-829

Rust Tests failed on #144 at d4a5b16 with

a_retry_after_date_is_waited_out_as_the_seconds_it_leaves ... FAILED
resent after only 91.241401ms, so the date was not read as a wait

The test (from #145) is on main and the failure is main's: it formats now+2s at whole-second precision, and retry_after_seconds truncated the remaining time with num_seconds(), so a run that starts in the last few milliseconds of a wall-clock second computes zero seconds left, falls through to the default backoff and resends at once. The window is a few milliseconds wide on an idle machine (0/120 in a plain loop here) and wider on a loaded runner. Pinning the start phase to .998 with a scratch copy of the test reproduces it on pristine main every time and passes with this change.

The truncation is also wrong on its own terms: the HTTP-date form of Retry-After names the moment the wait is over, so rounding down resends before it. This rounds up to the whole second instead, through a small pure helper with unit tests for the boundaries. A date already past still asks for no wait, as before. Go's parseRetryAfter truncates the same way (int(time.Until(t).Seconds())); its only Retry-After tests use the integer form, so nothing there flakes, but the same rounding belongs there too if we want the SDKs to agree to the second.

Second commit: conformance/runner/rust/Cargo.lock carried packages the runner no longer depends on (keyring, aes, ...), so every make conformance-rs rewrote it and left the tree dirty, and cargo --locked refused the runner outright. Pruned with cargo metadata --offline; no versions changed.

Gate: make rs-check rs-check-drift conformance-rs locally.


Summary by cubic

Fixes the flaky Retry-After date test and corrects premature resends by rounding the remaining wait time up to the whole second. Also prunes unused packages from the Rust conformance runner lockfile.

  • Rounds the remaining time up so a request doesn't resend before the advertised date passes; a date already past still returns no wait.
  • Removes packages the runner no longer depends on from conformance/runner/rust/Cargo.lock, so make conformance-rs no longer rewrites the tree and cargo --locked works.