Skip to content

filterRelevant: reject Python-style snake_case options - #7

Merged
mikkel merged 2 commits into
mainfrom
cursor/js-filter-snake-case-opts
Oct 14, 2026
Merged

mikkel merged 2 commits into
mainfrom
cursor/js-filter-snake-case-opts

Conversation

@mikkel

@mikkel mikkel commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

filterRelevant now throws a clear error for on_binary, max_bytes, reasoning_effort before any model call (previously silently ignored). Mirrored in landing/lib; README note. npm test 189 pass / 0 fail.

{ on_binary: 'include' } used to be ignored silently, so the default
exclude applied. Snake_case names from patchling-py now throw a
TypeError naming the camelCase option, before any model call.
Audited filter_relevant() in patchling-py (relevance.py @ bf9c8f0). Adds
skip_patterns (use ignore), max_attempts (retries = max_attempts - 1),
retry_backoff (retryBaseMs = seconds * 1000) and sleep (not supported in
JS; use retryBaseMs: 0 in tests). The error names the JS option and the
conversion, and is thrown before any model call. Tests run against both
src/ and landing/lib/.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying patchling with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a9c6fe
Status: ✅  Deploy successful!
Preview URL: https://4d7caea9.patchling.pages.dev
Branch Preview URL: https://cursor-js-filter-snake-case.patchling.pages.dev

View logs

@mikkel
mikkel marked this pull request as ready for review October 14, 2026 03:51
@mikkel
mikkel merged commit ad02203 into main Oct 14, 2026
6 checks passed
mikkel added a commit that referenced this pull request Oct 20, 2026
)

* feat: throw SmartApplyError when smartapply refuses a model rewrite

Add SmartApplyError (extends Error, name 'SmartApplyError'), matching
patchling-py. smartapply throws it, with the same message as before, when the
model's rewrite changes lines the diff did not add or remove and the edit
cannot be replayed from the +/- lines. Provider and network errors are not
wrapped and still propagate as the original error object.

Export it from src/index.js. Regenerate the .d.ts files with npm run types;
this also brings src/filter.d.ts up to date for SNAKE_CASE_OPTIONS and the
filterRelevant @throws note, which were not regenerated in #7.

No landing/lib change: gptdiff.js and index.js are not vendored there.

* docs(changelog): note SmartApplyError as a 0.3.1 behavior change

The 0.3.1 summary said there was no change to smartapply. Refusals now
throw SmartApplyError: err.name, the constructor/class and the printed
form (String(err), stack first line) change. The message text and the
passthrough of provider/LLM errors do not.

---------

Co-authored-by: mikkel <7003+mikkel@users.noreply.github.com>
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.

2 participants