Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1482 +/- ##
==========================================
+ Coverage 69.48% 69.51% +0.03%
==========================================
Files 303 305 +2
Lines 17982 18010 +28
==========================================
+ Hits 12495 12520 +25
- Misses 5057 5059 +2
- Partials 430 431 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new "seen" modifier to track when a contact was last seen, along with a corresponding event type to notify when this value changes.
Changes:
- Added
Seenmodifier that updates a contact'slast_seen_ontimestamp - Added
ContactLastSeenChangedevent that fires when the last seen timestamp is updated - Added test data and test assets to support the new functionality
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| flows/modifiers/seen.go | Implements the Seen modifier with logic to update last_seen_on only when the new timestamp is later |
| flows/events/contact_last_seen_changed.go | Defines the ContactLastSeenChanged event type |
| flows/modifiers/testdata/seen.json | Test data for the Seen modifier |
| flows/modifiers/testdata/_assets.json | Adds "Seen In 2026" group for testing |
| flows/events/base_test.go | Adds test case for ContactLastSeenChanged event marshaling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // "uuid": "0197b335-6ded-79a4-95a6-3af85b57f108", | ||
| // "type": "contact_last_seen_changed", | ||
| // "created_on": "2006-01-02T15:04:05Z", | ||
| // "seen_on": "2026-02-03T15:04:05Z" |
There was a problem hiding this comment.
The JSON field name in the documentation should be "last_seen_on" instead of "seen_on" to match the struct field name. The struct field LastSeenOn with the json tag json:"last_seen_on" will serialize to "last_seen_on" in JSON, not "seen_on".
| // "seen_on": "2026-02-03T15:04:05Z" | |
| // "last_seen_on": "2026-02-03T15:04:05Z" |
| [ | ||
| { | ||
| "description": "last seen changed event if changed", | ||
| "contact_before": { | ||
| "uuid": "5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f", | ||
| "name": "Bob", | ||
| "status": "active", | ||
| "created_on": "2018-06-20T11:40:30.123456789Z" | ||
| }, | ||
| "modifier": { | ||
| "type": "seen", | ||
| "seen_on": "2026-02-03T11:40:30.123456789Z" | ||
| }, | ||
| "contact_after": { | ||
| "uuid": "5d76d86b-3bb9-4d5a-b822-c9d86f5d8e4f", | ||
| "name": "Bob", | ||
| "status": "active", | ||
| "created_on": "2018-06-20T11:40:30.123456789Z", | ||
| "last_seen_on": "2026-02-03T11:40:30.123456789Z", | ||
| "groups": [ | ||
| { | ||
| "uuid": "23d0f9a4-5bb8-4577-b518-d404caef8cf3", | ||
| "name": "Seen In 2026" | ||
| } | ||
| ] | ||
| }, | ||
| "events": [ | ||
| { | ||
| "uuid": "01969b47-0583-76f8-ae7f-f8b243c49ff5", | ||
| "type": "contact_last_seen_changed", | ||
| "created_on": "2025-05-04T12:30:46.123456789Z", | ||
| "last_seen_on": "2026-02-03T11:40:30.123456789Z" | ||
| }, | ||
| { | ||
| "uuid": "01969b47-0d53-76f8-bd38-d266ec8d3716", | ||
| "type": "contact_groups_changed", | ||
| "created_on": "2025-05-04T12:30:48.123456789Z", | ||
| "groups_added": [ | ||
| { | ||
| "uuid": "23d0f9a4-5bb8-4577-b518-d404caef8cf3", | ||
| "name": "Seen In 2026" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] No newline at end of file |
There was a problem hiding this comment.
The test data should include additional test cases to cover edge cases. Looking at similar modifiers like language.json, there should be at least two test cases: one where the last_seen_on changes (already covered) and one where it doesn't change (e.g., when the new seen_on is equal to or before the current last_seen_on). This would test the condition on line 39 of flows/modifiers/seen.go where the modifier should return false and not create an event.
No description provided.