fix: categorical hashing, delayed-backend detection, and pretty-printing#4106
Open
henryiii wants to merge 4 commits into
Open
fix: categorical hashing, delayed-backend detection, and pretty-printing#4106henryiii wants to merge 4 commits into
henryiii wants to merge 4 commits into
Conversation
henryiii
added a commit
that referenced
this pull request
Jun 10, 2026
Covers: categorical hashing with nested list/dict categories, any_backend_is_delayed loop correctness, prettyprint custom_str token handling, and recursively_apply Record regular_to_jagged forwarding. Assisted-by: ClaudeCode:claude-sonnet-4-6
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
- _categorical.py: HashableList.__init__ now recurses via as_hashable for each element, matching HashableDict; fixes TypeError on list-of-dict categories - _errors.py: any_backend_is_delayed only short-circuits on True from recursion, not False, so remaining args in a mixed list are always inspected - prettyprint.py: custom_str result is wrapped in a single-element list and cols_taken is recomputed from len(custom), preventing character-by-character splicing and width accounting errors - _do.py: recursively_apply Record branch forwards regular_to_jagged to the recursive call instead of silently resetting it to False Assisted-by: ClaudeCode:claude-sonnet-4-6
Covers: categorical hashing with nested list/dict categories, any_backend_is_delayed loop correctness, prettyprint custom_str token handling, and recursively_apply Record regular_to_jagged forwarding. Assisted-by: ClaudeCode:claude-sonnet-4-6
Rename test_4106-fix-core-misc.py → test_4106_fix_core_misc.py (underscore required by validate-test-names.py). Reduce 16 tests to 8: one focused regression per bug, removing near-duplicate and internal-structure-probing cases. Merge prettyprint width and splicing checks into one test. Assisted-by: ClaudeCode:claude-sonnet-4-6
c1ddfac to
998bb26
Compare
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.
🤖 AI text below 🤖
Summary
Four isolated correctness fixes identified in an automated multi-agent review (Claude Code):
src/awkward/_categorical.py—HashableListnot recursive (#1)HashableList.__init__was doingtuple(obj)without applyingas_hashableto each element, unlikeHashableDictwhich correctly recurses. This causedTypeError: unhashable type: 'dict'when categorical array categories were lists containing dicts (e.g. list-of-record categories). Fixed:tuple(as_hashable(x) for x in obj).src/awkward/_errors.py—any_backend_is_delayedshort-circuits too eagerly (#2)Inside the loop, when an object had no recognizable backend, the method returned
Falseunconditionally (or returned the recursive result unchanged), so remaining args were never inspected. This means([plain_obj, dask_array])would be classified as not-delayed. Fixed: only return early when the recursive result isTrue; otherwise continue to the next item.src/awkward/prettyprint.py—custom_strresult spliced character-by-character (#3)When
custom_str(current)returned a string,strs = custom(a plainstr) was passed tofront.extend(strs)/back[:0] = strs, which iterates over individual characters. Additionally,cols_takenkept the value from the discarded default rendering rather than the actual custom string length. Fixed: wrap in[custom]and recomputecols_taken = len(custom).src/awkward/_do.py—recursively_applyRecord branch omitsregular_to_jagged(#4)The
isinstance(layout, Record)branch calledrecursively_applypositionally and omittedregular_to_jagged, silently resetting it toFalsefor Record inputs. Fixed: forward the missing argument.Test plan
tests/test_4106_fix_core_misc.py— 8 focused regression tests covering all four fixestest_0401,test_1688,test_0674test_2856test_2047PYTHONPATH=$PWD/src /tmp/ak-review-venv/bin/python -m pytestAI assistance disclosure
This PR was generated by Claude Code (claude-sonnet-4-6) as part of an automated multi-agent review process. All fixes were verified against tests before submission.
🤖 Generated with Claude Code