Skip to content

Add global.is_first_daily_occurrence to wide events - #9422

Merged
lmac012 merged 5 commits into
developfrom
feature/lukasz/wide-event-first-daily-occurrence
Aug 12, 2026
Merged

lmac012 merged 5 commits into
developfrom
feature/lukasz/wide-event-first-daily-occurrence

Conversation

@lmac012

@lmac012 lmac012 commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/project/1205648422731273/task/1217255814219409?focus=true
Tech Design URL (if applicable):
API Proposals URL(s) (if applicable): None

Description

Adds global.is_first_daily_occurrence to every wide event: true when it is the first event completed with the same feature name and status in the current UTC calendar day.

The flag is computed at completion time, inside the transaction that sets the event status, so both transports report the same value and a delayed or retried send keeps the value from the day the event completed. A new wide_event_daily_occurrences table holds one row per name/status pair, overwritten daily.

No public API or call-site changes — it is handled entirely inside statistics-impl.

Steps to test this PR

First daily occurrence flag

  • In DataClearingWideEvent.kt, temporarily change SAMPLING_PROBABILITY from 0.05f to 1.0f so every burn is recorded (revert before merging)
  • Enable airplane mode / disconnect device from the internet
  • Use the fire button to clear all data
  • Inspect wide_events table in wide_events.db - there should be a single row with is_first_daily_occurrence=1
  • Clear all data again a couple of times
  • Inspect database and confirm there are more rows, but only the initial one has is_first_daily_occurrence=1
  • Disable airplane mode and inspect payloads of POST requests to improving.duckduckgo.com/e - is_first_daily_occurrence flag should be present

No UI changes


Note

Medium Risk
Touches wide-event persistence (migration + new table) and outbound analytics payloads, but changes are isolated to statistics-impl with no public API surface.

Overview
Adds global.is_first_daily_occurrence to completed wide events so analytics can tell whether an event is the first completion that UTC day for the same feature name and status.

The flag is set inside setWideEventStatus (same DB transaction as status), using a dedup key name:status and a new wide_event_daily_occurrences table; wide_events gains is_first_daily_occurrence via Room v5 migration. Both the API payload and pixel parameters include the field; pixel schemas adopt the shared widePixelIsFirstDailyOccurrence param (replacing the inline definition on post-idle session).

Reviewed by Cursor Bugbot for commit e6efda1. Bugbot is set up for automated code reviews on this repo. Configure here.

@lmac012
lmac012 force-pushed the feature/lukasz/wide-event-first-daily-occurrence branch from 88505d6 to d2fc784 Compare August 10, 2026 07:41
lmac012 and others added 4 commits August 11, 2026 12:05
Adds the `is_first_daily_occurrence` column to `wide_events` and a table
tracking the last day each (event name, status) pair was recorded. Nothing
writes to them yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The flag is computed at completion time, inside the transaction that sets the
status, so both transports report the same value and a delayed or retried send
keeps the value from the day the event completed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both transports report the flag: as a typed boolean in the POST body, and as
a parameter on both the count and daily pixels.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds the shared dictionary entry and references it from every wide event
definition. The post-idle-session definition declared the parameter inline,
never having been sent by the app; it now uses the dictionary entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lmac012
lmac012 force-pushed the feature/lukasz/wide-event-first-daily-occurrence branch from d2fc784 to fd7675e Compare August 11, 2026 10:05
@lmac012
lmac012 marked this pull request as ready for review August 11, 2026 11:08

@joshliebe joshliebe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works as described. LGTM! 🚀

@lmac012
lmac012 merged commit 468bec3 into develop Aug 12, 2026
37 of 41 checks passed
@lmac012
lmac012 deleted the feature/lukasz/wide-event-first-daily-occurrence branch August 12, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants