Session start reads the store's old rules before the project file
ci / test (push) Canceled after 0s

_move and _apply write the project file first and remove or commit the
store copy second, so a reader that never waits must read the store copy
first: it then either sees the lines there or the project file is already
complete. Reading the project file first could miss both (fault 6).
Adds a deterministic test that runs a whole move between the two reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-12-02 13:07:18 -07:00
1 parent cb442e7d6f
commit f7f37dffe3
2 files changed
+24 -1

No files matched your search

+4 -1
View File
@@ -210,8 +210,11 @@ def scope_lines(scope, cwd=None, migrate=True):
if migrate:
return _migrate(cwd)[0]
dest, old = path(PROJECT, cwd), _legacy(cwd)
# The store copy first, the project file second: `_move` writes the project file before it removes the store
# copy, so a no-lock reader either reads the copy before it goes or knows the project file is already complete.
ls = lines(old)
raw = store.regular(dest, True)[1] if dest and not os.path.islink(os.path.dirname(dest)) else None
return list(dict.fromkeys((_parse(raw.decode("utf-8", "replace")) if raw is not None else []) + lines(old)))
return list(dict.fromkeys(ls + ((_parse(raw.decode("utf-8", "replace"))) if raw is not None else [])))
_in_store = lambda p: p.startswith(os.path.join(store.DATA, ""))