Skip to content

test(profile): regenerate seed profile (FF150-primed, uBlock) + assert extension startup#1189

Open
vringar wants to merge 1 commit into
masterfrom
test/profile-baseline-regen
Open

test(profile): regenerate seed profile (FF150-primed, uBlock) + assert extension startup#1189
vringar wants to merge 1 commit into
masterfrom
test/profile-baseline-regen

Conversation

@vringar

@vringar vringar commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Closes #1188.

What

Make the seed profile fixture (test/profile.tar.gz) a meaningful cross-version profile-compatibility check and reproducible, and strengthen the restoration tests to assert a baked-in extension actually starts up after load/recovery.

This PR is based on the FF150 -> FF151 bump branch so CI exercises the real check (FF151 loading a FF150-primed profile). It rebases cleanly onto master once the bump lands.

N-1 priming rationale

The seed profile exists to confirm Firefox N can read a profile primed by the previous Firefox (N-1) — catching extension-signing / manifest / startup regressions that show up across version bumps. The committed fixture was written by Firefox 137.0.2 (~13 versions stale), so it tested nothing. The new baseline is primed with Firefox 150.0.2 (the previous stable), so the FF151 bump's CI exercises a genuine 150 -> 151 restoration.

The workflow is now documented in docs/Release-Checklist.md: just before bumping the pin from N-1 to N, regenerate the fixture with Firefox N-1 and commit it.

Changes

  1. scripts/regenerate-test-profile.py (new) — Selenium script that launches Firefox (FIREFOX_BINARY from env), sets test_pref=True, installs uBlock Origin from AMO as a permanent addon (so it persists in the dump), warms up history, and writes test/profile.tar.gz. The signed XPI is resolved via the AMO v5 API (current_version.file.url) and installed with driver.install_addon(path, temporary=False). It verifies uBlock is active via the privileged AddonManager, then prunes transient caches (startupCache/cache2/safebrowsing/favicons) before archiving. The live AMO call runs only here, out-of-band — CI never touches addons.mozilla.org.

  2. Regenerated test/profile.tar.gz — now Firefox 150.0.2-primed, contains uBlock Origin 1.71.0 (installed + active) and test_pref=true.

  3. Strengthened test/test_profile.py — new AssertExtensionActiveCommand queries the live AddonManager for the addon's state and asserts it is installed AND isActive, proving startup (not just file presence). Wired into test_seed_persistence (always) and test_profile_recovery (when seed_tar is set). Existing pref/history assertions are kept. No live AMO call in the test path.

  4. Docs — script header documents the regeneration procedure; docs/Release-Checklist.md gains a pre-bump step.

Verification

The strengthened tests pass on both Firefox versions, including the new uBlock-startup assertion:

Firefox test_seed_persistence test_profile_recovery (with_seed_tar)
150.0.2 (priming/baseline) PASS PASS (on_normal_operation)
151.0.4 (the real N-1 -> N check) PASS PASS (on_normal_operation, on_crash)

Copilot AI review requested due to automatic review settings June 15, 2026 21:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the seed Firefox profile fixture (test/profile.tar.gz) a meaningful cross-version compatibility check by priming it with Firefox N-1 and baking in a real extension (uBlock Origin), then strengthening restoration tests to assert the extension is actually active after load/recovery.

Changes:

  • Add a regeneration script to reproducibly build the seed profile by installing uBlock Origin from AMO, warming history, pruning transient caches, and archiving.
  • Strengthen profile restoration tests by adding a command that queries AddonManager to assert the baked-in extension is installed and active.
  • Update Firefox deployment to support privileged chrome-context querying and update release docs/workflow around regenerating the seed profile before bumps.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/test_profile.py Adds uBlock addon ID constant and a new command asserting addon installed+active via AddonManager; updates pref-read to use chrome context.
scripts/regenerate-test-profile.py New out-of-band script to generate the seed profile fixture with a permanent uBlock install and required state.
scripts/install-firefox.sh Updates the pinned Firefox tag to 151.0.4 release.
openwpm/deploy_browsers/deploy_firefox.py Adds -remote-allow-system-access to enable privileged chrome-context operations.
docs/Release-Checklist.md Documents the pre-bump step to regenerate and commit the seed profile fixture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +54 to +59
# Allow WebDriver to access the parent process and privileged Gecko APIs
# (e.g. switching to the chrome context). Firefox 138+ gates this behind an
# explicit launch flag; without it commands such as reading preferences via
# the chrome context fail with "System access is required".
# https://firefox-source-docs.mozilla.org/remote/Security.html
fo.add_argument("-remote-allow-system-access")
Comment thread test/test_profile.py
return false;
}}
""")
self.logger.error(f"Got result: {result}")
Comment on lines +95 to +98
xpi_path = dest_dir / f"ublock_origin-{version}.xpi"
urllib.request.urlretrieve(xpi_url, xpi_path)
print(f"Saved XPI to {xpi_path} ({xpi_path.stat().st_size} bytes)")
return xpi_path
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.44444% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.03%. Comparing base (12597cc) to head (01f62a8).

Files with missing lines Patch % Lines
test/test_profile.py 44.44% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1189      +/-   ##
==========================================
- Coverage   62.11%   62.03%   -0.09%     
==========================================
  Files          40       40              
  Lines        3907     3925      +18     
==========================================
+ Hits         2427     2435       +8     
- Misses       1480     1490      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vringar vringar force-pushed the test/profile-baseline-regen branch from 3c5343f to e235988 Compare June 15, 2026 21:27
@vringar vringar force-pushed the test/profile-baseline-regen branch from e235988 to 01f62a8 Compare June 15, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strengthen profile-restoration tests + reproducible baseline regeneration (assert extension startup; prime with N-1 Firefox)

2 participants