Re: more comments Wolfgang Corcoran-Mathe 18 May 2026 18:03 UTC

On 2026-05-18 07:20 -1000, Shiro Kawai wrote:
> Suppose I'm bisecting commits to find the cause of a particular test
> failure that uses a randomized sequence.  When should the test code save
> this persistent "seed"?

This is a tricky problem which we should try to solve, since it's an
important use case for seedable random ports.

At the moment I see two possibilities:

1. Prior to all of your test runs you create a dummy port, extract
its state, and write it to a file in a safe location.  Every random port
you create when testing reads its initial state from this file.  When
the test runs are finished, the file can be removed or saved for later
use (i.e. if that particular state revealed new bugs).  (This is John's
suggestion, if I've understood his response correctly.)

2. Initialize all of your random ports with an infinite binary port
that produces a constant sequence.  "All zeros" is of course bad, but
you could probably get away with "all fours".  This is a lot more
fragile than (1).

I'm not entirely happy with either of these options.

--
Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>