docs(shared-manager): note why the CAS mismatch raises EEXIST

The code is this file's marker for "a race was detected" - the same one
the reappeared-path and concurrent-replacement guards raise - not a
report that a no-replace link() or open('wx') hit an existing path. Say
so at the throw, so debugging by err.code does not send anyone looking
for a no-replace failure that never happened.

Built [OnSteroids](https://onsteroids.ai)
This commit is contained in:
Sergey Galuza committed 2026-08-23 08:33:06 +02:00
1 parent df52662a59
commit 4a17f034e2
1 file changed
+3
@@ -264,6 +264,9 @@ function publishCanonicalContent(
const currentStats = getLstatSync(writePath);
const current = currentStats?.isFile() ? canonicalIdentityOf(currentStats) : null;
if (!canonicalIdentityMatches(expected, current)) {
// EEXIST is this file's marker for "a race was detected", the same code
// the reappeared-path and concurrent-replacement guards raise. It does
// not mean a no-replace link() or open('wx') hit an existing path.
throw Object.assign(new TypeError(`Canonical file changed during adoption: ${writePath}`), {
code: 'EEXIST',
});