Exception behaviour changed
sanitize_pattern([["pattern", "0"]])Neither exception type subclasses the other.
The PR is presented as a pure performance refactor (caching) with no intended behavior change. The new exception type (TypeError) differs from the old (AttributeError) even though the core logic (calling re.escape) is unchanged, indicating an unintended regression.
⚡️ Speed up function `sanitize_pattern` by 11,547% return _sanitize_pattern(pattern)Found by: Nemotron strategy search, search sample · no baseline found it
ran onToken Factory Sandboxes · image 87c6903e-46fd-4cf5-a313-2b45b6b1248c
Regression test verified passes on base, errors on head
def test_patterns_12_p2_outcome_0():
"""Breakwater P2: base behaviour pinned (found by differential testing; label: likely-bug)."""
import pytest
from json2nginx import sanitize_pattern
with pytest.raises(AttributeError) as excinfo:
sanitize_pattern([['pattern', '0']])
assert type(excinfo.value) is AttributeError # exact type: a subclass would be a behaviour change