Full-main CI run 29460517377 exposed four TSan job failures that all reduce to the same ObjectColdState.rare publication race:
tsan-nogil-corpus (shard 1/4):setDateMsraced a genericboxedPrimitiveunion probe incve/mc-tear-date-cache.js.tsan-threadfuzz:proxyHandlerraced one-time rare-state initialization.tsan-unit (shard 1/4)andtsan-parallel-js: the mapped-arguments no-GIL test readproxyHandlerwhile a peer initializedsparse_array.
ensureRare serialized the tagged-union none -> kind transition with backing_lock, but hot generic probes read the union tag/payload without that lock. A probe for the wrong exotic kind can therefore race the one-time initialization, and switching over the tagged union may copy an unrelated active payload (for example the atomic Date milliseconds word).
The general fix is a separate atomic rare tag: initialize the union under backing_lock, release-publish the tag, and require every unlocked rare-state probe to acquire/check it before touching the now-stable union payload. This avoids adding a backing lock to every property lookup.
Acceptance
- Publish every
none -> rare kindtransition with release/acquire ordering. - Convert all unlocked rare-state probes and clear paths to check the atomic tag before union access.
- Preserve the per-kind synchronization for mutable payload fields such as Date milliseconds.
- Pass normal and TSan mapped-arguments reproducers with zero leaks/races.
- Pass the Date CVE corpus case and a fresh full-main TSan run.