Skip to content
Open
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
4 changes: 2 additions & 2 deletions sigil/internal/query/service_agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ func buildAgentListFilterHash(namePrefix string, seenAfter, seenBefore time.Time
h.Write([]byte(strings.TrimSpace(namePrefix)))
h.Write([]byte{0})
if !seenAfter.IsZero() {
h.Write([]byte(seenAfter.UTC().Format(time.RFC3339)))
h.Write([]byte(seenAfter.UTC().Format(time.RFC3339Nano)))
}
h.Write([]byte{0})
if !seenBefore.IsZero() {
h.Write([]byte(seenBefore.UTC().Format(time.RFC3339)))
h.Write([]byte(seenBefore.UTC().Format(time.RFC3339Nano)))
}
return hex.EncodeToString(h.Sum(nil))
}
Expand Down
29 changes: 29 additions & 0 deletions sigil/internal/query/service_agents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,32 @@ func TestValidateCursorFilterHash(t *testing.T) {
})
}
}

func TestBuildAgentListFilterHashDiffersForSubsecondFilterTime(t *testing.T) {
t.Parallel()

base := time.Date(2026, 3, 16, 10, 30, 0, 0, time.UTC)
oneNanoLater := base.Add(time.Nanosecond)

hashBase := buildAgentListFilterHash("assistant", base, time.Time{})
hashOneNanoLater := buildAgentListFilterHash("assistant", oneNanoLater, time.Time{})

if hashBase == hashOneNanoLater {
t.Fatalf("expected distinct hashes for sub-second filter times")
}
}

func TestBuildAgentListFilterHashNormalizesTimeZone(t *testing.T) {
t.Parallel()

utcInstant := time.Date(2026, 3, 16, 9, 30, 0, 123456789, time.UTC)
paris := time.FixedZone("CET", 1*60*60)
localInstant := utcInstant.In(paris)

hashUTC := buildAgentListFilterHash("assistant", utcInstant, time.Time{})
hashLocal := buildAgentListFilterHash("assistant", localInstant, time.Time{})

if hashUTC != hashLocal {
t.Fatalf("expected matching hashes for equivalent instants across time zones")
}
}
Loading