fix: remove duplicate W24PropertyHardnessRockwellScale definition#537
Merged
Conversation
The enum was defined twice in hardness.py; the pydantic field bound to the
first class object while the module exported the second, so constructed
W24PropertyHardnessRockwell instances failed to pickle ("not the same object
as ...W24PropertyHardnessRockwellScale"). Collapse to a single definition
above W24PropertyHardnessRockwell. Behavior-preserving — members are identical.
https://claude.ai/code/session_01McoehiPCbG2oVA4WukFo3Z
Release the duplicate W24PropertyHardnessRockwellScale pickling fix. https://claude.ai/code/session_01McoehiPCbG2oVA4WukFo3Z
jmtts
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
W24PropertyHardnessRockwellScalewas defined twice inwerk24/models/v1/property/hardness.py— once beforeW24PropertyHardnessRockwelland again after it, with byte-for-byte identical members.Because of this:
W24PropertyHardnessRockwell.hardness_scalebound to the first class object (evaluated while the class body ran).werk24.models.v1.property.hardness.W24PropertyHardnessRockwellScale— whatpickleresolves by qualified name — pointed at the second.So a parsed/constructed
W24PropertyHardnessRockwellheld an enum member whose class could not be found under its own name, and pickling it (e.g. across aProcessPoolExecutor, cache, or Celery boundary) raised:This surfaced as a production error in the
core-readerservice (SentryCORE-READER-13Z) when grammar parses run in worker processes return Rockwell hardness results.Fix
Collapse the two definitions into a single one placed above
W24PropertyHardnessRockwell(keeping the version with the"""List of available Rockwell hardness scales."""docstring) and delete the second block. Members are byte-for-byte identical, so this is behavior-preserving — it only removes the shadowing redefinition.I also grepped the whole
werk24package for any other accidental same-file class/enum redefinitions; this was the only one. (W24PropertyGlasHomogeneityvsW24PropertyGlassHomogeneityinglass_homogeneity.pydiffer by spelling and are distinct classes.)Verification
python -m py_compile werk24/models/v1/property/hardness.py✅W24PropertyHardnessRockwell.model_fields["hardness_scale"].annotation is W24PropertyHardnessRockwellScale→ nowTrue(wasFalse) ✅W24PropertyHardnessRockwellsucceeds (previously raisedPicklingError) ✅InvalidLicenseExceptionintegration tests that require a live API license/token (unrelated to this change). ✅Once this ships and core-reader bumps the dependency, the temporary shim there becomes a no-op.
https://claude.ai/code/session_01McoehiPCbG2oVA4WukFo3Z
Generated by Claude Code