Follow-up to #26, which gave TaskInstance and Realization custom __hash__ methods (sorted item tuples over their dict fields).
Two gaps worth closing:
-
test_instances_and_realizations_are_hashable only hashes the same object reference and checks x in {x}, which passes even under identity hashing. The invariant the fix actually establishes, equal objects hash equal, is untested: construct two independent but ==-equal instances, assert hash(a) == hash(b) and {a: 'x'}[b] == 'x'. Without it, a future simplification back toward default hashing slips through green CI.
-
TaskInstance.static is typed dict[str, Any]. Every current spec stores only strings, but nothing stops a future spec from putting a list in there, which would make __hash__ raise TypeError again with no test to catch it. Either tighten the annotation to the hashable subset actually used, or document the invariant next to the field and add a spec-wide test that hash() succeeds for every entry in SPECS (the latter already half-exists and would catch it at test time).
Both are small and self-contained.
Follow-up to #26, which gave
TaskInstanceandRealizationcustom__hash__methods (sorted item tuples over their dict fields).Two gaps worth closing:
test_instances_and_realizations_are_hashableonly hashes the same object reference and checksx in {x}, which passes even under identity hashing. The invariant the fix actually establishes, equal objects hash equal, is untested: construct two independent but==-equal instances, asserthash(a) == hash(b)and{a: 'x'}[b] == 'x'. Without it, a future simplification back toward default hashing slips through green CI.TaskInstance.staticis typeddict[str, Any]. Every current spec stores only strings, but nothing stops a future spec from putting a list in there, which would make__hash__raiseTypeErroragain with no test to catch it. Either tighten the annotation to the hashable subset actually used, or document the invariant next to the field and add a spec-wide test thathash()succeeds for every entry inSPECS(the latter already half-exists and would catch it at test time).Both are small and self-contained.