fix: make DistroBase hashable
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
Add a `__hash__` method to `DistroBase`, which was a frozen dataclass with a manually-overridden `__eq__` but no corresponding `__hash__`. Using it in a `set` or as a dict key would silently violate Python's hash/eq contract (or raise `TypeError: unhashable type` depending on dataclass version), since the auto-generated hash was based on all fields while `__eq__` allows a less-specific series to match a more-specific one (e.g. `DistroBase('ubuntu', '24') == DistroBase('ubuntu', '24.04')`).
The new `__hash__` only uses `self.distribution` and the first dot-separated component of `self.series` — the only parts guaranteed to be shared by any two `DistroBase` values that `__eq__` would consider equal. This keeps `hash(a) == hash(b)` whenever `a == b`, as required.
Fixes #231.
- [x] I've followed the [contribution guidelines](https://github.com/canonical/craft-platforms/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test-fast`.
- [ ] I've added or updated any relevant documentation.
- [ ] In documents I changed, I added a meta description if one was missing.
- [ ] I've updated the relevant release notes.
Evaluation history
No evaluation history available.
Update history
| Date | Change |
|---|---|
| created |
Related issues
No embedding available for this issue yet. Run scripts/run_llm.py evaluate to enable similarity search.