Add DRM enabled status to broken site feedback reports#8086
Merged
jonathanKingston merged 6 commits intodevelopfrom Mar 31, 2026
Merged
Add DRM enabled status to broken site feedback reports#8086jonathanKingston merged 6 commits intodevelopfrom
jonathanKingston merged 6 commits intodevelopfrom
Conversation
Include the user's DRM permission toggle setting (askDrmEnabled) as a new "drmEnabled" parameter in broken site and toggle breakage reports. https://claude.ai/code/session_01QWfhGE2bNNpZMb679uoupk
3 tasks
anikiki
reviewed
Mar 27, 2026
...issions-impl/src/main/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepository.kt
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Session DRM state invisible due to non-singleton repository
- Extracted the in-memory drmSessions map into a new singleton DrmSessionStore (@SingleInstanceIn(AppScope::class)) so all SitePermissionsRepositoryImpl instances share the same session DRM state, making session-level DRM decisions visible to BrokenSiteSubmitter.
Or push these changes by commenting:
@cursor push 3a0a4465dc
Preview (3a0a4465dc)
diff --git a/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/DrmSessionStore.kt b/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/DrmSessionStore.kt
new file mode 100644
--- /dev/null
+++ b/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/DrmSessionStore.kt
@@ -1,0 +1,40 @@
+/*
+ * Copyright (c) 2025 DuckDuckGo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.duckduckgo.site.permissions.impl
+
+import com.duckduckgo.di.scopes.AppScope
+import com.squareup.anvil.annotations.ContributesBinding
+import dagger.SingleInstanceIn
+import javax.inject.Inject
+
+interface DrmSessionStore {
+ fun get(domain: String): Boolean?
+ fun save(domain: String, allowed: Boolean)
+}
+
+@SingleInstanceIn(AppScope::class)
+@ContributesBinding(AppScope::class)
+class RealDrmSessionStore @Inject constructor() : DrmSessionStore {
+
+ private val drmSessions = mutableMapOf<String, Boolean>()
+
+ override fun get(domain: String): Boolean? = drmSessions[domain]
+
+ override fun save(domain: String, allowed: Boolean) {
+ drmSessions[domain] = allowed
+ }
+}
diff --git a/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepository.kt b/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepository.kt
--- a/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepository.kt
+++ b/site-permissions/site-permissions-impl/src/main/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepository.kt
@@ -69,6 +69,7 @@
@AppCoroutineScope private val appCoroutineScope: CoroutineScope,
private val dispatcherProvider: DispatcherProvider,
private val drmBlock: DrmBlock,
+ private val drmSessionStore: DrmSessionStore,
) : SitePermissionsRepository {
override var askCameraEnabled: Boolean
@@ -94,12 +95,10 @@
sitePermissionsPreferences.askLocationEnabled = value
}
- private val drmSessions = mutableMapOf<String, Boolean>()
-
override suspend fun isDrmEnabledForSite(url: String): Boolean {
val domain = url.extractDomain() ?: url
- drmSessions[domain]?.let { return it }
+ drmSessionStore.get(domain)?.let { return it }
if (isDrmBlockedForUrlByConfig(url)) return false
return isDomainAllowedToAsk(url, PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID) ||
@@ -202,11 +201,11 @@
}
override fun getDrmForSession(domain: String): Boolean? {
- return drmSessions[domain]
+ return drmSessionStore.get(domain)
}
override fun saveDrmForSession(domain: String, allowed: Boolean) {
- drmSessions[domain] = allowed
+ drmSessionStore.save(domain, allowed)
}
override fun isDrmBlockedForUrlByConfig(url: String): Boolean {
diff --git a/site-permissions/site-permissions-impl/src/test/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepositoryTest.kt b/site-permissions/site-permissions-impl/src/test/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepositoryTest.kt
--- a/site-permissions/site-permissions-impl/src/test/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepositoryTest.kt
+++ b/site-permissions/site-permissions-impl/src/test/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepositoryTest.kt
@@ -52,6 +52,8 @@
private val mockSitePermissionsPreferences: SitePermissionsPreferences = mock()
private val mockDrmBlock: DrmBlock = mock()
+ private val drmSessionStore: DrmSessionStore = RealDrmSessionStore()
+
private val repository = SitePermissionsRepositoryImpl(
mockSitePermissionsDao,
mockSitePermissionsAllowedDao,
@@ -59,6 +61,7 @@
coroutineRule.testScope,
coroutineRule.testDispatcherProvider,
mockDrmBlock,
+ drmSessionStore,
)
private val url = "https://domain.com/whatever"You can send follow-ups to this agent here.
...issions-impl/src/main/java/com/duckduckgo/site/permissions/impl/SitePermissionsRepository.kt
Show resolved
Hide resolved
Collaborator
Author
|
Marking as Draft as we discuss the origin discussion |
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.


Task/Issue URL: https://app.asana.com/1/137249556945/task/1213808712892824?focus=true
Description
Adds a
drmEnabledparameter to broken site reports (epbfpixel), reporting the effective DRM availability for the reported site.Changes:
isDrmEnabledForSite(url)toSitePermissionsRepository— returns true if the domain is allowed to ask for DRM permission or has been granted itBrokenSiteSubmitterinjectsSitePermissionsRepositoryand includesdrmEnabled(true/false) in the report payloadbroken_site_report.json) to document the new parameterSteps to test this PR
BrokenSiteSubmitterTest— verify the 2 new DRM tests pass (whenDrmIsEnabledForReportedSiteThenIncludeDrmEnabledParam,whenDrmIsDisabledForReportedSiteThenIncludeDrmEnabledParam)BrokenSitesReferenceTestandBrokenSitesMultipleReportReferenceTest— verify reference tests pass withdrmEnabledfieldsite-permissions-impl:testDebugUnitTest— verifyisDrmEnabledForSitedoesn't break existing testsdrmEnabled=trueappears in theepbfpixel in logcatdrmEnabled=falsein a subsequent reportNote
Medium Risk
Adds new DRM-permission evaluation logic and wires it into broken-site report submission, which could impact report sending/parameters if the new repository call or config checks behave unexpectedly. Changes are limited to analytics payloads and site-permissions lookup paths with accompanying unit/reference test updates.
Overview
Broken site feedback reporting now sends a new
drmEnabledparameter on bothepbfandprotection-toggled-off-breakage-report, and pixel definitions were updated accordingly.To support this,
BrokenSiteSubmitterinjectsSitePermissionsRepositoryand includes the computed DRM status in the pixel payload, backed by a newSitePermissionsRepository.isDrmEnabledForSitehelper that resolves effective DRM availability from session overrides, config blocking, and stored permissions. Tests and reference fixtures were updated/extended to validate both DRM-enabled and DRM-disabled cases.Written by Cursor Bugbot for commit 1408217. This will update automatically on new commits. Configure here.