fix(search): bound temporal analysis for oversized queries - #3140
Open
r266-tech wants to merge 2 commits into
Open
fix(search): bound temporal analysis for oversized queries#3140r266-tech wants to merge 2 commits into
r266-tech wants to merge 2 commits into
Conversation
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.
Addresses the temporal-analysis failure described in #3134.
What changed
DateparserQueryAnalyzerinputs longer than 512 characters, before period extraction or dateparser loading.The reported poison fact was 582,808 characters. For its repeated
mandatorypattern on the reference checkout after warm-up, 128/256/512 characters took roughly 0.23/0.44/0.82 seconds while 4,096 took about 6.7 seconds, so 512 keeps normal query room while rejecting the demonstrated extraction-sized input.Explicit trade-off
ThreadPoolExecutorcannot terminate running parser code. A regex operation that holds the GIL may therefore outlive—and potentially delay—the one-second caller timer. The length cap is the primary defense for the reported failure; the executor bounds admission and prevents unrelated default-executor starvation, but it is not a hard CPU deadline. A timed-out job keeps one of the four slots until it truly finishes. Killable process isolation would add worker lifecycle and serialization constraints and is intentionally left out of this focused fix.Queries above the cap continue through non-temporal retrieval, so they may return a broader result set rather than wedging the server.
Verification
uv run pytest -q tests/test_query_analyzer.py— 424 passedruff check,ruff format --check, andty check— passed@eslint/js; no unrelated generated/frontend edits are included