You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 71e2fea
Browse filesBrowse the repository at this point in the historyBrowse files
fix(core): match nested event filters when an ancestor key is missing or null
`eventFilterMatches` returned `false` for any non-empty filter as soon as the
payload was `undefined`/`null`, without evaluating the filter itself. Because
missing nested keys recurse with an `undefined` payload, a nested `$exists:
false` filter failed whenever its parent key was missing or `null`, while the
same filter returned `true` at the top level.
A nullish payload is now matched like an empty object, so a missing payload and
a missing key take the same path. Only filters whose leaves already match a
missing key change behavior: `$exists: false`, `$isNull: false` and
`$anythingBut` now match a missing/`null`/non-object ancestor too, which is how
`$exists` behaves on nested paths elsewhere (e.g. MongoDB) and how these filters
already behaved for a missing key at the top level. Filters that require a value
(`$exists: true`, `$startsWith`, `$gt`, value arrays, `$includes`, `$not`, ...)
are unchanged.
This is the user-facing path behind `retry.fetch`'s `bodyFilter`, so a filter
like `{ error: { retryAfter: [{ $exists: false }] } }` now matches a response
body with no `error` object instead of silently skipping the retry strategy.
- core: unit tests for missing/null/non-object ancestors, deep nesting, arrays,
and guards proving positive filters don't over-match
- trigger-sdk: end-to-end tests for `retry.fetch` + `bodyFilter` against a
local server
Fix `eventFilterMatches` so nested filters that assert the absence of a value match when an ancestor key is missing or `null`, instead of failing before the filter is evaluated. A missing payload is now matched like an empty object: it's how `$exists` behaves on nested paths elsewhere, and how these filters already behaved for a missing key at the top level.
6
+
7
+
This changes the result only for filters whose leaves match a missing key today, i.e. `$exists: false`, `$isNull: false` and `$anythingBut`. Filters that require a value (`$exists: true`, `$startsWith`, `$gt`, value arrays, ...) are unchanged. It fixes `retry.fetch`'s `bodyFilter` (e.g. `{ error: { retryAfter: [{ $exists: false }] } }`) not matching responses that have no `error` object.
0 commit comments