[PR #3143] [CLOSED] fix(browser): explain attached service-worker policy refusals #5640

Closed
opened 2026-10-31 01:08:11 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3143
Author: @jpdefo
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/service-worker-policy-diagnostic


📝 Commits (2)

  • 3d249e1 fix(browser): explain service-worker policy refusals
  • 0528177 fix(browser): distinguish unavailable guard recovery

📊 Changes

9 files changed (+54 additions, -5 deletions)

View changed files

📝 docs/browser-scenario-contract.md (+4 -0)
📝 scripts/lib/browser-scenario-service-workers-e2e.mjs (+2 -2)
📝 src/browser/PlaywrightScenarioServiceWorkers.ts (+4 -1)
📝 src/browser/PlaywrightScenarioSession.test.ts (+5 -2)
📝 src/domain/analysisErrorPresentation.ts (+1 -0)
📝 src/domain/analysisErrorProjection.test.ts (+34 -0)
📝 src/domain/analysisErrorProjection.ts (+1 -0)
📝 src/domain/browserObservationError.ts (+2 -0)
📝 src/domain/browserObservationErrors.ts (+1 -0)

📄 Description

Summary

Fixes #3126. Attached browser scenarios that cannot satisfy the existing service-worker block policy now return service_worker_policy_rejected with recovery guidance naming environment.service_workers, instead of the unrelated rea doctor recommendation.

Problem and expected behavior

An attached page with a controlling or registered worker is correctly refused under block, but the existing generic target_not_allowed error hides the cause and the caller's recovery options. The same boundary also refuses when REA cannot verify its registration guard. The diagnostic must preserve that uncertainty rather than assert that a worker definitely exists.

Change and scope

The policy owner emits one truthful policy-rejection reason. Shared domain projection keeps the top-level target_unavailable code and unavailable category. The message distinguishes worker removal from an unavailable registration guard, provides the existing allow option, and states that REA does not remove caller registrations. Both affected real-browser verifier expectations and the owning contract documentation are updated.

Related PR #3140 addresses the same issue. This independently implemented alternative retains the existing guard-first evaluation and frame protocol. In the current #3140 head b0ab3c5f550bf499f8d5f8aaba0f975cda3f7b24, separate reasons improve cause specificity, but registration discovery precedes guard verification. That adds a dependency on enumeration succeeding before a missing guard can be reported. This patch keeps the existing short circuit and has completed the focused real Edge CLI/MCP and service-worker verification described below. No claim is made that these executions validate #3140's different implementation.

Contract and boundary impact

  • Semantic owner and earliest changed stage: PlaywrightScenarioServiceWorkers.assertBlocked, at its existing refusal boundary.
  • Contribution scope fit and maintainer decision: routine diagnostic fix within the existing capability. Advance scope decision is not applicable.
  • CLI and MCP/tool catalog: this refusal changes details.reason to service_worker_policy_rejected. Request schemas, top-level code/category, and unrelated authorization refusals retain their current contracts.
  • Provider/platform and Evidence: browser scenario diagnostics only. Target selection, policy enforcement, partial observations, registration ownership, and cleanup behavior are preserved.
  • Generated metadata/package/install: no dependency, schema catalog, or package metadata changes.
  • Effects added by this diff: diagnostic and documentation changes. No additional target interaction or authority.

Evidence and regression coverage

  • Original main 58300885207133422af235e0f2b10658cf958b03, native Windows, Node 24.18.0, Edge 155.0.4283.45: a self-owned loopback page and disposable profile reproduced the generic CLI block refusal. The allow control succeeded, and the registration survived cleanup.
  • Session regressions retain refusals for existing registrations and an unverified guard. Projection coverage checks actionable guidance, schema validity, non-retryability, and unchanged unrelated target_not_allowed behavior.
  • Patched public CLI and MCP: block returns target_unavailable / service_worker_policy_rejected with recovery guidance. Allow succeeds, the existing registration survives cleanup, and default block succeeds on a no-worker page.
  • The complete verifyScenarioServiceWorkers module passed against the patched runtime on actual Edge. This is the service-worker lane, not a claim that the entire composite browser verifier or all platforms passed.

Validation performed

  • npm run build:cached: passed.
  • Focused source tests for PlaywrightScenarioSession, PlaywrightScenarioBrowser, PlaywrightBrowserScenarioProvider, and analysisErrorProjection: 95 passed.
  • npm run check: passed, including types, lint, format, module boundaries, and architecture guards.
  • npm run docs:check: passed, including five README consistency tests.
  • Actual Edge CLI/MCP controls and the full service-worker verification module: passed.
  • git diff --check: passed.
  • Four independent Luna reviews and one Sol review in medium: final frozen diff reviewed after fixes.

Compatibility, safety, and release

  • Callers matching this specific reason should accept service_worker_policy_rejected. Existing request shapes and top-level failure code/category do not change.
  • Real-provider coverage is Windows x64 and Edge 155. No Hopper, Ghidra, IDA, other OS, or full-suite qualification is claimed.
  • No package or release metadata change. REA still does not remove caller-owned registrations or relax the default policy.

Before merge

  • Concrete problem and linked issue.
  • Existing scope and authority preserved.
  • One focused outcome and Conventional Commit title.
  • Meaningful regression and real-provider coverage.
  • Owning contract documentation updated.
  • Representative CLI/MCP outcomes reported.
  • Final diff checked for unrelated changes, secrets, and unsupported claims.
  • Required hosted checks passed on the published revision.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3143 **Author:** [@jpdefo](https://github.com/jpdefo) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/service-worker-policy-diagnostic` --- ### 📝 Commits (2) - [`3d249e1`](https://github.com/morluto/rea/commit/3d249e15bd07051093ff19f9bfa2b2efe1a51ea5) fix(browser): explain service-worker policy refusals - [`0528177`](https://github.com/morluto/rea/commit/052817753246df44a77e6e4ed36459d2f2c33e6c) fix(browser): distinguish unavailable guard recovery ### 📊 Changes **9 files changed** (+54 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/browser-scenario-contract.md` (+4 -0) 📝 `scripts/lib/browser-scenario-service-workers-e2e.mjs` (+2 -2) 📝 `src/browser/PlaywrightScenarioServiceWorkers.ts` (+4 -1) 📝 `src/browser/PlaywrightScenarioSession.test.ts` (+5 -2) 📝 `src/domain/analysisErrorPresentation.ts` (+1 -0) 📝 `src/domain/analysisErrorProjection.test.ts` (+34 -0) 📝 `src/domain/analysisErrorProjection.ts` (+1 -0) 📝 `src/domain/browserObservationError.ts` (+2 -0) 📝 `src/domain/browserObservationErrors.ts` (+1 -0) </details> ### 📄 Description ## Summary Fixes #3126. Attached browser scenarios that cannot satisfy the existing service-worker block policy now return `service_worker_policy_rejected` with recovery guidance naming `environment.service_workers`, instead of the unrelated `rea doctor` recommendation. ## Problem and expected behavior An attached page with a controlling or registered worker is correctly refused under `block`, but the existing generic `target_not_allowed` error hides the cause and the caller's recovery options. The same boundary also refuses when REA cannot verify its registration guard. The diagnostic must preserve that uncertainty rather than assert that a worker definitely exists. ## Change and scope The policy owner emits one truthful policy-rejection reason. Shared domain projection keeps the top-level `target_unavailable` code and `unavailable` category. The message distinguishes worker removal from an unavailable registration guard, provides the existing `allow` option, and states that REA does not remove caller registrations. Both affected real-browser verifier expectations and the owning contract documentation are updated. Related PR #3140 addresses the same issue. This independently implemented alternative retains the existing guard-first evaluation and frame protocol. In the current #3140 head `b0ab3c5f550bf499f8d5f8aaba0f975cda3f7b24`, separate reasons improve cause specificity, but registration discovery precedes guard verification. That adds a dependency on enumeration succeeding before a missing guard can be reported. This patch keeps the existing short circuit and has completed the focused real Edge CLI/MCP and service-worker verification described below. No claim is made that these executions validate #3140's different implementation. ## Contract and boundary impact - Semantic owner and earliest changed stage: `PlaywrightScenarioServiceWorkers.assertBlocked`, at its existing refusal boundary. - Contribution scope fit and maintainer decision: routine diagnostic fix within the existing capability. Advance scope decision is not applicable. - CLI and MCP/tool catalog: this refusal changes `details.reason` to `service_worker_policy_rejected`. Request schemas, top-level code/category, and unrelated authorization refusals retain their current contracts. - Provider/platform and Evidence: browser scenario diagnostics only. Target selection, policy enforcement, partial observations, registration ownership, and cleanup behavior are preserved. - Generated metadata/package/install: no dependency, schema catalog, or package metadata changes. - Effects added by this diff: diagnostic and documentation changes. No additional target interaction or authority. ## Evidence and regression coverage - Original main `58300885207133422af235e0f2b10658cf958b03`, native Windows, Node 24.18.0, Edge 155.0.4283.45: a self-owned loopback page and disposable profile reproduced the generic CLI block refusal. The allow control succeeded, and the registration survived cleanup. - Session regressions retain refusals for existing registrations and an unverified guard. Projection coverage checks actionable guidance, schema validity, non-retryability, and unchanged unrelated `target_not_allowed` behavior. - Patched public CLI and MCP: block returns `target_unavailable` / `service_worker_policy_rejected` with recovery guidance. Allow succeeds, the existing registration survives cleanup, and default block succeeds on a no-worker page. - The complete `verifyScenarioServiceWorkers` module passed against the patched runtime on actual Edge. This is the service-worker lane, not a claim that the entire composite browser verifier or all platforms passed. ## Validation performed - `npm run build:cached`: passed. - Focused source tests for `PlaywrightScenarioSession`, `PlaywrightScenarioBrowser`, `PlaywrightBrowserScenarioProvider`, and `analysisErrorProjection`: 95 passed. - `npm run check`: passed, including types, lint, format, module boundaries, and architecture guards. - `npm run docs:check`: passed, including five README consistency tests. - Actual Edge CLI/MCP controls and the full service-worker verification module: passed. - `git diff --check`: passed. - Four independent Luna reviews and one Sol review in medium: final frozen diff reviewed after fixes. ## Compatibility, safety, and release - Callers matching this specific reason should accept `service_worker_policy_rejected`. Existing request shapes and top-level failure code/category do not change. - Real-provider coverage is Windows x64 and Edge 155. No Hopper, Ghidra, IDA, other OS, or full-suite qualification is claimed. - No package or release metadata change. REA still does not remove caller-owned registrations or relax the default policy. ## Before merge - [x] Concrete problem and linked issue. - [x] Existing scope and authority preserved. - [x] One focused outcome and Conventional Commit title. - [x] Meaningful regression and real-provider coverage. - [x] Owning contract documentation updated. - [x] Representative CLI/MCP outcomes reported. - [x] Final diff checked for unrelated changes, secrets, and unsupported claims. - [ ] Required hosted checks passed on the published revision. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5640
No description provided.