Skip to content

Handle unhashable transformer stages in linear precompute prefix detection - #677

Open
cmacdonald with Copilot wants to merge 3 commits into
masterfrom
copilot/return-none-in-identifycommon
Open

cmacdonald with Copilot wants to merge 3 commits into
masterfrom
copilot/return-none-in-identifycommon

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Linear experiment prefix detection could raise TypeError: unhashable type when stage comparison hit transformers that define equality but are not hashable (e.g., LateRetriever-like cases). In that failure mode, _identifyCommon() should skip prefix extraction and proceed with the original pipelines.

  • Prefix detection fallback

    • Updated pyterrier/_evaluation/_exec_linear.py so _identifyCommon() catches the unhashable-stage TypeError from _common_prefix(...) and returns (None, pipes).
    • Preserves existing behavior for other errors by re-raising non-unhashable TypeErrors.
  • Regression coverage

    • Added tests/test_exec_linear_common_prefix.py with an equality-only (unhashable) transformer to assert graceful fallback instead of failure.
try:
    common_prefix, suffices = _common_prefix(pipe_lists)
except TypeError as e:
    if "unhashable type" in str(e):
        return None, pipes
    raise

Copilot AI and others added 3 commits August 27, 2026 12:28
Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
Co-authored-by: cmacdonald <620938+cmacdonald@users.noreply.github.com>
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