Repository navigation
fix(navigation): cancel loading while preserving committed content - #759
lanyue-llk wants to merge 2 commits into
Conversation
a4b6756 to
cec1eda
Compare
c052ffb to
10ff8e6
Compare
Sequential Navigation Soak A/B✅ HEAD completed the 200-navigation resilience and memory observation. One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Common ancestor Session resilience
A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence. Process-tree memory
HEAD memory by 50-navigation quarter
Raw reports and per-navigation boundary samples: workflow run and full Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold. |
Spider Bench A/B✅ All benchmark browser service runs completed; results are informational. Public HEAD: 189 / 240 rows; 39 / 48 sites produced rows; 9 unexpected empty sites. ✅ Deterministic fixture contract is clean. Common ancestor Public 48-site run · informational
Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression. CPU and memory timelinesThese are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available. Basexychart-beta
title "Base CPU"
x-axis "Elapsed seconds" [1.537, 2.538, 3.039, 4.54, 5.542, 7.045, 8.548, 10.05, 11.55, 13.052, 14.053, 15.555, 17.056, 18.559, 20.06, 21.562, 22.563, 24.064, 25.566, 27.068, 28.068, 28.569, 30.072, 31.073, 32.574, 34.075, 35.576, 37.078, 38.58, 39.581, 41.08, 42.582, 44.085, 45.587, 47.088, 48.09, 49.59, 50.091]
y-axis "CPU percent" 0 --> 500
line [115.71, 3.99, 0, 123.83, 153.68, 195.54, 173.75, 143.77, 62.03, 118.01, 131.82, 2, 2, 2, 65.94, 15.96, 11.99, 129.68, 111.73, 137.69, 110.06, 99.89, 123.77, 45.97, 139.92, 115.9, 109.96, 43.89, 3.99, 145.93, 123.88, 5.99, 9.97, 101.72, 167.86, 41.97, 104.05, 199.75]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.034, 1.537, 2.538, 3.039, 4.54, 5.542, 7.045, 8.548, 10.05, 11.55, 13.052, 14.053, 15.555, 17.056, 18.559, 20.06, 21.562, 22.563, 24.064, 25.566, 27.068, 28.068, 28.569, 30.072, 31.073, 32.574, 34.075, 35.576, 37.078, 38.58, 39.581, 41.08, 42.582, 44.085, 45.587, 47.088, 48.09, 49.59, 50.091, 50.83]
y-axis "Memory MiB" 0 --> 500
line [12.3, 99.15, 95.94, 95.95, 128.77, 135.38, 137.2, 163.46, 187.91, 189.26, 179.61, 171.67, 167.89, 150.95, 150.32, 155.5, 141.54, 139.68, 161.14, 159.07, 178.31, 284.57, 209.35, 158.49, 155.74, 188.58, 163.74, 149.22, 157.29, 153.89, 197.55, 195.64, 165.37, 157.61, 180.06, 172.3, 161.93, 177.11, 189.82, 0]
line [9.24, 95.79, 92.6, 92.6, 125.33, 131.89, 133.85, 159.98, 184.45, 185.77, 176.12, 168.18, 164.41, 147.45, 146.82, 152, 138.05, 136.19, 157.66, 155.63, 174.89, 281.93, 205.84, 155.01, 152.24, 185.1, 160.24, 145.72, 153.78, 150.38, 194.17, 192.16, 162.05, 154.11, 176.98, 169.18, 158.82, 173.98, 186.89, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.038, 1.538, 3.039, 4.042, 5.544, 7.047, 8.549, 10.05, 11.052, 12.554, 14.055, 15.557, 17.059, 18.059, 19.56, 21.063, 22.563, 24.066, 25.569, 26.57, 27.571, 28.072, 29.574, 31.074, 32.577, 33.578, 35.08, 36.581, 38.084, 39.585, 40.584, 42.086, 43.587, 45.089, 46.591, 47.593, 49.096, 50.097]
y-axis "CPU percent" 0 --> 500
line [0, 4, 19.99, 93.84, 117.78, 149.83, 163.81, 105.93, 185.82, 91.93, 53.95, 121.91, 27.98, 6, 57.87, 4, 43.99, 139.59, 157.62, 125.92, 109.76, 125.89, 101.77, 135.94, 133.88, 165.63, 154.07, 81.9, 9.97, 155.79, 62.06, 9.99, 11.99, 121.82, 159.8, 83.89, 123.88, 199.67]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.036, 1.038, 1.538, 3.039, 4.042, 5.544, 7.047, 8.549, 10.05, 11.052, 12.554, 14.055, 15.557, 17.059, 18.059, 19.56, 21.063, 22.563, 24.066, 25.569, 26.57, 27.571, 28.072, 29.574, 31.074, 32.577, 33.578, 35.08, 36.581, 38.084, 39.585, 40.584, 42.086, 43.587, 45.089, 46.591, 47.593, 49.096, 50.097, 50.489]
y-axis "Memory MiB" 0 --> 500
line [11.93, 54.14, 61.21, 75.48, 115.9, 135.76, 167.99, 189.15, 161.15, 192.14, 165.3, 174.4, 178.22, 142.98, 146.02, 157.67, 148.19, 145.67, 179.49, 153.56, 191.85, 269.71, 195.32, 224.62, 167.54, 172.39, 216.32, 152.45, 152.43, 152.43, 187.03, 160.21, 151.7, 144.31, 158.17, 153.96, 152.46, 171.68, 180.73, 0]
line [8.71, 50.63, 57.7, 72.04, 112.4, 131.46, 164.47, 185.64, 157.6, 188.9, 161.9, 170.96, 173.58, 139.72, 142.75, 154.4, 144.92, 142.4, 176.22, 150.33, 188.64, 266.14, 192.08, 221.35, 164.28, 169.12, 213.51, 149.19, 149.63, 149.17, 181.97, 157.63, 148.42, 141.03, 155.56, 152.65, 149.08, 168.33, 177.3, 0]
Deterministic fixture · required contractThe fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.
Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking. |
CI Regression ReportSource CI run · source state at render:
Release regression — ✅ HEAD/base failures 0/0; raw binary +0.003219%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 50/50 groups passed; 574 scenariosWorkers: 4 · cumulative group time: 131.83 s · failed groups: 0
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Frozen HTML · Linux · Diagnostics: All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable. |
19f651f to
7649f13
Compare
10ff8e6 to
ae716d0
Compare
7649f13 to
6185ba5
Compare
ae716d0 to
126ada4
Compare
008b31d to
2009cd7
Compare
126ada4 to
acb4171
Compare
停止加载应终止当前未完成的加载,同时保留已经提交的页面内容。旧路径混淆 provisional 导航失败、已提交文档停止解析与网络资源退役,可能把用户主动停止变成错误页,清除部分 DOM,或让旧 stylesheet/load 回调继续改变新文档生命周期。
一图看懂
图示说明问题、修复机制与行为边界;点击可查看原图。验收归属不等于当前提交通过结果,版本和测试证据见下文。
行为契约与根因
根因是多个生命周期的取消/退役被混用。本 PR 将 typed cancellation、传输取消、parser 退役和文档 load gate 的 lease 结算分别放在所属 owner 中处理,不靠错误字符串或统一清空页面绕过状态管理。
机制与代码阅读路线
moli-protocol/src/domains/page/termination.rs、conn/state/page_slot.rs/runtime_slot.rs:stop 命令、target-local 取消与完成 token。conn/runtime_load.rs和network/main_document_progress/mod.rs:保留 typed failure/cancellation 来源,主动取消不生成错误页;保持 main 的原始字节及 XML 解码语义。runtime/phase_one/、owner_local_store/entry.rs、live_document_parser.rs:停止未提交加载或保留 committed partial document;明确区分 explicit stop 与普通 body 退役。frame_owner_model/load_event_gate.rs、lifecycle_blockers.rs、store.rs与 stylesheet task:用精确 lease/owner 结算异步任务,不能按当前文档名字或全局计数结算旧回调。28 个改动文件共同处理跨层生命周期;审查重点是各 owner 的状态迁移,而不是把 stop 的所有行为塞进一个协议函数。大段状态处理需同时看反例测试,确认正常完成、普通退役、真正失败没有被取消分支吞掉。
回归用例
runtime_load.rs::provisional_body_failure_preserves_typed_source_and_context/provisional_body_failure_does_not_infer_cancellation_from_error_textruntime_load.rs::response_capture_survives_ordinary_renderer_body_retirementpage_slot.rs::navigation_cancellation_preserves_completion_token_and_is_target_localphase_one/streaming_input.rs::external_body_transfer_is_cancelled_only_by_explicit_stopruntime/tests/open_streaming.rs::explicit_stop_retires_open_parser_and_preserves_committed_partial_documentload_event_gate.rs::stop_cancels_only_outstanding_exact_leases_without_reopening_load/retirement_discards_cancelled_leases验收与依赖
本 PR 没有独立认领历史 35 题,以以上 stop/loading 功能契约验收。不能用其他分区的 badcase 成功代替本 PR 的状态迁移测试。
当前 HEAD
dba00e5ccafa707c02ed529e5a4bfc202ba47b49,直接 base 为 main。CI 36571471129 19/19 成功。与当前 main 无冲突,因此保持原 PR 与该提交,不为追赶最新 main 再次重写已验证提交。来源:原停止加载 PR #738。Reviewer 复现:停止加载的独立场景
本 PR 没有分配那 35 个历史 badcase。验收应检查 Stop 的状态变化,不能拿 #756/#758 的成功题目替代。下面在本 PR checkout 运行,不需要 WebArena:
cargo nextest run --no-fail-fast -p moli-renderer-v8 -p moli-protocol \ -E 'test(explicit_stop_retires_open_parser_and_preserves_committed_partial_document) | test(navigation_cancellation_preserves_completion_token_and_is_target_local) | test(stop_cancels_only_outstanding_exact_leases_without_reopening_load) | test(stopped_document_style_event_cannot_settle_replacement_document) | test(response_capture_survives_ordinary_renderer_body_retirement) | test(provisional_body_failure_does_not_infer_cancellation_from_error_text)'prefix,保持响应未结束,Stop 后再送入 tail。结果应为 `committed prefixstill live,页面 owner 没被销毁测试使用可控流和回调顺序,不依赖外部网站延迟。主要流式场景源码见 open_streaming.rs。完整指南 也列出了三项 PR 的命令和预期。
Reviewer 重点
取消发生在提交前/后是否都保留正确文档?错误与取消是否通过类型区分?普通退役是否仍允许网络 capture?停止后到达的异步回调是否只能结算其原 owner,既不重开 load,也不污染新文档或其他 target?
整组验收与证据入口
这组修复来自 #640,对应 1.1.9 的 34 个失败 case,加上 1.1.8 已失败的 386,共 35 个唯一 case。按最终职责分配为:#756 布局 27、#757 输入 4、#758 网络 3、#761 文本 1;#755、#759、#760 以各自独立功能契约验收,不重复认领这 35 个 case。