Skip to content

fix: make metadata classes hashable by fixing __hash__ implementations - #3004

Closed
mmustafasenoglu wants to merge 1 commit into
theupdateframework:developfrom
mmustafasenoglu:fix/hash-unhashable-dicts
Closed

fix: make metadata classes hashable by fixing __hash__ implementations#3004
mmustafasenoglu wants to merge 1 commit into
theupdateframework:developfrom
mmustafasenoglu:fix/hash-unhashable-dicts

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Fixes TypeError: unhashable type: 'dict' for 8 metadata classes:

  • Signed, Root, MetaFile, Timestamp, Snapshot
  • Delegations, TargetFile, Targets, Metadata

Following the pattern from #2973 (Role/DelegatedRole):

  • Convert dicts to tuples of sorted items for hashability
  • Exclude unrecognized_fields (arbitrary nested JSON)
  • Preserve Python data model: equal objects produce equal hashes

All existing tests pass. Ready for review.

Fixes TypeError: unhashable type: 'dict' for 8 metadata classes:
- Signed, Root, MetaFile, Timestamp, Snapshot
- Delegations, TargetFile, Targets, Metadata

Following the pattern from #2973 (Role/DelegatedRole):
- Convert dicts to tuples of sorted items for hashability
- Exclude unrecognized_fields (arbitrary nested JSON)
- Preserve Python data model: equal objects produce equal hashes

Signed-off-by: Mustafa Senoglu <mmustafasenoglu0@gmail.com>
@mmustafasenoglu
mmustafasenoglu requested a review from a team as a code owner August 26, 2026 11:43
Copilot AI lite review requested due to automatic review settings August 26, 2026 11:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mmustafasenoglu mmustafasenoglu closed this by deleting the head repository Aug 26, 2026
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