Skip to content

fix(tests): compare exact spellings in the case-sensitive fake reader - #3787

Merged
Daniel Meppiel (danielmeppiel) merged 1 commit into
mainfrom
danielmeppiel-fix-casesensitive-fake-reader-windows
Nov 17, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 1 commit into
mainfrom
danielmeppiel-fix-casesensitive-fake-reader-windows

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Push run 44116362481 on 74e5d220 (#3766), Windows x86_64 Build & Test: 26647 passed, 1 failed:

tests/unit/models/test_dependency_materialization.py::test_case_variant_owner_holding_another_package_is_not_a_collision[test/c-relocations1]
AssertionError: assert [('Test', 'apm_modules/test'), ('C', 'test/c')] == [('C', 'test/c')]

The bug is in the test fake, not the product. tests/helpers/prune_casing.py::CaseSensitiveMaterializationReader simulates a case-sensitive file system, but its samefile compared Path objects. On Windows, WindowsPath equality ignores case (PureWindowsPath('a/Test') == PureWindowsPath('a/test') is True, while their .parts differ). The fake therefore reported the distinct directories Test and test as the same directory. The relocation logic then took the case-only rename branch for the owner, which added the extra ('Test', 'apm_modules/test') move.

The product reader uses os.path.samefile, which correctly reports the real file system's answer, so production behavior is unchanged. (On a case-insensitive file system, Test/ and test/ cannot exist as separate directories.)

Changes:

  • samefile in the fake compares .parts, which is case-sensitive on every platform, as the case-sensitive file system it models requires.
  • The test is marked windows_compat, so the PR-time Windows Compatibility Gate runs it. That gate would have caught this failure before fix(tests): restore arm64 integration lanes for 0.36.0 #3766 merged.

No CHANGELOG entry: this is a test-only fix for an unreleased-cycle regression.

Issue and approved scope

Issue: Refs #3698

Human scope-approval comment: freeze-exempt release fix requested by the 0.36.0 release captain. It is a test-only follow-up to #3766, inside that PR's approved scope (Refs #3649).

This PR completes the fix for the Windows failure. After merge, the release captain will rerun the release gate.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • .venv/bin/python -m pytest -p no:xdist -q tests/unit/models/test_dependency_materialization.py tests/unit/test_prune_casing.py (every user of the fake): 47 passed.

  • -m windows_compat tests/unit/models/test_dependency_materialization.py: 3 passed, so the test is now selected by the Windows gate.

  • PureWindowsPath check: path equality is True and .parts equality is False for Test vs test, which reproduces the Windows-only failure mode.

  • ruff check and format --check (0.15.12) pass.

  • Not run locally: real Windows. This PR's Windows Compatibility Gate runs the test.

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

CaseSensitiveMaterializationReader.samefile compared Path objects. On
Windows, WindowsPath equality is case-insensitive, so the fake reported
apm_modules/Test and apm_modules/test as the same directory and the
#3766 regression test recorded an extra owner rename (push run
44116362481, Windows x86_64). Compare .parts, which is case-sensitive on
every platform, matching the case-sensitive file system the fake models.
The product reader uses os.path.samefile and is unaffected.

Mark the test windows_compat so the PR-time Windows gate runs it.

Refs #3698

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for this test-only Windows compatibility fix.

No open issues 🎉

What changed in this PR

This test-only follow-up to #3766 fixes a Windows failure in the fake case-sensitive filesystem reader. Production behavior is unchanged.

Changes:

  • Compare absolute path components rather than Path objects so distinct case spellings remain distinct on Windows.
  • Mark the affected regression test windows_compat so it runs in the PR-time Windows Compatibility Gate.
File Description
tests/​unit/​models/​test_dependency_materialization.py Adds Windows gate coverage for the case-variant owner regression test.
tests/​helpers/​prune_casing.py Makes the fake reader’s samefile comparison case-sensitive on every platform.

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 1759e1e into main Nov 17, 2026
24 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-casesensitive-fake-reader-windows branch November 17, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants