Skip to content

Add tests exposing 4 critical bugs#169

Open
cergfix wants to merge 1 commit intoascmitc:masterfrom
cergfix:master
Open

Add tests exposing 4 critical bugs#169
cergfix wants to merge 1 commit intoascmitc:masterfrom
cergfix:master

Conversation

@cergfix
Copy link
Copy Markdown

@cergfix cergfix commented Mar 3, 2026

Summary

  • Added 7 failing tests that demonstrate 4 critical bugs found in the codebase
  • Tests are integrated into existing test files (test_create.py, test_nested.py, test_hasher.py)
  • All 122 existing tests continue to pass; the 7 new tests fail, proving the bugs are valid

Bugs covered

1. generator.py:75 — Class object inserted into hash entries list
hash_entries = [MHLHashEntry] creates a list containing the MHLHashEntry class itself as the first element instead of an empty list. This causes the class to be appended as a bogus entry into every media hash created via append_multiple_format_file_hashes.

2. history.py:105 — TypeError crash in nested history ignore patterns
latest_ignore_pattern_from_nested_histories() iterates over history.latest_ignore_patterns() which returns None when a child history has no hash lists or no ignore spec, causing TypeError: 'NoneType' object is not iterable.

3. history.py:370 — Early return aborts all reference resolution
_resolve_hash_list_references() uses return instead of continue when a reference path is not found in child_history_mappings, causing the method to abort processing all remaining references across all hash lists.

4. hasher.py:250 — Type assigned instead of dict in AggregateHasher
hasher_lookup = Dict[str, str] assigns the typing.Dict type object instead of creating an empty dict, crashing with TypeError on item assignment when AggregateHasher.__init__ is called.

Test plan

  • All 122 existing tests pass
  • All 7 new bug tests fail, confirming the bugs are real
  • Fix the 4 bugs and verify all 129 tests pass

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