Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/vacuous-filter-carveouts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
---

test(objectql): pin the two vacuous-filter carve-outs (#4121, #4181)

Test-only; no package behavior changes, so this changeset releases nothing.
26 changes: 26 additions & 0 deletions packages/objectql/src/protocol-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,32 @@ describe('ObjectStackProtocolImplementation - Data Operations', () => {
expect(engine.find.mock.calls[1][1].where).toEqual({ owner_id: 'usr_1' });
});

it('every OTHER vacuous filter shape means "absent" too — the two deliberate carve-outs nothing pinned', async () => {
// Both of these are decisions the code states in a comment and no
// test held. They sit one line away from a rejection, so a future
// tightening of the surrounding guard would silently turn "no
// filter" into a 400 for callers who send an empty one:
//
// [] — #4121 rejects an array `isFilterAST` refuses, but
// deliberately exempts the EMPTY array ("it means no
// filter, and every path already treats it that way").
// ' ' — #4181 rejects an unparseable filter STRING via
// JSON.parse, but blanks it first with `.trim()`, so a
// whitespace-only filter is absent rather than invalid.
// Only `''` was covered; `' '` never exercised trim().
const { protocol, engine } = makeProtocol();
for (const filter of [[], ' ']) {
await protocol.findData({
object: 'showcase_task',
query: { filter, owner_id: 'usr_1' },
});
}
for (const call of engine.find.mock.calls) {
expect(call[1].where).toEqual({ owner_id: 'usr_1' });
}
expect(engine.find).toHaveBeenCalledTimes(2);
});

it('count() sees the merged where — pagination totals cannot disagree with records (#4164)', async () => {
const { protocol, engine } = makeProtocol();
await protocol.findData({
Expand Down
Loading