Skip to content

Commit 932631a

Browse files
majiayu000claude
authored andcommitted
fix: apply WHERE clause check for cross detection in geofence hooks
The WHERE clause was being ignored for cross detection events in geofence/SETHOOK commands. This happened because testObject() (which checks WHERE clauses) was only called when an object was spatially inside the fence. For cross events, both old and new object positions are outside the fence, so testObject() was never invoked. This fix adds an explicit WHERE clause check (via fieldMatch) in the cross detection path before proceeding with event emission. This ensures that cross events are only triggered for objects that match the WHERE clause conditions. Fixes #795 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: majiayu000 <1835304752@qq.com>
1 parent 48aa3d2 commit 932631a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/server/fence.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ func fenceMatch(
141141
}
142142
} else {
143143
if details.command != "fset" {
144+
// For cross detection, the object is outside the fence spatially,
145+
// so testObject wasn't called above. We need to check WHERE clause
146+
// before proceeding with cross detection.
147+
if match, _ := sw.fieldMatch(details.obj); !match {
148+
return nil
149+
}
144150
// Maybe the old object and new object create a line that crosses the fence.
145151
// Must detect for that possibility.
146152
if !nocross && details.old != nil {

0 commit comments

Comments
 (0)