agents: document Windows extended path rules and test organization (#4092)
During Windows test and bootstrap development, long path resolution
and platform constraints can introduce subtle failures, such as Win32
APIs ignoring relative traversal on extended-length paths or MSVC
compiler limitations when source directories exceed standard limits.
To prevent these pitfalls in future agent-assisted workflows, this
change codifies guidelines for handling Windows extended-length paths
and establishes conventions for test suite organization and platform
constraints. Specifically, it documents strategies for keeping source
directories concise, normalizing paths prior to file access or
comparisons, organizing tests by feature domain, and applying
appropriate platform compatibility restrictions.
diff --git a/.agents/rules/testing.md b/.agents/rules/testing.md
index 05bc7cb..dceb91d 100644
--- a/.agents/rules/testing.md
+++ b/.agents/rules/testing.md
@@ -29,3 +29,11 @@
## Documentation Flake Handling
* When building `//docs:docs` fails with exit code 2, treat it as a known
Sphinx/Bazel flake and retry the build.
+
+## Test Organization
+* **Domain Placement**: Place tests by the feature tested (e.g.,
+ `tests/bootstrap_impls/`), not by the fixture helper used (e.g.,
+ `py_extension`).
+* **Platform Constraints**: Restrict OS-specific targets with
+ `target_compatible_with` (e.g., `["@platforms//os:windows"]`) to skip on
+ incompatible platforms.
diff --git a/.agents/rules/windows.md b/.agents/rules/windows.md
index 2eea9b2..5f3d912 100644
--- a/.agents/rules/windows.md
+++ b/.agents/rules/windows.md
@@ -30,3 +30,13 @@
`foo.cp311-win_amd64.pyd`).
* SOABI on Windows includes both the ABI prefix and platform tag (e.g.,
`cp311-win_amd64`).
+
+## Extended Paths (`\\?\`)
+* **Test Path Lengths**: Keep source directories short so MSVC `cl.exe` params
+ files stay under 260 chars (`MAX_PATH`, avoids `D8022`). Rely on runfiles
+ expansion (`.exe.runfiles/_main/...`) to exceed `MAX_PATH` at runtime.
+* **No `..` Segments**: Win32 ignores `..` on `\\?\` paths. Always call
+ `os.path.normpath(...)` before accessing files (e.g., wheel `RECORD` paths).
+* **Comparing Executables**: Subprocesses may drop `\\?\` or `\\?\UNC\`
+ prefixes. Strip prefixes and compare via
+ `os.path.normcase(os.path.normpath(...))`.