Restrict playtime reports to Blackstone Unlimited and Unlimited Listens (PP-4346)#3383
Restrict playtime reports to Blackstone Unlimited and Unlimited Listens (PP-4346)#3383dbernstein wants to merge 1 commit into
Conversation
…ns (PP-XXXX) Introduces PLAYTIME_REPORT_ELIGIBLE_DATA_SOURCE_NAMES, a frozenset allowlist of the two Blackstone audio platforms for which playtime summary reports should be generated. The previous implementation queried all eligible-protocol collections and then unioned in every distinct data_source_name from the entire PlaytimeSummary table, causing reports (and Google Drive folders) to be created for every data source that had ever accumulated a summary row — including non-Blackstone providers and case/spelling variants contributed by different library installations. The new _fetch_distinct_eligible_data_source_names intersects the set of data source names from eligible-protocol collections (OPDS2API and OPDSForDistributorsAPI) with the hard-coded allowlist, ensuring: - Only "Blackstone Unlimited" and "Unlimited Listens" ever produce reports. - The protocol guard prevents accidental reports if an unrelated collection is given one of those names. - Empty reports are still generated when no playtime data exists for the reporting period. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Claude finished @dbernstein's task in 4m 8s —— View job SummaryClean, well-scoped fix. Replacing the DetailsNit:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3383 +/- ##
=======================================
Coverage 93.34% 93.34%
=======================================
Files 507 507
Lines 46434 46432 -2
Branches 6336 6336
=======================================
- Hits 43345 43344 -1
Misses 1999 1999
+ Partials 1090 1089 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Introduces
PLAYTIME_REPORT_ELIGIBLE_DATA_SOURCE_NAMES, a hard-codedfrozensetallowlist of the two Blackstone audio platforms for which playtime summary reports should be generated:"Blackstone Unlimited"and"Unlimited Listens".Rewrites
_fetch_distinct_eligible_data_source_namesto intersect eligible-protocol collection data source names with this allowlist, removing the previous unfilteredSELECT DISTINCT data_source_name FROM playtime_summariesquery entirely.Motivation and Context
JIRA: PP-4346
The previous implementation queried all collections using eligible protocols (OPDS2API / OPDSForDistributorsAPI) and unioned in every distinct
data_source_namefrom the entireplaytime_summariestable. This caused reports — and Google Drive folders — to be created for every data source that had ever accumulated a summary row, including non-Blackstone providers and historical names from other library installations.Reports should only ever be generated for the two Blackstone audio platforms. A two-layer filter is applied:
PLAYTIME_REPORT_ELIGIBLE_DATA_SOURCE_NAMESare considered.Empty reports are still generated when no playtime data exists for the reporting period.
How Has This Been Tested?
test_generate_playtime_reportsto use"Blackstone Unlimited"and"Unlimited Listens"as collection data source names.test_fetch_distinct_eligible_data_source_names_ignores_playtime_summariesverifying thatPlaytimeSummaryrecords no longer influence the result.test_playtime_report_eligible_data_source_names_constantpinning the frozenset contents.Checklist