Skip to content

fix: stop Vercel translator silently mapping unsupported operators to eq - #279

Merged
gfargo merged 1 commit into
mainfrom
fix/vercel-operator-mapping-gaps
Aug 24, 2026
Merged

fix: stop Vercel translator silently mapping unsupported operators to eq#279
gfargo merged 1 commit into
mainfrom
fix/vercel-operator-mapping-gaps

Conversation

@gfargo

@gfargo gfargo commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Fixes #261

Summary

mapUnifiedOperatorToVercel only mapped 8 of the unified Operator type's 15 values. ne, not_contains, not_in, gt, ge, lt, le fell through mapping[op] || 'eq' with no warning, silently rewriting what a rule matches — sometimes inverting it outright. A condition meaning "method is not POST" (ne) translated to Vercel's plain "method is POST" (eq), the literal opposite, with nothing anywhere flagging it. Vercel is doorman's documented "stable" provider, so this is the adapter users are most likely to trust without extra scrutiny.

Two different fixes for two different reasons:

  • ne/not_contains/not_in are representable on Vercel. It has no dedicated negative operators, only a positive operator + a neg flag (the same mechanism not_exists already uses via nex). These now map to their positive operator with forceNeg: true, composed via XOR with the condition's own independent negated flag rather than overwriting it — so a hand-authored {operator: 'ne', negated: true} (double negation) correctly cancels back to plain equality instead of producing a nonsensical result.
  • gt/ge/lt/le have no Vercel equivalent at all. Vercel's operator vocabulary (eq, pre, suf, inc, sub, re, ex, nex) has no numeric-comparison concept — there's nothing to fall back to, so these now drop the condition and emit a critical TranslationWarningSystem warning instead, mirroring the existing unmapped-field warning path already in the same function.

Test plan

  • Regression tests for all 7 previously-unmapped operators, including the double-negation composition edge case
  • Three separate mutation-verification passes (negatable-operator mapping, unsupported-operator drop/warn, and the XOR-vs-OR composition specifically) — each reverted, confirmed the relevant tests fail legibly, restored
  • pnpm compile && pnpm test && pnpm lint all pass (1779 tests, 0 lint errors)

mapUnifiedOperatorToVercel only mapped 8 of the 15 unified Operator
values; ne/not_contains/not_in/gt/ge/lt/le fell through `mapping[op] ||
'eq'` with no warning, silently rewriting what a rule matches. A
condition meaning "method is not POST" (ne) translated to Vercel's
plain "method is POST" (eq) -- the literal opposite, with nothing
anywhere flagging it. Vercel is doorman's documented "stable" provider,
so this was the adapter users are most likely to trust without extra
scrutiny.

ne/not_contains/not_in are representable on Vercel -- it has no
dedicated negative operators, only a positive operator + `neg` flag
(the same mechanism `not_exists` already uses via `nex`) -- so these
now map to their positive operator with `forceNeg: true`, composed via
XOR with the condition's own independent `negated` flag rather than
just overwriting it (so a hand-authored `{operator: 'ne', negated:
true}` correctly cancels back to plain equality instead of a
nonsensical double-negative).

gt/ge/lt/le have no Vercel equivalent at all -- Vercel's operator
vocabulary (eq, pre, suf, inc, sub, re, ex, nex) has no numeric
comparison concept -- so these now drop the condition and emit a
critical TranslationWarningSystem warning instead of silently
substituting eq, mirroring the existing unmapped-field warning path in
the same function.
@gfargo
gfargo merged commit 3bc17f1 into main Aug 24, 2026
2 checks passed
@gfargo
gfargo deleted the fix/vercel-operator-mapping-gaps branch August 24, 2026 21:42
github-actions Bot pushed a commit that referenced this pull request Aug 24, 2026
## [3.15.3](v3.15.2...v3.15.3) (2026-08-24)

### Bug Fixes

* stop Vercel translator silently mapping unsupported operators to eq ([#279](#279)) ([3bc17f1](3bc17f1))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.15.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

gfargo added a commit that referenced this pull request Aug 25, 2026
…) are fixed (#282)

ne/not_contains/not_in and allow/block were documented as known-bugs to
avoid on Vercel; both are now correctly handled (neg-flag composition
and bypass/deny remapping respectively, per #279/#280). gt/ge/lt/le
remain a genuine platform gap -- Vercel has no numeric-comparison
operator at all -- but that's now a documented, safe drop-with-warning
rather than a silent bug to avoid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vercel translator silently maps 7 unsupported unified operators to eq, inverting rule intent

1 participant