Skip to content

Backport PR #57 on branch versions/v0.4.x (🐛 fix: stop members with equal values collapsing into aliases) - #59

Merged
nstarman merged 1 commit into
GalacticDynamics:versions/v0.4.xfrom
nstarman:auto-backport-of-pr-57-on-versions/v0.4.x
Aug 7, 2026
Merged

Backport PR #57 on branch versions/v0.4.x (🐛 fix: stop members with equal values collapsing into aliases)#59
nstarman merged 1 commit into
GalacticDynamics:versions/v0.4.xfrom
nstarman:auto-backport-of-pr-57-on-versions/v0.4.x

Conversation

@nstarman

@nstarman nstarman commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Manual backport of #57 to versions/v0.4.x, per the MrMeeseeks instructions on that PR (the automated cherry-pick conflicted).

Fixes enum.Enum folding members with equal values into aliases. Two collision modes, both silent: any two uninstalled dependencies share the NOT_INSTALLED sentinel, and distributions released together share a version number. The surviving member then answers .installed/.version for the wrong package.

Differences from main

_MemberKey is written out rather than a dataclass. main uses @dataclass(frozen=True, slots=True, eq=False, repr=False), but this branch supports Python 3.9, where dataclass has no slots parameter. This is the same class one revision earlier on main, not new code — main only moved to the dataclass form after the original review. Little is lost: the generated __eq__ had to be disabled there anyway, since comparing by field is exactly the aliasing this class exists to prevent.

Import line. This branch takes Callable from typing rather than collections.abc; kept as-is, with the new names added alongside. That was the cherry-pick conflict.

Two follow-on tidies. Ruff dropped the quotes from _missing_'s return annotation (redundant under this branch's from __future__ import annotations), and two comments naming 3.10 as the version floor now say 3.9.

Everything else applied unchanged.

Verification

Python 3.9, 3.13 (this branch's CI matrix) 51 passed
Python 3.10, 3.11, 3.12 51 passed
Coverage 100%, 0 missed
nox -s lint (pre-commit, pylint, mypy) clean

3.9's enum honours a _value_ set in __new__ before the duplicate scan, same as later versions — which is what makes the fix portable this far back.

Milestone v0.4.x set. The Still Needs Manual Backport label on #57 should come off once this merges.

🤖 Generated with Claude Code

…s collapsing into aliases

(cherry picked from commit 378e466)

Two adjustments were needed; the rest applied unchanged.

`_MemberKey` is written out here instead of the `@dataclass(frozen=True,
slots=True, eq=False, repr=False)` used on `main`: this branch supports Python
3.9, where `dataclass` has no `slots` parameter. `main` only recently moved to
the dataclass form, so this is that same class one revision back, not new code.
The generated `__eq__` had to be disabled on `main` regardless -- comparing by
field is precisely the aliasing the class prevents -- so little is lost.

The import line conflicted: this branch takes `Callable` from `typing` rather
than `collections.abc`, kept as-is with the new names added alongside. Ruff
dropped the quotes from `_missing_`'s return annotation, which are redundant
under this branch's `from __future__ import annotations`, and two comments
naming 3.10 as the floor now say 3.9.

Verified on 3.9 and 3.13 (this branch's CI matrix) plus 3.10-3.12: 51 passed,
100% coverage, `nox -s lint` clean. 3.9's `enum` honours a `_value_` set in
`__new__` before the duplicate scan, same as later versions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nstarman nstarman added this to the v0.4.x milestone Aug 7, 2026
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (versions/v0.4.x@7784f13). Learn more about missing BASE report.

Additional details and impacted files
@@                 Coverage Diff                 @@
##             versions/v0.4.x       #59   +/-   ##
===================================================
  Coverage                   ?   100.00%           
===================================================
  Files                      ?         3           
  Lines                      ?       100           
  Branches                   ?         0           
===================================================
  Hits                       ?       100           
  Misses                     ?         0           
  Partials                   ?         0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nstarman
nstarman merged commit d67dfef into GalacticDynamics:versions/v0.4.x Aug 7, 2026
15 checks passed
@nstarman
nstarman deleted the auto-backport-of-pr-57-on-versions/v0.4.x branch August 7, 2026 00:29
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.

1 participant