Repository navigation
fix(html2md): preserve media resources and readable controls - #1334
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, 1.536, 3.039, 4.542, 5.042, 6.044, 6.544, 8.045, 9.546, 11.551, 13.051, 14.554, 16.055, 17.558, 19.56, 21.061, 22.563, 24.065, 26.066, 27.566, 29.068, 30.571, 32.073, 34.077, 35.578, 37.079, 38.583, 40.583, 42.085, 43.587, 45.089, 46.592, 48.592, 50.094, 51.596, 53.099, 55.101, 56.604]
y-axis "CPU percent" 0 --> 200
line [0, 11.98, 0, 129.76, 117.86, 125.83, 144.02, 129.98, 29.99, 89.79, 133.99, 103.86, 0, 113.81, 0, 4, 0, 3.99, 2, 0, 27.95, 51.9, 113.95, 101.87, 131.78, 141.95, 103.76, 118.16, 103.93, 7.99, 157.76, 91.78, 2, 99.94, 99.91, 137.88, 47.97, 133.6]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.034, 1.035, 1.536, 3.039, 4.542, 5.042, 6.044, 6.544, 8.045, 9.546, 11.551, 13.051, 14.554, 16.055, 17.558, 19.56, 21.061, 22.563, 24.065, 26.066, 27.566, 29.068, 30.571, 32.073, 34.077, 35.578, 37.079, 38.583, 40.583, 42.085, 43.587, 45.089, 46.592, 48.592, 50.094, 51.596, 53.099, 55.101, 56.604, 57.639]
y-axis "Memory MiB" 0 --> 500
line [12.92, 54.91, 67.38, 76.74, 113.81, 122.43, 138.54, 140.13, 134.82, 127.08, 132.38, 147.11, 117.18, 119.11, 150.27, 116.44, 116.61, 115.61, 115.61, 115.61, 115.61, 126.75, 154.33, 141.39, 271.79, 181.15, 215.31, 144.73, 150.33, 137.61, 138.33, 180.47, 155.16, 129.38, 151.39, 154.72, 165.27, 137.04, 170.74, 0]
line [9.58, 51.35, 63.81, 73.15, 110.21, 119.06, 133.74, 136.23, 131.22, 123.62, 128.87, 143.52, 113.55, 115.47, 146.66, 112.81, 112.98, 111.98, 111.98, 111.98, 111.98, 123.12, 150.7, 137.93, 268.64, 177.52, 211.71, 141.16, 146.7, 133.98, 134.71, 176.77, 151.54, 125.87, 147.76, 151.09, 161.68, 133.41, 167.14, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.036, 1.537, 2.038, 3.54, 5.543, 7.044, 9.047, 11.049, 12.551, 14.551, 16.051, 18.051, 19.551, 21.553, 23.556, 25.058, 27.06, 28.561, 30.565, 32.568, 33.068, 34.069, 36.072, 37.575, 39.577, 41.077, 43.08, 45.083, 46.584, 48.586, 50.089, 52.091, 54.094, 55.596, 57.597, 59.099, 61.101, 62.602]
y-axis "CPU percent" 0 --> 200
line [0, 2, 0, 17.96, 63.85, 111.94, 121.82, 102.06, 132, 66.02, 112.02, 100.03, 121.96, 3.99, 3.99, 0, 2, 88.02, 63.89, 114.03, 101.92, 121.8, 147.66, 59.86, 109.88, 35.96, 71.96, 27.92, 137.95, 83.85, 31.97, 4, 137.93, 99.89, 101.89, 99.86, 149.85, 119.96]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.035, 1.036, 1.537, 2.038, 3.54, 5.543, 7.044, 9.047, 11.049, 12.551, 14.551, 16.051, 18.051, 19.551, 21.553, 23.556, 25.058, 27.06, 28.561, 30.565, 32.568, 33.068, 34.069, 36.072, 37.575, 39.577, 41.077, 43.08, 45.083, 46.584, 48.586, 50.089, 52.091, 54.094, 55.596, 57.597, 59.099, 61.101, 62.602, 64.378]
y-axis "Memory MiB" 0 --> 500
line [13.06, 54.67, 54.8, 54.8, 72.68, 91.97, 144.8, 148.69, 156.11, 153.18, 130.8, 157.67, 133.33, 115.27, 113.89, 120.71, 119.75, 119.77, 134.03, 139.48, 203.13, 264.81, 179.21, 220.29, 146.88, 175.85, 132.83, 139.91, 134.95, 190.77, 229.54, 145.43, 127.18, 147.38, 174.2, 174.85, 174.85, 158.2, 144.64, 0]
line [9.61, 51.06, 51.18, 51.18, 69.05, 88.35, 141.17, 145.03, 152.5, 150.68, 127.17, 154.09, 129.69, 111.62, 110.13, 116.96, 116, 116.02, 130.86, 135.73, 199.4, 261.05, 175.48, 216.34, 143.18, 172.25, 129.18, 136.3, 131.37, 187.26, 226, 141.85, 123.6, 144.33, 170.62, 171.27, 171.27, 154.72, 141.04, 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.011095%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 — ✅ 53/53 groups passed; 628 scenariosWorkers: 4 · cumulative group time: 181.96 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
lanyue-llk
left a comment
There was a problem hiding this comment.
Re-review of the updated version (e9dccde1e)
The PR makes moli-html2md keep more of what a page shows: alt text for images without a usable source, srcset/lazy candidates, links for <iframe>/<video>/<audio>, form-control text, <select>/<option> boundaries, and an aria-label/title fallback for empty name-bearing elements. The new head is rebased onto current origin/main (bd8e0b27). It adds one real commit, e9dccde1e, that addresses most of the last round.
Verdict: request changes (narrow). The big problems are fixed. The fallback now runs after the children have produced output (a per-writer content counter), so it no longer swallows media, choices or rules. The fallback is limited to name-bearing elements. The button/time block boundaries are gone. Link filtering is now a denylist. Placeholder text is no longer used as a value. The remaining issues are smaller: media still forces paragraph breaks in inline contexts, accessible names still look like typed values, there is some dead or duplicated code, and the stack needs cleanup.
Previous findings
| # | Finding | Status | Evidence |
|---|---|---|---|
| 1 | [major] label fallback swallows media/choices/rules; ignores serialized state | FIXED | The pre-scan has_readable_content is removed. Task::Fallback(label, mark) (machine.rs:78, 355) writes the label only when the writer's content_mark did not change. The test labels_cannot_replace_media_choices_or_rules would fail under the old pre-scan. |
| 2 | [minor] fallback applied to every element; no word boundary | FIXED (residual nit) | content.rs limits it to name-bearing tags and roles and skips aria-hidden/hidden/presentation. The label is padded with spaces (x Save y test). Residual: img/input are in the list but never reach the fallback (new inline). |
| 3 | [major] button/time forced block boundaries |
FIXED | The arm is now "select" | "optgroup" | "option" only. phrasing_controls_and_dates_keep_inline_styles_and_table_cells covers strong, link and table cells. |
| 4 | [major] checked/value are default state, not current |
FIXED (documented; live state in #1337) | The README now says plain DOM attributes are defaults. #1337's page_dump/visibility.rs overrides checked and value through attribute(). The test was renamed source_form_values_…. |
| 5 | [minor] placeholder emitted as a value | PARTIAL | Placeholder is dropped. aria-label/title still render as bare text that looks like a typed value (thread reply). |
| 6 | [minor] link scheme allowlist drops legitimate schemes | FIXED | safe_link_url is a denylist (javascript:, vbscript:, data:text/html, data:application/xhtml+xml), tested with magnet/sms/geo/file/blob/data-pdf/custom schemes. #1591, which had the competing allowlist, is closed. |
| 7 | [nit] lazy attribute list inline; dead .or(src) |
FIXED | LAZY_SOURCE_ATTRIBUTES const, .or(src) removed. |
| 8 | [nit] constant-false tag == "img"; needless Cow::Owned |
FIXED | direct_source(dom, node, false), Cow::Borrowed(candidate.url). |
| 9 | [nit] poster written with empty alt | FIXED | poster_label → "Video poster" / "<title> poster". |
| 10 | [minor] unrelated http_fail.rs sleep |
FIXED (net) | No net diff vs main. Commit 2 still adds it and commit 7 removes it (see hygiene). |
| S1 | [major] control_value dead in this PR |
NOT FIXED (downgraded to minor) | Still no implementation or test override in #1334 to #1336. The first override is in #1337 (visibility.rs:404, regressions.rs:1317). The hook was widened to <input>, and the doc comment still says textarea only (new inline). |
| S2 | [minor] duplicate srcset parser + #[doc(hidden)] pub export |
NOT FIXED | No reply. media::parse_srcset is still re-exported (lib.rs:24) beside moli-renderer-v8/.../images/src.rs:783. |
| S3 | [minor] scope creep (http_fail.rs) |
FIXED (net) | See #10. |
| S4 | [nit] README undocumented behavior changes | PARTIAL | The link policy and form defaults are now documented. Dropping <title> outside SVG (and emitting it inside) is still undocumented. |
| S5 | Missing tests | FIXED | Tests now cover media, select and hr in labelled elements, time/button in tables and inline styles, and non-web schemes. |
| S6 | Overlap with #1591 | RESOLVED | #1591 was closed on 2026-10-22 as superseded by this stack. Nothing else on main touches html2md since f702d9a6. git merge-tree against origin/main is clean. |
New findings (inline unless noted)
- [minor]
media()forces paragraph boundaries around inlineiframe/video(machine.rs:367). This splits an enclosing link and adds<br><br>in table cells. - [minor] The video poster is dropped whenever no source passes
safe_url, for example withblob:/MSE players (machine.rs:368). - [minor] SVG
<title>is emitted as inline text glued to neighbors ([TwitterFollow](/t)). This contradicts the PR's own rule that tooltips are not article text (machine.rs:224). - [minor]
img/inputare listed as name-bearing but return before the fallback, so<img aria-label>is lost. The SVG<title>loop infallback_textis effectively dead (content.rs:25, 71). - [minor]
control_valueis still dead in this PR, and its doc no longer matches its use (dom.rs:29). - [minor] Duplicate srcset parser and test-only public export (lib.rs:24).
- [nit] Role-token parsing is duplicated in content.rs (lines 8 to 17 and 40 to 45).
- [nit] The test name
empty_accessible_element_retains_its_declared_textnow asserts the opposite (regressions.rs:579).
Findings without a diff anchor
- [minor] Stack and commit hygiene. Commit
8432da1f5adds placeholder-as-value and thebutton/timeboundaries, ande9dccde1eremoves them. Commit2757784a9("freeze response metadata") adds thehttp_fail.rschange thate9dccde1ereverts, so its subject no longer describes anything in the net diff. The two empty commits8663d9a89/48001fb55("ci: …") are still present. Squash the fixups, drop the empty CI commits and the revertedhttp_fail.rshunk, so every commit states a net change. - [minor] The PR description is stale. It says "HTTP Date 测试保留:跨秒比较仍验证完整输出", but the PR no longer touches that test. It lists removing quote, icon-class and Bootstrap-tooltip heuristics, which were introduced and removed inside this PR and are not changes vs main. It says the browser adapter supplies
control_value, which only #1337 does. It omits the anchor-scheme denylist, the SVG<title>handling and the select/option line boundaries. Rewrite it against the net diff. - CI: the new head
e9dccde1passes Format, Clippy, Nextest, both release builds, CDP smoke, WebDriver smoke, PDF, WebMainBench and the harness tests. Frontend differential, Agent episodes, Runtime/CDP contracts, Spider and the sequential-navigation soak are still pending. The bot comments on the PR are for the previous head2b228c34. Its soak (HEAD 150/200 direct passes vs base 199/200) should be checked on the new run before merge.
Verdict: changes requested (posted as a comment because GitHub does not allow requesting changes on your own PR).
Automated review by Claude Code.
lanyue-llk
left a comment
There was a problem hiding this comment.
Round-3 re-review of the updated version (54c1d1cb7)
Re-review of the third version (54c1d1cb7, a fast-forward of the round-2 head on bd8e0b27). The PR makes moli-html2md keep more of what a page shows: image text alternatives, srcset/lazy candidates, iframe/video/audio links and posters, form-control text, <select>/<option> boundaries, and an accessible-name fallback for empty name-bearing elements. The new commit addresses every round-2 inline finding, and the renderer now uses the shared srcset parser.
Verdict: request changes (small). Each remaining item is minor, and each has a small fix. Two are regressions this commit introduces: a poster-only <video> now drops its fallback content, and the shared srcset parser trims Unicode whitespace that the deleted renderer parser rejected. One is an alt="" handling bug that came from our own round-2 suggestion. One is the round-1 form-label ambiguity, which a test now locks in. Commit and description hygiene is still unaddressed after three rounds. This is the complete list: I re-read the whole diff and found nothing else.
Previous findings
| # | Finding | Status | Evidence |
|---|---|---|---|
| R2-1 | [minor] media() forced paragraph breaks around inline iframe/video |
FIXED | machine.rs:362-397 uses boundary(2) only when is_block(tag) (audio) and spaces otherwise. inline_media_keeps_links_emphasis_and_table_flow covers link, paragraph, emphasis and table cell (no <br>). The test fails under the old code. |
| R2-2 | [minor] poster dropped when no source passes safe_url |
FIXED (new regression) | The poster is computed before the empty check (machine.rs:355-361), and source-less and blob: cases are tested. Returning true now also skips the video's fallback children (new inline). |
| R2-3 | [minor] SVG <title> emitted as glued body text |
FIXED | "title" => return for every title (machine.rs:220). The svg <title> loop in content.rs:44-60 now supplies the name only for an SVG with no other output. Documented in README:133-134. Both cases are tested. |
| R2-4 | [minor] img/input listed as name-bearing but unreachable |
FIXED (residual) | Removed from the list. content::image_label gives alt → aria-label → title, used for the src and no-src paths (machine.rs:263-273), and is tested. Residual: alt="" is treated as missing (new inline). |
| R2-5 | [nit] duplicated first-role-token parse | FIXED | primary_role + role_matches + PRESENTATIONAL_ROLES/NAMED_WIDGET_ROLES. The first-token choice is documented in a comment, as we asked. |
| R2-6 | [minor] control_value dead in this PR; stale doc |
FIXED | live_controls_replace_defaults_including_explicit_clears overrides the hook for input and textarea (non-empty and cleared). The doc (dom.rs:29-31) now covers both controls. The production producer is still only in #1337, which we accept. |
| R2-7 | [minor] duplicate srcset parser + #[doc(hidden)] pub export |
FIXED (residual) | The renderer tokenizer/validators are deleted, and parse_srcset_candidates maps moli_html2md::parse_srcset. Residual: the shared parser is less strict than the one it replaced, and the export is still doc(hidden) with a string descriptor that the renderer re-tokenizes (new inline). |
| R2-8 | [nit] misnamed test | FIXED | Renamed to generic_container_labels_are_not_article_text_but_link_labels_are. |
| R1-5 | [minor] hint/label text emitted as if it were a value | NOT FIXED | Placeholder is gone, but aria-label/title still render as bare text (form.rs:34-41). The new test asserts a live-cleared input outputs Field (new inline). There was no reply to the round-2 thread. |
| R1-4 follow-up | [nit] <select> lists options without marking selected |
NOT ADDRESSED (non-blocking) | No change or README note. Mark the selected option (e.g. ☑, the same glyph checkboxes use) or document the limitation. |
| Stack #4 | hooks without producers; README contract | PARTIAL | control_value is now exercised (R2-6). README.md:19 still says "four borrowed queries", but this PR adds the optional control_value query; the README mentions it only in prose at line 127. List it in the DOM-interface section. |
| Stack #10 | role/URL/label rules diverge | PARTIAL | Role parsing in content.rs is unified. The resource allowlist (media::safe_url: http/https/mailto/tel/ftp + data:image/) is still undocumented in the README, which documents only the link denylist. Label resolution now has four rules, not three (new inline on image_label). |
| Stack #11 / hygiene | empty ci: commits, add-then-revert churn |
NOT FIXED | 8663d9a89 and 48001fb55 are still empty. 2757784a9 still adds the http_fail.rs sleep that e9dccde1e reverts. 8432da1f5 still adds the placeholder-as-value and button/time boundaries that e9dccde1e removes. New: 54c1d1cb7 ("fix(html2md): …") also rewrites renderer image selection in moli-renderer-v8/.../images/src.rs (-220 lines); that belongs in its own refactor(renderer) commit. |
| Description | stale PR body | PARTIAL | It now mentions the shared srcset parser, the poster and inline media. It still says "HTTP Date 测试保留:跨秒比较仍验证完整输出" (the PR does not touch that test). It still lists deleting quote/icon-class/Bootstrap-tooltip semantics, which never existed on main. It still says the browser adapter supplies control_value (only #1337 does). It still omits the link-scheme denylist and the SVG <title> rule. |
New findings (inline)
- [minor] A poster-only
<video>now returns early and drops its fallback children, including the fallback download link (machine.rs:359). - [minor] The shared srcset parser trims Unicode whitespace from descriptors, so browser image selection accepts candidates that WHATWG and the deleted parser reject (
media.rs:112). The renderer also re-tokenizes a string descriptor (src.rs:784). - [minor]
image_labeltreatsalt=""as missing and promotestitle, so decorative images gain alt text and tooltip text (content.rs:83). Our round-2 suggestion caused this. Image, media, fallback and input labels now follow four different rules. - [minor] A cleared or empty text input still renders its accessible name as if it were a value, and the new test asserts that (
form.rs:34).
Not anchorable
- Hygiene and description: see the table. Squash
8432da1f5+e9dccde1e+54c1d1cb7into net-change commits. Drop8663d9a89,48001fb55and thehttp_fail.rshunk of2757784a9. Split the renderer srcset change into its own commit, then rewrite the description against the net diff. - CI at
54c1d1cb: Resolve revisions, Format, Clippy, Windows storage, Python/Node harness and CDP smoke pass. Nextest and both release builds are still queued. The A/B bot comments (soak, spider, regression report) are still for2b228c34. The earlier soak gap (HEAD 150/200 vs base 199/200 direct passes) needs a fresh run on this head before merge. Because this commit changes renderercurrentSrcselection, Nextest (the renderer srcset suite) must pass. - Merge: origin/main has moved 7 commits past
bd8e0b27, none touchingmoli-html2md,images/src.rsorpage_dump.rs.git merge-tree --write-tree origin/main 54c1d1cb7is clean (tree701cd792).
Verdict: changes requested (posted as a comment because GitHub does not allow requesting changes on your own PR).
Automated review by Claude Code.
|
The round-3 stack review is on #1337: #1337 (comment). Finding N1 is in this PR: commit 54c1d1c rewrites the renderer's srcset selection ( |
lanyue-llk
left a comment
There was a problem hiding this comment.
Round-4 re-review of the updated version (fb466fc6e)
Round-4 re-review of fb466fc6e (a fast-forward of round-3 head 54c1d1cb7 on bd8e0b27; it adds 2ff73d38e and fb466fc6e). The PR makes moli-html2md keep image text alternatives, srcset/lazy candidates, media links and posters, form-control text and <select> boundaries. It also makes the renderer's currentSrc selection use the html2md srcset parser.
Verdict: request changes. All five round-3 inline findings are addressed, and each comes with a regression test that would fail without the fix. One blocking item remains: stack finding N1. parse_srcset still counts nested parentheses, but the HTML spec does not nest them, and this parser now drives img.currentSrc. The image_label fix also has a new minor regression: hidden, aria-hidden and presentational exclusions now discard authored alt as well as the synthesized fallback names. Everything else is nit-level.
Previous findings
| # | Finding | Status | Evidence |
|---|---|---|---|
| R3-1 | [minor] poster-only <video> dropped its fallback children |
FIXED | media() returns has_source (machine.rs:374,400), so the children are visited when no source is usable. media_fallback_and_decorative_images_keep_author_intent covers src='' and blob: and asserts both the poster and [Download](/clip.mp4). It fails on 54c1d1cb7. fb466fc6e also rejects whitespace-only posters (see the nit at machine.rs:358). |
| R3-2 | [minor] srcset descriptors trimmed with Unicode trim() |
FIXED | trim_ascii() (media.rs:118). Negative cases for U+3000 and NBSP are in both srcset_recovers_only_the_future_compatible_width_height_pair and the renderer's srcset_parser_rejects_unicode_descriptor_spaces (images/src.rs:1079). Both fail with trim(). |
| R3-3 | [nit] renderer re-parses a string descriptor; doc(hidden) export |
FIXED | SrcsetCandidate now has typed width/height/density, the score is computed inside largest_srcset_candidate, and the renderer copies fields with a checked u32 conversion. doc(hidden) is gone and both items have rustdoc. descriptor: &str is kept because #1337 (visibility.rs:340-343) reserializes it. Accepted. |
| R3-4 | [minor] alt="" treated as missing |
PARTIAL | alt="" now stays decorative (content.rs:91-104) and is tested with and without a source. New regression: the exclusion block runs before alt, so an authored non-empty alt is discarded for hidden/aria-hidden/role=presentation images (new inline). The reply says "Media labels now also read aria-label", but in this PR media::label still reads only title. That change is in #1336. |
| R3-5 / R1-5 | [minor] empty text input emitted aria-label/title as a value |
FIXED | Name fallback only for submit/button/reset (form.rs:26-47). live_controls_replace_defaults_including_explicit_clears now expects "" for a cleared input. The new test asserts that <input type=search aria-label=Search> gives "" and type=submit gives Search. README:122 still states the old rule (nit). |
| Stack N1 | renderer currentSrc depends on html2md's parser, which handles parentheses differently |
NOT FIXED | media.rs:108-113 still counts parenthesis depth. No reply. See the inline for the counterexample. The renderer change is again inside an html2md-titled commit (2ff73d38e). |
| R1-4 follow-up | [nit] <select> does not mark the selected option |
NOT ADDRESSED (non-blocking) | No change and no README note. |
| Stack #4 | README DOM contract | NOT FIXED | README.md:19 still says "four borrowed queries". control_value and the now-public parse_srcset/SrcsetCandidate are not in the README API section. |
| Stack #10 | role/URL/label rules diverge | PARTIAL | image_label and fallback_text now repeat the hidden/presentational predicate, and the two copies differ: aria-hidden is trimmed in content.rs:7 but not in :86. The resource allowlist (safe_url) is still undocumented in the README. |
| Stack #11 / hygiene | empty ci: commits, add-then-revert churn |
NOT FIXED | 8663d9a89 and 48001fb55 are still empty. The 2757784a9/e9dccde1e http_fail.rs pair still nets to zero. 54c1d1cb7 and now 2ff73d38e change moli-renderer-v8/.../images/src.rs under fix(html2md) titles. |
| Description | stale PR body | PARTIAL | The new bullets match the code. It still says "HTTP Date 测试保留:跨秒比较仍验证完整输出" (the net diff does not touch that test). It still lists deleting quote/icon-class/Bootstrap-tooltip semantics, which never existed on main. It still says the browser adapter supplies control_value (only #1337 does). It does not say that the renderer's currentSrc parsing changed. |
New findings (inline)
- [minor]
parse_srcsetnests parentheses, while HTML's "in parens" state ends at the first).srcset="a.png ((x), b.png 2x"now selects the fallbacksrcinstead ofb.png(media.rs:111; stack N1, still open). - [minor]
image_labeldiscards authoredaltonhidden/aria-hidden/presentational images while it still emits the image, sobecomes(content.rs:83). TheSome("")branch also returns an untrimmedaria-label. - [nit] The poster check trims, but the output uses the untrimmed value, so
poster=" /cover.jpg "gives(machine.rs:358). - [nit] README:122 ("Empty accessible controls retain their labels") contradicts the new rule at :127. Line 127 is also not rewrapped.
- [nit] In
source_form_values_preserve_readable_state_without_secrets, the"Search"assertion is vacuous: it matches inside"Search term", so it does not prove the submit value is emitted (regressions.rs:656).
Not anchorable
- Hygiene: squash
8432da1f5+e9dccde1e+54c1d1cb7+2ff73d38e+fb466fc6einto net-change commits. Drop the empty8663d9a89/48001fb55and thehttp_fail.rshunk of2757784a9. Move theimages/src.rschange (and the parser fix below) into onerefactor(renderer)commit, then rewrite the description against the net diff. - CI at
fb466fc6e: Resolve revisions, Format, Clippy, Windows storage, Python/Node harness and CDP smoke pass. Nextest is in progress and both release builds are queued. The renderer srcset suite (Nextest) must pass becausecurrentSrcparsing changed. The A/B bot comments (soak/spider/regression) are still for2b228c34, and the soak gap needs a fresh run on this head. - Merge: origin/main (
45be4e35) is 16 commits pastbd8e0b27, and none of them touchmoli-html2md,images/orpage_dump.rs.git merge-tree --write-tree origin/main refs/review/v4-1334is clean (treeea54b556).
This list is complete. I re-read the whole net diff, and nothing else is outstanding.
Verdict: changes requested (posted as a comment because GitHub does not allow requesting changes on your own PR).
Automated review by Claude Code.
lanyue-llk
left a comment
There was a problem hiding this comment.
Round-5 re-review of the updated version (97ff3aeae)
Round-5 re-review of 97ff3aeae. This is a fast-forward of round-4 head fb466fc6e on bd8e0b27, and 97ff3aeae is the only new commit. The PR makes moli-html2md keep image text alternatives, srcset/lazy candidates, media links and posters, form-control text and <select> boundaries. It also makes the renderer's currentSrc use the shared srcset parser.
Verdict: approve. Stack N1 and all five round-4 inline findings are fixed. Each fix has a regression test that fails on fb466fc6e. Only nits and hygiene items remain, and none of them blocks the merge.
Previous findings
| # | Finding | Status | Evidence |
|---|---|---|---|
| R4-1 / Stack N1 | [minor] parse_srcset nested parentheses |
FIXED | media.rs:108-113 now uses a bool: ( sets it, ) clears it, and , breaks only outside parens. This matches the spec's single "in parens" state, where ( inside parens is just appended. Splitting descriptors on whitespace inside parens still rejects the same candidates as the spec, because the token that holds the ( can never parse as Nw/Nh/Nx. Tests: renderer srcset_parentheses_do_not_nest (images/src.rs:1079, via moli_html2md::parse_srcset) and html2md "a.png ((x), b.png 2x" gives . With the depth counter both fail: 0 candidates, and the output falls back to /fallback.png. |
| R4-2 | [minor] image_label dropped authored alt on hidden/aria-hidden/presentational images |
FIXED | Non-empty alt now returns before excluded_from_naming (content.rs:90-95). The exclusion still suppresses synthesized aria-label/title. One shared predicate, with trimmed aria-hidden, now serves fallback_text and image_label. The alt="" branch trims aria-label. authored_image_alternatives_survive_naming_exclusions covers all three exclusions with alt and with aria-label only, plus alt='' aria-label=' '. |
| R4-3 | [nit] poster trimmed only for the check | FIXED | media::direct_attribute(..., "poster", true) (machine.rs:355-357) trims and also rejects #…/about:blank. Tested: ' /cover.jpg ' gives /cover.jpg, and #cover/about:blank fall back to the children. |
| R4-4 | [nit] README:122 contradicted :127 | FIXED | The general sentence is gone and the separate empty-text/button rules remain. The wrap at :127-128 is still a little ragged (cosmetic). |
| R4-5 | [nit] vacuous "Search" assertion |
FIXED | The submit value is now the distinct Go (regressions.rs:649,656). |
| R1-4 follow-up | [nit] <select> does not mark the selected option |
NOT ADDRESSED (non-blocking) | No change. |
| Stack #4 | README DOM contract | NOT FIXED (nit) | README.md:19 still says "four borrowed queries". The optional control_value and public parse_srcset/SrcsetCandidate are not in the API section. |
| Stack #10 | role/URL/label rules diverge | FIXED for naming; safe_url allowlist still undocumented (nit) |
excluded_from_naming now has one copy. |
| Stack #11 / hygiene | empty ci: commits, add-then-revert churn, mistitled commits |
NOT FIXED (nit) | 8663d9a89/48001fb55 are still empty, and the 2757784a9/e9dccde1e http_fail.rs pair still nets to zero. The renderer behaviour change is still in 2ff73d38e (fix(html2md)), while 97ff3aeae (fix(renderer)) is mostly html2md changes. Squash before merge. |
| Description | stale PR body | PARTIAL (nit) | It now states the shared parser and the non-nesting rule. It still claims "HTTP Date 测试保留:跨秒比较仍验证完整输出", which the net diff does not touch, and it still lists removing quote/icon-class/Bootstrap-tooltip semantics, which never existed on main. |
New findings
- [nit]
excluded_from_namingis written asif cond { return true; } false. Return the expression directly, and make it private: it is only used incontent.rs(content.rs:77).
Not anchorable
- CI at
97ff3aeae: Resolve revisions, Format, Clippy, Windows storage, Python/Node harness and CDP smoke pass. Nextest and both release builds are still queued. Nextest must be green before merge because the renderer srcset tests changed. - Merge:
git merge-tree --write-tree origin/main refs/review/v5-1334is clean (tree01286728). v5-1335/1336/1337/1380 all sit on this head.
This list is complete. I re-read the full net diff, and nothing else is outstanding.
Verdict: approve (posted as a comment; self-approval is not allowed).
Automated review by Claude Code.
lanyue-llk
left a comment
There was a problem hiding this comment.
Final re-review (P0/P1 only) (62251602f)
Verdict: approve. No P0/P1 issues. v6 (62251602f) fast-forwards v5 97ff3aeae on the same base bd8e0b27. It adds one commit, refactor(html2md): simplify private naming exclusion predicate.
Previous P0/P1 findings
| Finding | Status |
|---|---|
| None. Every earlier finding on this PR was minor or nit, and all of them were already fixed or non-blocking at v5. | n/a |
This round: content.rs:77-82 now returns the aria-hidden \|\| hidden \|\| presentational-role expression directly and makes the function private. Behaviour is unchanged. The only callers are in content.rs (lines 5 and 89), so making it private does not break the build, and Clippy passes. This resolves the round-5 nit.
New P0/P1 findings: No P0/P1 issues found.
Merge: git merge-tree --write-tree origin/main refs/review/v6-1334 is clean (tree 4168b277), and GitHub reports MERGEABLE.
CI at 62251602f: Resolve revisions, Format, Clippy, Windows storage, Python/Node harness and CDP smoke pass. Nextest and both release builds are still pending. Nextest must be green before merge.
Verdict: approve (posted as a comment; self-approval is not allowed).
Automated review by Claude Code.
6225160 to
0ec6219
Compare
0ec6219 to
f5b8c70
Compare
问题
DOM 转 Markdown 会丢失没有有效 src 的图片标签、响应式图片候选和表单的可读状态。另一方面,按 class 或文件名猜内容也会制造错误:询价区域可能变成引用,空图标可能变成勾号,合法图片可能被私有懒加载地址替换。
一图看懂
修改
标准 srcset/src 优先;标准资源不可用时才读取私有懒加载声明。合法 data image 保留,文件名不作为占位图证据。
图片按 alt、aria-label、title 保留文字替代;无有效视频源时仍保留 poster。媒体链接在段落、强调和表格中保持行内结构。
保留表单文字、选项边界和可访问标签;密码值、隐藏输入和文件输入不导出。转换器保留调用方选定 DOM 的内容,不负责选择文章正文。
删除 quote、图标 class 和 Bootstrap tooltip 属性的特殊语义。标准 blockquote、实际文字和 aria-label/title 继续工作。
poster 与视频回退内容分别保留:没有有效 src 时,下载链接和说明仍会导出。
显式空 alt 保持装饰语义;只有缺少 alt 时才考虑 title。空文本字段不把标签输出成已填写的值,按钮仍保留名称。
srcset 解析结果公开提供已验证的宽、高和密度,浏览器选择直接读取字段。
非空作者 alt 优先保留;hidden、aria-hidden 与 presentation 只限制合成名称。poster 使用规范化 URL,srcset 的括号状态遵循 HTML 的非嵌套规则。
验证
cargo test -p moli-html2md --locked通过。复现
本 PR 的转换库测试可独立运行:
cargo test -p moli-html2md --locked。浏览器接入在 #1337,以下 CLI 与冻结页复现使用完整 stack。最小用例
标准图片地址必须优先于私有懒加载地址;表单标签和值都要保留。
实际输出:
真实 WebMainBench 页面
75b0c1e9…家具页:保留 Pimlico 图片的替代文字及标准资源地址。七个相关页面通过 browser-eval 的现有 runner 共用一次定向运行,7/7 正常导出,并核对上述内容;不是 545 页质量重测。查看冻结输入、实际输出与核对结果。
19bfc785;二进制 SHA-256:1c17bba8cb6b0a532144697411d13ec6a3872d1abad96d5872da0ded93d7b8b4。345ea093。0efaa4b49a45e320a27fe6e5a0b6aad5b57259fc3321ac3448519cacc74c537e,runner 会校验。保留原网址,代理返回冻结 HTML,外部资源禁止访问,无点击或 DOM 改写。环境准备与可复制命令
results.jsonl记录成功状态、错误和输入/输出哈希,execution.json记录二进制身份,artifacts/moli/保存实际 Markdown。定向运行只用于定位和回归,不进入正式榜单;报告中的历史成绩仍绑定原测量版本。依赖
基于 main
bd8e0b27。#1334 → #1335 → #1336 → #1337 → #1380