Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR converts malformed patterns passed to
Reviews (2) · Last reviewed commit: "fix(query): report invalid custom filter..." · Reviewed by Greptile |
|
Checked head |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
🤖 AI code reviewAdds a re.error handler to q2_filter_keyvals_regex in aw_query/functions.py that raises QueryFunctionException with the compiler diagnostic and suppresses exception chaining. Adds tests for invalid patterns through the query interpreter, valid matching results, low-level regex exceptions, and event-data TypeError propagation. Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Files changed (2) — the diff as I read it
Previous review passes
Reviewed Maintainer commands
|
Git-Session-Id: 6833e3b2-8ce8-4432-b3fd-05de48afd45d
2066a46 to
94c0b2e
Compare
|
@greptileai review |
|
Rebased onto current master |
Summary
Catch
re.erroronly atq2_filter_keyvals_regexand raiseQueryFunctionExceptionwith the regex compiler diagnostic. The existing aw-server query route then returns HTTP 400 instead of an internal HTTP 500.Closes #192.
The low-level transform still raises
re.error; matching semantics, category-rule fallback, and event-data TypeError behavior are unchanged.re.erroris used rather than the newerre.PatternErrorspelling to retain Python 3.8 support.Reproduction
On master
c7821899, POST/api/0/query/with cache disabled and queryRETURN = filter_keyvals_regex([], "title", "[");returns HTTP 500 (unterminated character set at position 0). This also happens with populated events.With this patch the same real Flask route returns HTTP 400:
{"type": "QueryFunctionException", "message": "Invalid regex: unterminated character set at position 0"}Verification
pytest tests/test_query_filter_regex.py tests/test_query2.py tests/test_transforms.py -q: 130 passed.pytest tests -q: 374 passed, 5 skipped.make typecheck: 37 source files clean.994ea988, synthetic MemoryStorage, cache disabled, no listener or personal history): 12 cases. Three invalid patterns × empty/populated input change 500 → 400, while valid matching/nonmatching/empty-pattern controls remain 200 with identical results. Original filing-time HTTP probe is GREEN against the branch.make test-fastis not a target in this repository; the full small package test suite above was used instead.Retained HTTP replay and RED/GREEN JSON:
/home/bob/data/regex-query-ab07/on Bob's machine. Source merge and fetched-master interpreter/HTTP replay remain the task's completion gate; this PR does not claim a deployed release.Hosted runner follow-through
Initial hosted Build run
40767673028stopped in setup-python before executing tests: Python 3.8 is unavailable for Ubuntu 26.04 (ubuntu-latest). Commit2066a46carries the identical Ubuntu 22.04 pin already validated by #187 and #189. Windows/macOS entries and the Python floor are unchanged. Greptile 5/5 covered product commit0bf8314; the follow-up changes only the Linux runner pin. Final hosted checks are pending.