Repository navigation
fix(web-shell): preserve authentication fragment on offline retry - #13176
Conversation
|
I reproduced and verified this with the actual service worker and a real Retry click in Chromium 151 on Windows.
Each scenario exercised the real HTTP 503 fallback before restoring the local server. Synthetic fragment tokens appeared in neither server request URLs nor fallback HTML. The same permanent unit tests give 20 passed / 1 failed against the original worker and 21 passed against the fix; the sole failing baseline case is the new Retry regression. The normal package-config focused run also passes all 21 cases. Lint, formatting, JavaScript syntax, focused test TypeScript checking and whitespace checks pass. Scope: a minimal loopback online-page fixture with the product worker, Node 22.21.1 and Playwright 1.52.0. This does not exercise a full daemon authentication handshake, the React application or Android WebView. The global CLI is unavailable, and the complete workspace build/type check remains for CI because the isolated runtime lacks the full workspace dependencies. |
|
Verdict: merge-ready — 110/110 scripted assertions passed, 0 failed. Verified head 中文摘要结论:merge-ready(可合并)——110/110 条脚本断言全部通过。
Central claim and A/B proofClaim: on the offline Web Shell 503 fallback page, the Harness: real Chrome 154.0.8037.97 (Playwright, system Chrome channel) + the arm's own
All runs: SW controls the page, the real 503 fallback renders (not the browser error page), the recovered page is the real online page, and the auth token appears in no server request and no fallback HTML (fragments never reach the wire). 30/30 scripted checks per arm, repeated twice per arm with identical outcomes. The fallback page rendered by the SW (base and head screenshots are byte-identical, sha256 Load-bearing proof of the new regression testThe PR's new test (
So the test is red exactly against the un-fixed worker and green with it. Gates
FindingsNone. The change is one line, the mechanism does what the description says, and no sibling surface exists (the fallback page has a single link; the inline handler runs because the SW-served 503 sets no CSP — verified empirically by the reload actually executing). With scripting disabled the link degrades to the old One scope note, not a defect: the new unit test pins the handler's shape (parses the real fallback HTML, executes the real Not covered
MethodologyTwo detached worktrees at the resolved Local verification by @wenshao (maintainer-driven, advisory evidence — not a review approval). |
|
@wenshao Thank you for the independent browser A/B verification and for checking that the new regression test fails against the original worker. Your Chrome results complement my earlier Chromium verification without extending the claim to the full daemon authentication flow or Android WebView. I will keep head |






What this PR does
Retry on the offline Web Shell page reloads the current document and cancels the empty-link navigation. This preserves the complete address, including an existing authentication fragment, while keeping the fragment out of the worker response and network requests.
Why it's needed
After the worker displays its real 503 fallback, the previous Retry link drops the authentication fragment when the daemon becomes available again. This is the small Web Shell follow-up described in F3 on the merged Android profile PR.
Reviewer Test Plan
How to verify
Open a Web Shell address with query parameters and an authentication fragment, wait for worker control, stop the daemon and reload until the bilingual 503 page appears. Restore the daemon and click Try again. The recovered address should exactly match the original, including the fragment. Repeat with an encoded fragment on a nested path and with no fragment. The fallback HTML and server requests should contain no fragment token.
Evidence (Before & After)
I reproduced and verified the actual worker in Chromium 151 using a minimal loopback online-page fixture. Before the change, both ordinary and encoded fragments disappeared after Retry; after the change, all three recovered addresses exactly matched their originals. Path and query parameters remained intact, the real 503 fallback was used, and synthetic tokens appeared in neither server URLs nor fallback HTML.
All 21 service-worker tests pass. With the same permanent tests and the original worker, the 20 existing cases pass and the new regression fails; only replacing the worker with the fix makes all 21 pass. The new regression test parses the actual fallback HTML and executes its retry handler, requiring one reload and cancellation of link navigation. ESLint, Prettier, JavaScript syntax checking, focused TypeScript checking of the test, and whitespace checking pass.
Tested on
Environment
Relevant dependencies in an isolated unit-test runtime. The browser harness used the exact product worker with synthetic fragments and a minimal local server. The global CLI is unavailable. Full daemon authentication, the React application and Android WebView were not exercised.
Risk & Scope
cross-env; the Web Shell type check failed on missing workspace SDK and application dependencies. Complete build/type checking remains for upstream CI.Linked Issues
Follow-up to #12121; refs #11704. This addresses only the reported Retry fragment loss.
中文说明
本 PR 的改动
离线 Web Shell 页面的重试操作会重新加载当前文档,并取消空链接导航。这样保留完整地址及已有认证片段,同时不将片段写入 worker 响应或网络请求。
为什么需要
worker 显示真实的 503 回退页面后,守护进程恢复可用时,之前的重试链接会丢失认证片段。这是已合并 Android 配置 PR 的 F3 所描述的小范围 Web Shell 后续修复。
评审测试计划
如何验证
打开包含查询参数和认证片段的 Web Shell 地址,等待 worker 控制页面,停止守护进程并重新加载,直到双语 503 页面出现。恢复守护进程后点击重试。恢复后的地址应与原始地址完全一致,包括片段。对嵌套路径中的编码片段和无片段地址重复验证。回退 HTML 和服务器请求均不应包含片段 token。
证据(修改前后)
我在 Chromium 151 中使用最小回环在线页面夹具,对实际 worker 进行了复现和验证。修改前,普通片段和编码片段均在重试后丢失;修改后,三个恢复地址都与原始地址完全一致。路径和查询参数保持不变,测试使用真实的 503 回退页面,合成 token 未出现在服务器 URL 或回退 HTML 中。
全部 21 个 service-worker 测试通过。使用相同的永久测试和原始 worker 时,20 个现有用例通过,新增回归用例失败;仅替换为修复后的 worker,全部 21 个用例才通过。新增回归测试解析实际回退 HTML 并执行重试处理程序,要求重新加载一次并取消链接导航。ESLint、Prettier、JavaScript 语法检查、针对测试的 TypeScript 检查和空白检查通过。
测试平台
环境
使用安装相关依赖的独立单元测试环境。浏览器测试使用实际产品 worker、合成片段和最小本地服务器。本地无全局 CLI。未执行完整守护进程认证、React 应用或 Android WebView 流程。
风险与范围
cross-env,完整工作区构建无法启动;Web Shell 类型检查因缺少工作区 SDK 和应用依赖而失败。完整构建和类型检查仍需上游 CI。关联 Issue
#12121 的后续修复;关联 #11704。本 PR 仅处理已报告的重试片段丢失。