fix(tests): restore Windows cache recency CI coverage - #2869
Conversation
Select all real-Git recency contracts in the Windows PR gate and retain captured stderr from isolated local Git fixture failures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Docs sync advisoryVerdict: no_change * Pages affected: 0 * LLM calls: 1/15 * Took: 30s L0 high-confidence path gate: this PR and its bounded follow-up fixes only touch The classifier subagent had no repository tools; the orchestrator completed the deterministic path gate and schema validation directly. |
The unsharded Windows PR gate passes sparse fixtures that fail under main's extra xdist worker directory. Reproduce the same path depth to expose captured Git stderr before selecting a fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Windows worker-depth reproduction confirmed Git cannot access .git/config.worktree beyond MAX_PATH. Use short unique pytest roots while retaining simulated worker depth in the PR gate. Define guarded sendmsg only where natively supported; test real and simulated Windows imports and network denial. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes are test-only, internally consistent across unit/integration contracts, and directly address the documented Windows CI failures without altering production behavior.
Review tier: Lite
Findings: None
What changed in this PR
Restores Windows CI coverage for the Git cache recency regressions by fixing two test-harness behaviors (path depth for sparse Git fixtures and sendmsg capability guarding) and adding marker-selected regression tests to exercise the prior failure modes on Windows.
Changes:
- Shorten/normalize test fixture roots (while preserving worker-depth) to avoid Windows path-length failures in sparse Git setups.
- Update the isolated network guard to only define
sendmsgwhen the native raw socket supports it. - Add/adjust tests to validate native capability parity, prevent
asyncio/unittest.mockimport regressions, and assert correct behavior whensendmsgis unsupported.
| File | Description |
|---|---|
| tests/utils/isolated_apm_environment.py | Adjusts generated sitecustomize network guard to conditionally define sendmsg only when supported natively. |
| tests/unit/test_isolated_network_guard.py | Adds Windows-gated component tests that validate capability parity and network-denial behavior across socket modules and import paths. |
| tests/unit/cache/test_git_cache_recency.py | Introduces a shorter, worker-depth-preserving fixture root and expands Windows gate selection for recency regression coverage. |
| tests/integration/test_isolated_apm_environment_contract.py | Updates integration assertions to accept native AttributeError when sendmsg is unsupported, while still enforcing denial when supported. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Preserve the worker-depth fixture and broader socket contracts from #2869, which supersede the overlapping local fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
fix(tests): restore Windows cache recency CI coverage
TL;DR
Fix both test-harness defects behind the nine Windows main failures from #2861: overly long sparse-Git fixture paths and a socket guard that invented an unsupported Windows capability. Keep real-Git recency assertions and the no-network boundary intact, and select the regressions in the Windows PR gate.
Note
Test-only: no production cache, authentication, release, dependency, or publishing changes. Release PR #2868 is untouched.
Problem (WHY)
fatal: unable to access '.git/config.worktree': Filename too long. Git's sparse config probe fails despitecore.longpaths=true.unittest.mockthroughasyncio, which saw a guard-providedsendmsgand called Windows' nonexistentos.sysconf.This fix follows observed execution rather than a guessed path diagnosis: "Run the skill against real tasks, then feed the results — all of them, not just failures — back into the creation process."
Approach (WHAT)
sendmsgonly if the native raw socket supports it.Implementation (HOW)
tests/unit/cache/test_git_cache_recency.py/popen-gw0depth; real recency cases gain Windows selection; chained local Git failures surface captured stderr.tests/utils/isolated_apm_environment.pysendmsgdefinition by the native capability; supported operations still deny IP traffic.tests/unit/test_isolated_network_guard.pytests/integration/test_isolated_apm_environment_contract.pyAttributeErrorfor unsupportedsendmsg; supported operations still require the guard's denial.Diagrams
Dashed nodes highlight the fixture-path correction, capability-preserving guard, and expanded Windows gate coverage.
flowchart LR subgraph Fixtures A["Short unique pytest root plus worker depth"] --> B["Real sparse and full Git checkouts"] B --> C["Pruning and warning assertions"] end subgraph Guard D["Native socket capability"] --> E["Define sendmsg only when supported"] E --> F["Real asyncio imports and IP denial"] end C --> G["Windows compatibility gate"] F --> G classDef new stroke-dasharray: 5 5; class A,E,G new;Trade-offs
Benefits
Validation
Final Windows Compatibility Gate at
04aebbfa0548815efc14e931187518b2392bed33:The log explicitly passes all nine original failures at retained worker depth and all twenty new socket cases. All current PR checks pass (CodeQL summary is neutral; both analysis jobs succeeded). The full post-merge Windows build and 21k-test suite were not rerun; this is actual focused Windows evidence.
uv run --frozen --extra dev pytest -q -n 2 tests/unit/cache/test_git_cache_recency.py tests/unit/test_isolated_network_guard.py tests/integration/test_isolated_apm_environment_contract.py -p no:cacheprovider:uv run --frozen --extra dev pytest -q tests/quality -p no:cacheprovider:Regression proof and additional evidence
Before correction, the worker-depth Windows diagnostic revision reproduced all nine original failures:
The new simulated-Windows socket regression failed against the original guard with the same missing
os.sysconftraceback: 1 failed, 19 passed.Neighboring cache and hermetic/lifecycle tests:
279 passed, 2 skipped in 27.08s.After merging current main, the canonical lint chain passed: Ruff check and format including architecture scripts, pylint R0801, YAML I/O, file length, portable paths, auth signals, and architecture boundaries. Assertion/duplicate ratchets and the Mermaid renderer also passed.
The pytest processes emitted cleanup warnings for pre-existing temporary directories outside this worktree, unrelated to the passing cases. Dependency bootstrap used exact frozen exported versions through the configured index after direct files.pythonhosted.org downloads failed.
uv.lockis unchanged.Docs-sync: schema-validated L0
no_change, high confidence; all four changed files match the corpus index's test-only no-impact rule. Two bounded reviews found no meaningful correctness or coverage issues.Scenario Evidence
tests/unit/cache/test_git_cache_recency.py::test_successful_checkout_reuse_survives_prunetests/unit/cache/test_git_cache_recency.py::test_checkout_recency_error_contracttests/unit/cache/test_git_cache_recency.py::test_recency_permission_warning_reaches_default_cli_stderr(regression trap)tests/unit/test_isolated_network_guard.py, includingtest_guard_without_native_sendmsg_or_sysconf(regression trap), andtests/integration/test_isolated_apm_environment_contract.py::test_python_child_network_is_deniedHow to test
uv sync --frozen --extra dev.uv run --frozen --extra dev pytest -m windows_compat -q tests/unit/cache/test_git_cache_recency.py tests/unit/test_isolated_network_guard.py; all 37 selected cases should pass.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com