Skip to content

fix: include regex flags in matches/search query hash - #640

Merged
msiemens merged 1 commit into
msiemens:masterfrom
uadhran:fix/637-regex-flags-cache-hash
Oct 5, 2026
Merged

msiemens merged 1 commit into
msiemens:masterfrom
uadhran:fix/637-regex-flags-cache-hash

Conversation

@uadhran

@uadhran uadhran commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Query.matches / Query.search closed over flags but omitted them from the query hash, so the table query cache could return results for the wrong flags.

  • Include flags in the hash tuple for both methods
  • Add a regression test covering hash inequality and cache isolation
  • Minor docstring fix: search flags go to re.search (not re.match)

Fixes #637

Test plan

  • uv run py.test tests/test_queries.py -q --mypy
  • Manual repro from the issue no longer returns John for the case-sensitive search after an ignorecase search

Queries that differed only by flags shared a Table query-cache entry,
so a case-insensitive search could poison a later case-sensitive one.

Fixes msiemens#637
@msiemens

msiemens commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Thanks!

@msiemens
msiemens merged commit e83efcd into msiemens:master Oct 5, 2026
31 checks passed
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.

Query.matches/search: flags omitted from cache hash causes wrong results

2 participants