Repository navigation
fix(html2md): preserve media resources and readable controls - #1334
lanyue-llk wants to merge 7 commits into
Conversation
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: 184 / 240 rows; 38 / 48 sites produced rows; 10 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.035, 2.537, 3.538, 4.538, 6.04, 7.04, 8.041, 9.543, 10.545, 11.546, 13.048, 14.05, 15.052, 16.553, 17.555, 18.557, 20.058, 21.059, 21.56, 22.061, 23.561, 24.562, 25.563, 27.065, 28.064, 29.066, 30.566, 31.567, 32.568, 34.071, 35.072, 35.572, 36.073, 37.575, 38.575, 39.576, 41.077, 41.576]
y-axis "CPU percent" 0 --> 200
line [9.98, 85.82, 105.99, 145.95, 125.88, 86.02, 123.98, 87.83, 83.82, 131.85, 3.99, 57.88, 157.74, 13.97, 21.96, 39.91, 112, 105.93, 101.79, 107.71, 126.05, 103.97, 127.97, 115.84, 112.02, 97.87, 92.04, 5.99, 87.91, 63.87, 17.98, 0, 15.99, 107.95, 107.88, 41.95, 129.85, 162.05]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.034, 1.035, 2.537, 3.538, 4.538, 6.04, 7.04, 8.041, 9.543, 10.545, 11.546, 13.048, 14.05, 15.052, 16.553, 17.555, 18.557, 20.058, 21.059, 21.56, 22.061, 23.561, 24.562, 25.563, 27.065, 28.064, 29.066, 30.566, 31.567, 32.568, 34.071, 35.072, 35.572, 36.073, 37.575, 38.575, 39.576, 41.077, 41.576, 41.827]
y-axis "Memory MiB" 0 --> 500
line [13.01, 68.64, 104.85, 119.67, 130.6, 143.8, 137.38, 160.56, 132.83, 134.97, 138.03, 116.73, 127.81, 141.96, 135.89, 132.52, 141.43, 130.09, 185.7, 253.88, 233.23, 179.94, 213.24, 163.29, 164.49, 142.37, 133.96, 141.84, 128.75, 156.95, 141.35, 142.41, 142.16, 129.89, 152.63, 162.02, 133.87, 166.01, 162.95, 0]
line [9.75, 65.07, 101.31, 116.44, 127.15, 140.17, 133.79, 157.13, 129.2, 131.34, 134.94, 113.09, 124.12, 138.4, 132.13, 128.99, 137.75, 126.06, 181.9, 250.1, 228.69, 176.11, 211.74, 159.51, 159.7, 138.77, 130.18, 138.15, 125.01, 153.24, 137.88, 138.67, 138.43, 126.16, 149.03, 158.39, 130.17, 162.25, 159.22, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.036, 2.538, 3.539, 5.04, 6.042, 7.542, 8.543, 10.044, 11.044, 12.044, 13.546, 14.048, 14.548, 16.05, 17.051, 18.552, 19.553, 21.056, 22.057, 23.058, 23.559, 24.56, 25.562, 27.065, 28.067, 29.568, 30.569, 32.07, 33.071, 34.072, 35.574, 36.575, 38.077, 39.078, 40.58, 41.081, 41.581, 43.083]
y-axis "CPU percent" 0 --> 200
line [13.99, 102.01, 111.94, 125.76, 135.93, 146.01, 63.95, 113.89, 133.98, 12, 5.99, 0, 5.99, 2, 103.82, 27.98, 39.93, 65.95, 87.84, 111.89, 103.75, 113.94, 115.8, 135.78, 123.66, 114.02, 97.87, 103.89, 33.98, 77.92, 101.95, 89.82, 5.99, 39.96, 105.87, 165.8, 13.98, 127.76]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.036, 1.036, 2.538, 3.539, 5.04, 6.042, 7.542, 8.543, 10.044, 11.044, 12.044, 13.546, 14.048, 14.548, 16.05, 17.051, 18.552, 19.553, 21.056, 22.057, 23.058, 23.559, 24.56, 25.562, 27.065, 28.067, 29.568, 30.569, 32.07, 33.071, 34.072, 35.574, 36.575, 38.077, 39.078, 40.58, 41.081, 41.581, 43.083, 43.644]
y-axis "Memory MiB" 0 --> 500
line [13.29, 73.05, 109.96, 124.11, 154.18, 149.13, 141.33, 120.55, 143.2, 135.38, 131.52, 120.27, 120, 119.12, 124.25, 145.51, 117.83, 121.06, 162.57, 147.16, 181.05, 249.43, 179.52, 193.83, 169.31, 153.98, 151.88, 135.35, 147.48, 140.27, 173.28, 235.09, 241.83, 132.83, 136.45, 160.45, 158.3, 129.32, 165.95, 0]
line [9.75, 69.38, 106.08, 121.16, 150.32, 145.27, 137.46, 116.71, 139.38, 131.56, 127.64, 116.39, 116.12, 115.24, 120.34, 142.23, 113.96, 117.19, 158.64, 143.28, 177.18, 246.43, 176.2, 190, 165.44, 150.09, 148, 131.53, 143.66, 136.45, 169.42, 231.89, 238.09, 129.07, 132.69, 157.06, 154.54, 125.47, 162.33, 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.008117%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ❌ 1,017/1,020 cases matched; 3 issues; 1 Chromium reference recoveries
Recovered Chromium reference infrastructure failures
First failing cases
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 52/52 groups passed; 621 scenariosWorkers: 4 · cumulative group time: 210.64 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. |
d9695fe to
99cc40c
Compare
99cc40c to
7c4e732
Compare
|
Closing after the consolidation audit. This belongs to an earlier experimental Markdown stack and was not part of the measured fixed build. Current failure evidence does not justify carrying its broad content heuristics into #1501, so it is intentionally not merged. |
7c4e732 to
e24bc41
Compare
lanyue-llk
left a comment
There was a problem hiding this comment.
The PR makes moli-html2md keep more of what a page shows: alt text for images that have no usable source, srcset/lazy-load image candidates, links for <iframe>/<video>/<audio> sources, form-control text (with password, hidden and file inputs left out), <select>/<option> boundaries, and an aria-label/title fallback for empty elements. It also filters link/image URLs by scheme. The image work is careful. srcset follows the WHATWG grammar, standard sources come before lazy attributes, and alt text survives a missing source. That part is principled.
Assessment: request changes. Several heuristics are broader than their tests. The generic label fallback can drop this PR's own media output. <time> and <button> are forced onto new lines, which turns into <br> inside GFM table cells. Form "current state" comes from default content attributes. The live-value hook has no implementation in this PR.
Overlap with main / other PRs
origin/mainhas no html2md changes since this PR's merge basef702d9a6, so nothing on main is equivalent or textually conflicting. GitHub reports MERGEABLE. The one file main changed,moli/tests/fetch_cli/http_fail.rs(subprocess helper moved tosuper::subprocess), merges cleanly.- #1591 (open,
fix(html2md): preserve visible labels and literal preformatted text) duplicates and conflicts with this PR, in the samemachine.rsmatch arms:- It adds its own
"video" | "audio"and"source" | "track"resource links. Its labels differ ("Video poster" vs an empty alt here), and it handles<source>as a standalone element, not as a media child. - It adds
resource_url(), which is nearly the same asmedia::safe_url()here (same scheme allowlist, same control-char stripping, same relative-URL test). - It adds an empty-anchor
aria-labelfallback inWriter::end_link, where this PR uses the genericcontent::fallback_textpath. - Whichever lands second must be reconciled by hand. Pick one owner for media links, URL policy and accessible-name fallback before either merges, or the crate ends up with two parallel implementations.
- It adds its own
- #1501 is closed. Its html2md commits that reached main (
06d6a57d7hidden serialized state,dd7cd1c1ecode boundaries) are older than this branch's base, so they do not overlap. Butcontent::has_readable_contentdoes not usevisibility::nonrendered_serialized_state. That gives a second, inconsistent definition of what renders (see the inline comment).
Findings without a diff anchor
- [major] Stack hygiene and PR description:
Dom::control_valueandform::textarea_textare dead in this PR. No adapter implements the hook (NativeDominmoli-dom/src/native/markdown.rsdoes not override it), and no test in this PR overrides it. The textarea branches incontent.rsandmachine.rscan never take theirSomepath. The first test override appears in #1336 and the renderer implementation in #1337 (page_dump/visibility.rs). The description's claim that the browser adapter supplies live values throughcontrol_valuedescribes #1337, not this PR. Move the hook into #1336/#1337 or document the dependency. - [minor] Duplicate srcset parsers:
moli-renderer-v8/src/native_bridge/element/images/src.rsalready hasparse_srcset_candidates/parse_srcset_descriptorsfor real image selection. This PR adds a second, independently written WHATWG srcset parser. It also exports it as#[doc(hidden)] pubonly so one integration test can call it. Two parsers of one grammar will drift. Keep one implementation in the lower-level crate, and test throughconvertinstead of widening the public API. - [minor] Scope creep: the
http_fail.rschange (aFIXTURE_DATEconst and an unconditional 1.1 s sleep, while Date was already pinned at base) has nothing to do with html2md. It belongs in its own PR. The sleep adds wall time to every nextest run and does not fail without a fix. - [nit] README: link-scheme filtering, the forced line breaks for buttons/dates, and dropping
<title>outside SVG are behavior changes the README does not document. - CI: the only failing check, "Frontend differential", is 3 Chromium reference CDP timeouts (
reference_error) and not a Moli mismatch. The sequential-navigation soak shows HEAD 150/200 direct passes vs base 199/200, with wall time 1167 s vs 469 s. An html2md-only change cannot plausibly cause that; it looks like public-site noise. Re-run it before relying on this run's numbers. - Missing tests: no test covers a labelled element whose only content is media or a select, a
<time>or<button>inside a table cell or running text, or a non-allowlisted but legitimate link scheme.
Verdict: changes requested (posted as a comment because GitHub does not allow requesting changes on your own PR).
Automated review by Claude Code.
2b228c3 to
e9dccde
Compare
问题
DOM 转 Markdown 会丢失没有有效 src 的图片标签、响应式图片候选和表单的可读状态。另一方面,按 class 或文件名猜内容也会制造错误:询价区域可能变成引用,空图标可能变成勾号,合法图片可能被私有懒加载地址替换。
修改
机制图
验证
cargo test -p moli-html2md --locked通过。依赖
基于 main
f702d9a6。#1334 → #1335 → #1336 → #1337 → #1380