You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A Gen.Const base holding a MockFileSystem is shared and mutable across counter-examples #46
A Gen.Const base that holds a MockFileSystem is shared and mutable. Counter-examples that add files to it race each other, and one that edits a file in place makes other checks fail now and then.
What happened
A race. A counter-example adds a symbolic link to the base value's MockFileSystem. Laws apply a counter-example to a base more than once, and the Invariant and Vacancy cases run at the same time in TUnit, so the second CreateSymbolicLink threw "The file 'path' already exists". It failed about one run in four.
Edits that persist. A counter-example that grows the base's own file (GetFile(...).Contents = ...) left the base invalid for the checks that ran after it. They failed intermittently, naming rules the counter-example was not about.
What would you like instead
Clone the base's file system per counter-example application, or document that a counter-example must not change the world it was given. The second is the cheap one; the first removes the trap.
Workaround
A helper that adds each file once, under a lock on the file system, and never edits an existing one.
Invariant and Vacancy running at once on a Gen.Const base failed with IOException: The file 'path' already exists. Two causes: FileWorld's name counter was a plain Value++ with unlocked file-system edits, so the library's own edge files could collide, and a counter-example given to AutoTest was applied once per axis to the same base.
The counter is now atomic, FileWorld draws lock the file system, and a given counter-example runs once per base under a lock, with later axes reusing the result. I did not clone the file system (the day-sized option): a counter-example that edits the base's own file still changes it, so the README says to add files instead. The regression test failed before the fix and passes after, on net10.0 and net11.0.
Activity
Mpdreamz commentedon Nov 19, 2026
Reproduced and fixed in #103.
Invariant and Vacancy running at once on a
Gen.Constbase failed withIOException: The file 'path' already exists. Two causes:FileWorld's name counter was a plainValue++with unlocked file-system edits, so the library's own edge files could collide, and a counter-example given toAutoTestwas applied once per axis to the same base.The counter is now atomic,
FileWorlddraws lock the file system, and a given counter-example runs once per base under a lock, with later axes reusing the result. I did not clone the file system (the day-sized option): a counter-example that edits the base's own file still changes it, so the README says to add files instead. The regression test failed before the fix and passes after, on net10.0 and net11.0.