Skip to content

Commit 185c746

Browse files
committed
docs(agents): Clarify macOS and Windows roots for hermetic test isolation.
os.UserConfigDir and os.UserCacheDir derive from HOME on macOS and AppData/LocalAppData on Windows rather than reading XDG variables. Refs #899
1 parent 7ac5038 commit 185c746

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎AGENTS.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,15 @@ These classes drive multi-round reviews. Fix them before requesting review:
132132
When a test targets a specific layer, call that layer directly rather than
133133
relying on a public entry point that may refuse earlier.
134134
- **Hermetic tests:** Tests must not read or write the developer's real config,
135-
cache, or state directories. Redirect every root the code under test resolves,
136-
not just config: on Unix that means the relevant `XDG_*` variable for each,
137-
and on Windows `%AppData%` and `%LocalAppData%`, since `os.UserConfigDir` and
138-
`os.UserCacheDir` ignore the XDG variables there. Apply it to every test that
139-
reaches the same storage, not only the one where it was first needed; a test
140-
that passes on a clean machine and pollutes a real one is a blocker.
135+
cache, or state directories. Redirect every root the code under test
136+
resolves, not just config. `os.UserConfigDir` and `os.UserCacheDir` read
137+
`XDG_CONFIG_HOME` and `XDG_CACHE_HOME` only on Linux and the BSDs. On macOS
138+
they derive from `HOME`, and on Windows from `%AppData%` and `%LocalAppData%`.
139+
Setting the XDG variables alone still leaves a macOS run writing to the real
140+
home, so set `HOME` as well, or take the directory as a parameter. Apply it to
141+
every test that reaches the same storage, not only the one where it was first
142+
needed; a test that passes on a clean machine and pollutes a real one is a
143+
blocker.
141144
- **Error codes vary by platform and by flag combination:** A check written
142145
against the code one target returns can be silently inert on another while
143146
still looking correct. `openat(O_DIRECTORY|O_NOFOLLOW)` on a symlink may

0 commit comments

Comments
 (0)