@duckduckgo/autoconsent 16.17.0 → 16.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.agents/skills/proxy-testing/SKILL.md +17 -3
  2. package/.agents/skills/proxy-testing/scripts/regional-proxy.mjs +10 -3
  3. package/AGENTS.md +5 -4
  4. package/CHANGELOG.md +20 -0
  5. package/dist/addon-firefox/compact-rules.json +1 -1
  6. package/dist/addon-firefox/content.bundle.js +0 -90
  7. package/dist/addon-firefox/manifest.json +1 -1
  8. package/dist/addon-firefox/rule-index.json +1 -1
  9. package/dist/addon-firefox/rules.json +1 -1
  10. package/dist/addon-mv3/compact-rules.json +1 -1
  11. package/dist/addon-mv3/content.bundle.js +0 -90
  12. package/dist/addon-mv3/manifest.json +1 -1
  13. package/dist/addon-mv3/rule-index.json +1 -1
  14. package/dist/addon-mv3/rules.json +1 -1
  15. package/dist/autoconsent.cjs.js +0 -90
  16. package/dist/autoconsent.esm.js +0 -90
  17. package/dist/autoconsent.playwright.js +0 -90
  18. package/dist/autoconsent.standalone.js +1 -91
  19. package/lib/cmps/all.ts +0 -2
  20. package/package.json +1 -1
  21. package/rules/autoconsent/borlabs.json +48 -17
  22. package/rules/autoconsent/pornhub.json +27 -3
  23. package/rules/autoconsent/samsung-com.json +1 -1
  24. package/rules/compact-rules.json +1 -1
  25. package/rules/rule-index.json +1 -1
  26. package/rules/rules.json +1 -1
  27. package/tests/borlabs.spec.ts +1 -1
  28. package/tests/onetrust.spec.ts +4 -0
  29. package/tests/pornhub.spec.ts +2 -1
  30. package/tests/trustarc-newcm.spec.ts +1 -1
  31. package/tests/trustarc.spec.ts +0 -7
  32. package/tests-wtr/rules/cmp-test-urls.json +0 -1
  33. package/dist/types/cmps/trustarc-frame.d.ts +0 -15
  34. package/lib/cmps/trustarc-frame.ts +0 -126
  35. package/rules/autoconsent/complianz-opt-both.json +0 -12
  36. package/rules/autoconsent/deepl.json +0 -14
  37. package/rules/autoconsent/jdsports.json +0 -41
  38. package/rules/autoconsent/pornhub-compact-cookie-banner.json +0 -28
  39. package/tests/complianz-opt-both.spec.ts +0 -3
  40. package/tests/deepl.spec.ts +0 -5
  41. package/tests/jdsports.spec.ts +0 -3
@@ -4,8 +4,19 @@ description: Test autoconsent via regional proxies in Playwright. Use when verif
4
4
  ---
5
5
 
6
6
  # Proxy Testing
7
+ This skill provides a JS library to run autoconsent via regional proxies in Playwright.
7
8
 
8
- All rule changes must be tested across ALL supported geographic regions to catch regional popup variations. This skill provides a JS library to run autoconsent via regional proxies in Playwright.
9
+ Rule changes are verified with a two-level regional policy.
10
+ The **core region set** (default for detection, iteration, and verification) covers `us` (CCPA), `gb` (UK GDPR), `de` (EEA GDPR), plus the reported region from the task when specified (if the reported region is not a supported proxy region, use the closest supported one, e.g. `es` for `pt`). Iterate in the single most relevant region; run the full core set once when the fix is stable.
11
+
12
+ Escalate to the **expanded set** (`us`, `gb`, `de`, `fr`, `nl`, `pl`, `au`, `ca`, `jp`) if any of these is true:
13
+ - core results diverge
14
+ - the rule contains region-dependent logic
15
+ - the fix relies on language-specific or brittle structural selectors
16
+ - the change touches a widely-used generic rule (as final pre-PR validation)
17
+ - a non-core region named in the report behaves differently.
18
+
19
+ The remaining GDPR/EEA regions (`ch`, `no`, `it`, `es`, `se`, `dk`) are optional even in an expanded pass: test them only when named in the report or clearly relevant (e.g. the site's ccTLD).
9
20
 
10
21
  Important! Autoconsent results can have false positives. When testing, always inspect the screenshots and confirm that opt-out was successful.
11
22
 
@@ -74,7 +85,10 @@ export default defineConfig({
74
85
  ## API
75
86
 
76
87
  - `testUrl(url, regionKey, options?)` — test one URL in a single region; launches a proxied browser, runs autoconsent, returns a `TestResult`.
77
- - `testRegions(url, regions?, options?)` — test one URL across several regions (defaults to all supported regions), a fresh browser per region; returns `TestResult[]`.
88
+ - `testRegions(url, regions?, options?)` — test one URL across several regions (defaults to `CORE_REGIONS`), a fresh browser per region; returns `TestResult[]`. Remember to include the reported region when not already covered.
89
+ - `CORE_REGIONS` — the core region set (default); add the reported region when not already covered.
90
+ - `EXPANDED_REGIONS` — the expanded region set used on escalation.
91
+ - `ALL_REGIONS` — all supported regions.
78
92
  - `testPage(page, url, regionKey, options?)` — run a full test on a page you created yourself (you own the browser/context); returns a `TestResult`.
79
93
  - `injectAutoconsent(page, options?)` — set up isolated-world injection; call before `page.goto()`. Returns a context (`received`, `hasMessage`, `waitForCompletion`, `waitForMessage`, `collectResult`).
80
94
  - `buildProxyConfig(regionKey)` — build the Playwright `{ server, username, password }` proxy object for a region from its env vars.
@@ -108,7 +122,7 @@ await browser.close();
108
122
 
109
123
  1. Run `npm run build-rules` after changing rule JSON.
110
124
  2. Smoke-test each regional proxy.
111
- 3. Test in ALL supported regions.
125
+ 3. Verify on the core region set (`us`, `gb`, `de` + reported region); escalate to the expanded set per the policy above.
112
126
  4. Inspect screenshots, not just API results.
113
127
  5. Reload after dismissal and confirm the rule does not keep matching, unless cosmetic-only.
114
128
 
@@ -82,7 +82,14 @@ const contentScript = fs.readFileSync(path.join(projectRoot, 'dist/autoconsent.p
82
82
  const rulesJson = JSON.parse(fs.readFileSync(path.join(projectRoot, 'rules/rules.json'), 'utf-8'));
83
83
  const fullRules = rulesJson.autoconsent;
84
84
 
85
- export const DEFAULT_REGIONS = ['us', 'gb', 'au', 'ca', 'de', 'fr', 'nl', 'ch', 'no', 'it', 'es', 'pl', 'se', 'dk', 'jp'];
85
+ /** All supported proxy regions. */
86
+ export const ALL_REGIONS = ['us', 'gb', 'au', 'ca', 'de', 'fr', 'nl', 'ch', 'no', 'it', 'es', 'pl', 'se', 'dk', 'jp'];
87
+
88
+ /** Core pass: default verification set (CCPA, UK GDPR, EEA GDPR). Add the reported region when not already covered. */
89
+ export const CORE_REGIONS = ['us', 'gb', 'de'];
90
+
91
+ /** Expanded pass: escalation set covering all non-GDPR regimes plus GDPR representatives. */
92
+ export const EXPANDED_REGIONS = ['us', 'gb', 'de', 'fr', 'nl', 'pl', 'au', 'ca', 'jp'];
86
93
 
87
94
  /**
88
95
  * Build the Playwright proxy object for a region.
@@ -560,11 +567,11 @@ export async function testUrl(url, regionKey, options = {}) {
560
567
  /**
561
568
  * Test one URL across several regions.
562
569
  * @param {string} url
563
- * @param {string[]} [regions]
570
+ * @param {string[]} [regions] Defaults to the core pass; pass EXPANDED_REGIONS or ALL_REGIONS to widen.
564
571
  * @param {Partial<TestOptions>} [options]
565
572
  * @returns {Promise<TestResult[]>}
566
573
  */
567
- export async function testRegions(url, regions = DEFAULT_REGIONS, options = {}) {
574
+ export async function testRegions(url, regions = CORE_REGIONS, options = {}) {
568
575
  const results = [];
569
576
  for (const region of regions) {
570
577
  results.push(await testUrl(url, region, options));
package/AGENTS.md CHANGED
@@ -60,7 +60,7 @@ CMPs behave differently by region:
60
60
 
61
61
  Use `if`/`then`/`else` to handle regional variants within a single rule.
62
62
 
63
- **All rule changes MUST be tested across ALL supported geographic regions** to catch regional popup variations. Test from real geographic locations using available regional testing tooling (e.g. `proxy-testing` skill).
63
+ **Test all rule changes across the core region set** US, GB, DE, plus the reported region from the task (or the closest supported proxy region, e.g. ES for PT) — using the `proxy-testing` skill. Escalate to the expanded set according to the skill's policy.
64
64
 
65
65
  ### Generic vs Site-Specific Rules
66
66
 
@@ -116,14 +116,15 @@ shadow root or same-origin iframe.
116
116
 
117
117
  ### Updating existing rules
118
118
  - If an existing generic rule fails on a specific site: first look for other sites with the same failure (spec sites, data/coverage.json, publicwww). If the issue applies to more sites, update the generic rule; if the issue is truly site-specific, prefer making a site-specific rule or a config exception. Never change a generic rule to fix a site-specific implementation problem.
119
- - After updating an existing generic rule, do a heavy testing run: all known sites (specs + data/coverage.json + publicwww) using available regional testing tooling. Inspect both API results and screenshots.
119
+ - After updating an existing generic rule, do a heavy testing run: all known sites (specs + data/coverage.json + publicwww) across the expanded set. Inspect both API results AND screenshots.
120
120
  - if a site-specific rule is obsolete (the site switched CMP in ALL regions), propose removal.
121
121
  - if a popup does not provide an opt-out button, `optOut` _may_ click "dismiss"/"acknowledge" instead. Check with the existing heuristic patterns in /lib/heuristic-patterns.ts for reference.
122
122
  - do not keep outdated selectors in changed rules, unless they are actually used in some conditions
123
123
  - If the pop-up has an explicit "reject"-like button, you should first consider why HEURISTIC rule didn't handle it. A fix to the heuristic rule is always preferred to a new rule, as long as it doesn't cause potential false-positives on other sites.
124
124
 
125
125
  ### Verification guidelines
126
- - **Regional testing is mandatory** for any rule change — CMPs behave differently under GDPR (EU), CCPA (US), and other jurisdictions. Run the rule against different regions using available regional testing tooling before considering the change done.
126
+ - **Regional testing is mandatory** for any rule change — CMPs behave differently under GDPR (EU), CCPA (US), and other jurisdictions. Run the rule against different regions using `proxy-testing` skill before considering the change done. Iterate on the fix in the single most relevant region and run the verification according to the skill's policy.
127
+ - **Mobile policy**: by default test desktop across the current set's regions, plus one mobile sanity check in the region where the popup reproduces. If the mobile sanity check differs from desktop (different popup, rule, or outcome), expand mobile across the current set's regions. If the original report is from a mobile OS, test both desktop and mobile from the start.
127
128
  - When verifying a rule, **look at the screenshots** on top of the API results — sometimes a rule reports success, but the popup is not actually handled - a screenshot will detect this.
128
129
  - **Watch out for race conditions**. A common pitfall is that a rule starts clicking before JS handlers are ready. If you detect this, add an appropriate wait step before the click, preferably based on a specific DOM state. Unconditional `wait` is a LAST RESORT because it leads to a poor UX.
129
130
  - **Watch out for false positive detections**. Always verify that the rule does NOT match after the popup is dismissed and the page is reloaded. Over-detection can lead to reload loops.
@@ -183,4 +184,4 @@ After creating or modifying a rule:
183
184
  3. `npx playwright test tests/<name>.spec.ts` — run the E2E test
184
185
  4. `npm run prepublish` — full build including extension bundle
185
186
  5. Validate that the rule stops matching after the popup is dismissed and the page is reloaded (unless it's a cosmetic rule).
186
- 6. Check the rule works across all supported geographic regions using available regional testing tooling.
187
+ 6. Check the rule works across regions as per guidelines above.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # v16.18.0 (Wed Jul 29 2026)
2
+
3
+ #### Rules
4
+
5
+ - Fix Pornhub reload loop by merging compact cookie banner rule [#1463](https://github.com/duckduckgo/autoconsent/pull/1463) ([@cursoragent](https://github.com/cursoragent) [@sammacbeth](https://github.com/sammacbeth))
6
+ - Fix stale cmp rules [#1459](https://github.com/duckduckgo/autoconsent/pull/1459) ([@cursoragent](https://github.com/cursoragent) [@muodov](https://github.com/muodov))
7
+ - Fix borlabs rule [#1462](https://github.com/duckduckgo/autoconsent/pull/1462) ([@cursoragent](https://github.com/cursoragent) [@sammacbeth](https://github.com/sammacbeth))
8
+
9
+ #### AI / Agent Workflow
10
+
11
+ - Introduce test region sets [#1461](https://github.com/duckduckgo/autoconsent/pull/1461) ([@muodov](https://github.com/muodov))
12
+
13
+ #### Authors: 3
14
+
15
+ - Cursor Agent ([@cursoragent](https://github.com/cursoragent))
16
+ - Maxim Tsoy ([@muodov](https://github.com/muodov))
17
+ - Sam Macbeth ([@sammacbeth](https://github.com/sammacbeth))
18
+
19
+ ---
20
+
1
21
  # v16.17.0 (Tue Jul 28 2026)
2
22
 
3
23
  #### Rules