test(website-policy): cover policy and cache boundaries - #52082
Christopher-Schulze wants to merge 3 commits into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for expanding coverage of the website-policy helper.
Problems
tests/tools/test_website_policy.py:850does not verify the claimed fast path. A normal load of the disabled policy also returnsNone; make the skipped work observable by making_extract_host_from_urlishorload_website_blocklistfail after the cache is primed. The branch being targeted istools/website_policy.py:243-248.- The cache test at
tests/tools/test_website_policy.py:610uses only oneHERMES_HOME. Current main fixed cross-profile stale cache reuse ind91083b2fby keying the cache on the real default config path, so a two-home cache-miss regression test is needed.
Suggested changes
- Add a second-home assertion to the cache test and make the disabled-cache early return directly observable.
Automated hermes-sweeper review.
5230056 to
e73daa2
Compare
|
Addressed both findings. The disabled-policy fast-path test now fails if host extraction or policy loading runs after the cached disabled result, and the cache regression switches between two HERMES_HOME profiles without invalidation and requires only the second profile's rules. The full file passes 68 tests at 98% module coverage, and all blocking contributor gates pass. |
4f28b3c to
a36eb64
Compare
Maintenance updateRebased onto current Head: |
a36eb64 to
015d4ca
Compare
015d4ca to
a1607b7
Compare
|
Rebased this existing PR onto current main at f43eabe and refreshed the test surface after the upstream cleanup commit fda54a6. Current main removed the former website-policy test file because its async/process lifecycle tests were flaky under parallel CI; this update replaces that stale diff with deterministic pure-unit coverage.
The PR was updated in place; no new PR was opened and no merge was performed. |
5510a5e to
067e7f3
Compare
067e7f3 to
e4f93ab
Compare
e4f93ab to
02133f9
Compare
What does this PR do?
Add focused, deterministic regression coverage for the website policy parser, matcher, access decisions, and profile-aware cache boundaries.
The cache tests now switch between two
HERMES_HOMEprofiles without explicit invalidation and require the second profile's rules. The disabled-policy fast-path test also makes host extraction and policy loading fail if either is called after the disabled result is cached.The branch is rebased onto the current default branch. Upstream's current-main cleanup removed the former flaky website-policy test file, so this update keeps the coverage in a lean pure-unit suite without async provider or browser lifecycle dependencies.
Related Issue
Fixes #36604
Issue #36604 identified broad gaps in
tools/website_policy.py. The previous version of this PR did not prove that a cached disabled decision returned before all downstream work, and its one-profile cache test did not protect profile isolation.Type of Change
Changes Made
tests/tools/test_website_policy.py: adds parser, matcher, access-decision, error-boundary, disabled fast-path, and cross-profile cache-isolation regressions.How to Test
tools/website_policy.py; branch coverage was not collected by that run, with lines 196-197 remaining uncovered.Checklist