Repository navigation
filter_relevant: clear TypeError mapping JS camelCase options to Python (parity with JS #7) - #15
Merged
Merged
Conversation
A camelCase kwarg from the JS filter raises TypeError before any model call, naming every bad key and its Python spelling. retries is max_attempts = retries + 1, retryBaseMs is retry_backoff in seconds, and ignore is skip_patterns. Other unknown keywords still fail as before.
onDecision and reasoningEffort have no filter_relevant parameter, so the TypeError now says they are not supported. retries (extra attempts) maps to max_attempts (total attempts). retryBaseMs is a millisecond base delay with no jitter, and retry_backoff is that base in seconds. ignore maps to skip_patterns, which replaces the default globs; None keeps them and an empty sequence classifies every path.
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.
Summary
Mirrors 255BITS/patchling #7 (
ad02203) in reverse:filter_relevantraises a singleTypeErrorbefore any model call when JS camelCase options are passed. The error names every bad key along with its Python translation.Semantics verified in both codebases
retriescounts extra attempts (src/filter.js:1372attempts = retries + 1). Pythonmax_attemptscounts total attempts (relevance.py:1237-1259). Message:retries=N (extra attempts) -> max_attempts=N+1 (total attempts).*2**attempt), with no jitter. JS uses ms and caps the wait at 30s (filter.js:1406). Python uses seconds and has no cap (relevance.py:1258). Message:retryBaseMs=M (milliseconds, base delay) -> retry_backoff=M/1000 (seconds, base delay). The defaults differ: 200 ms vs 0.5 s.**crosses/,*does not; neither regex nor substring). A JS array replaces the defaults, andfalse,nulland[]classify every path. In Python,Noneapplies the defaults, a sequence replaces them (it does not extend them), and[]/()classify every path. Note that JSnullcorresponds to Python[], notNone. The CLI--filter-skip-patternflag appends instead, but this message covers only the library call.filter_relevanthas no such parameters, so the message saysnot supported in Python filter_relevantand names no keyword argument. (After the call,FilterRelevantResult.decisionsreturns the decisions in input order, but it is not a keyword alternative. Reasoning effort is fixed at"low".)Tests
tests/test_filter_options.pyvendors the JSSNAKE_CASE_OPTIONSmap. JS-only keys are listed explicitly as unsupported, and the remaining keys are asserted to be exact inverses. It also checks one error naming all bad keys, the error being raised before the model callable runs, and pins theskip_patternsbehavior: None means defaults,[]/()mean every path, a custom list replaces the defaults, and matching uses case-insensitive full-path globs.pytest -q testsin a venv withpip install -e .: 195 passed, 2 skipped (live LLM opt-in), 0 failed.LIVE_LLMwas unset, and no model was called.28d25a4: success.No merge, no publish.