Repository navigation
test: check $gt/$gte/$lt/$lte filters at the bound - #1264
Conversation
The existing cases check $gte only well above the bound and $lte only inside arrays, so a strict comparison at the bound would go unnoticed. Destinations filtered with $gte or $lte would silently miss events whose field equals the bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, good catch! Could you add the strict side too, so a |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Done, added both: Same run found one more gap you might want: in the event list API, if the time filter's |
alexluong
left a comment
There was a problem hiding this comment.
Thanks for the prompt response and for your contribution! Yes, go ahead with the event list one, I'll review it.
If
$gteon numbers ever became a strict>, a destination filtered on{ "data": { "amount": { "$gte": 100 } } }would stop receiving events withamount: 100, those events would never be delivered, and no test would notice.Tests only: one test (+25 lines) in
internal/simplejsonmatch/match_test.go. No change to library code.The filter docs (
docs/content/features/filter.mdoc) describe$gteas "Greater than or equal" and$lteas "Less than or equal". The existing cases check$gteonly well above the bound (10 >= 5) and$lteonly inside arrays, so the equal-to-the-bound case is not pinned.TestMatchInclusiveBoundschecks both operators at the bound and one step outside it, in the same table style asTestMatch.How it was checked
On main
8e537a8:go test -short -count=1 ./internal/simplejsonmatch/ ./internal/models/: both ok.gofmtandgo vetare clean.return vNum >= cNum, nilinopGtechanged toreturn vNum > cNum, nil, this new test is the only one that fails (Match({"amount":100}, {"amount":{"$gte":100}}) = false, want true);go test -short ./...shows no other failure.This test was written with Claude Code during a planted-bug run by SK @ Trenyx.