fix(ads): take fixed-format fills out of the delivery-by-medium split - #328
Merged
Merged
Conversation
The card read "Static 98.7%" because feed items, text links and terminal units, ~95% of all fills, have exactly one presentation and were booked as the static arm. Restricted to the formats that rotate, a 300x250 splits 48% static / 31% image / 9% gif / 6% audio / 5% video over 30 days, which is what a pool with ~40% of campaigns rendered should produce. The same fills carried the clicks: every click in the window is invalid, and the bulk are crawlers replaying feed-item links days to weeks after the impression. They lifted the table over the 30-click gate and put a CTR column on five arms that had six banner clicks between them. - ad_media_bucket(format, media): 'fixed' for a non-rotating format, pinned to rotatesMedia() by a contract test - the rollup refresh deletes its window before re-inserting, so a row keyed under the old bucketing cannot survive beside the new one - backfill from the oldest raw event: the rollup only ever held the week before 20260925150000, so "Last 30 days" was reading 7 - no rate on the fixed or unattributed rows Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan49 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 32 | LOW: 15
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Delivery by medium card on /dashboard/ads read Static 98.7% with a CTR column. Both came from counting the wrong fills.
Share. Feed items, text links and terminal units have exactly one presentation (
mediaKindsForFormat) and are ~95% of the network's fills, so they were booked as the static arm. They now go to afixedbucket that is reported but never shared or rated.Clicks. 0 of 236,961 clicks in the last 30 days are valid. Most are crawlers replaying feed-item links days to weeks after the impression (the same pattern as #264). They pushed the table past the 30-click gate, so a CTR column appeared on five arms that had 6 banner clicks between them.
Rollup window. The rollup only held data from 2026-09-22, so "Last 30 days" covered 7 days. The migration rebuilds it from the oldest raw event, and the refresh now deletes its window before re-inserting.
Dry run against prod (in a transaction, rolled back), 30 days, full rebuild in 3.6s:
Tests: tsc clean, 2,743 passing, plus a contract test that pins the SQL's rotating-format list to
rotatesMedia().The migration is applied by hand after merge.
🤖 Generated with Claude Code