Skip to content

Commit 4f1f02b

Browse files
os-zhuangclaude
andcommitted
test(driver-sql): 对象比较数拒收表随 TEXT_PATTERN_OPERATORS 成员变更改写 (#5702)
`sql-driver-silent-empty-predicate.test.ts` 的算子表就是 `TEXT_PATTERN_OPERATORS`(比较数会变成 LIKE 模式文本的那一组),所以随该集合 成员变更:`$regex` 退役离开,`$icontains` 加入。 改写而非删除:`$icontains` 是唯一比较数**同时**受校验遍历把关的文本算子, 少了这一行,两道闸将来对「对象比较数」给出不同答案时无人察觉。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WyvqvKMG6asi9aXjKE6xtx
1 parent 133016c commit 4f1f02b

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

packages/drivers/driver-sql/src/sql-driver-silent-empty-predicate.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,19 @@ describe('[#5234] SqlDriver refuses the two comparand shapes that compiled to a
233233
expect(err.message).toContain('StringOperatorSchema');
234234
});
235235

236-
for (const op of ['$contains', '$notContains', '$startsWith', '$endsWith', '$regex'] as const) {
236+
// [#5702] This list IS `TEXT_PATTERN_OPERATORS` — the operators whose
237+
// comparand becomes the TEXT of a LIKE pattern — so it follows that set's
238+
// membership. `$regex` left it (retired, #4706) and `$icontains` joined it.
239+
//
240+
// Re-spelled rather than merely dropped, because the row was pinning a real
241+
// condition and the new member needs it more, not less: `$icontains` is the
242+
// one text operator whose comparand is ALSO gated on the validating walk,
243+
// so without a row here nothing would notice if the two gates ever
244+
// disagreed about an object. (Which one fires is deliberately not asserted —
245+
// both answer `INVALID_FILTER` / 400 naming the operator, which is the
246+
// contract; the walk simply runs first.) The retired spelling's own refusal
247+
// is pinned in `sql-driver-icontains-and-retired-operators.test.ts`.
248+
for (const op of ['$contains', '$notContains', '$startsWith', '$endsWith', '$icontains'] as const) {
237249
it(`\`${op}\` refuses an object comparand`, async () => {
238250
const err = await refusalOf(() => find({ name: { [op]: { foo: 1 } } }));
239251
expect(err.code, op).toBe('INVALID_FILTER');

0 commit comments

Comments
 (0)