Repository navigation
fix(html2md): preserve media resources and readable controls - #1334
lanyue-llk wants to merge 4 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.539, 2.541, 3.042, 4.042, 5.544, 7.046, 8.548, 10.05, 11.051, 12.553, 14.055, 15.557, 17.059, 18.06, 19.64, 21.195, 22.697, 24.284, 25.785, 26.787, 27.788, 28.29, 29.794, 31.295, 32.796, 33.796, 35.298, 36.8, 38.302, 39.804, 40.806, 42.308, 43.809, 44.31, 45.311, 46.811, 47.812, 49.314]
y-axis "CPU percent" 0 --> 500
line [125.86, 97.79, 129.67, 115.99, 193.71, 151.83, 163.77, 203.72, 137.86, 93.92, 159.79, 43.92, 87.88, 127.82, 53.44, 97.85, 69.87, 121.9, 131.82, 99.82, 107.85, 105.76, 115.61, 107.85, 138.01, 106.01, 31.93, 105.95, 41.92, 121.82, 117.92, 151.78, 13.97, 3.99, 140.05, 148, 143.86, 183.64]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.039, 1.539, 2.541, 3.042, 4.042, 5.544, 7.046, 8.548, 10.05, 11.051, 12.553, 14.055, 15.557, 17.059, 18.06, 19.64, 21.195, 22.697, 24.284, 25.785, 26.787, 27.788, 28.29, 29.794, 31.295, 32.796, 33.796, 35.298, 36.8, 38.302, 39.804, 40.806, 42.308, 43.809, 44.31, 45.311, 46.811, 47.812, 49.314, 50.389]
y-axis "Memory MiB" 0 --> 500
line [12.56, 119.61, 128.06, 133.68, 140.33, 165.44, 190.2, 197.14, 205.46, 177.15, 166.48, 183.84, 172.59, 169.82, 167.31, 145.3, 164.54, 177.84, 159.93, 164.31, 208.35, 287.41, 229.75, 218.66, 174.79, 176.11, 188.95, 152.64, 161.83, 148.51, 188.43, 255.43, 221.16, 171.82, 170.49, 195.8, 168.09, 172.47, 201.69, 0]
line [9.61, 116.45, 124.72, 130.51, 137.16, 162.27, 187.13, 194, 202.32, 174, 163.28, 180.85, 169.47, 166.67, 164.18, 142.09, 161.26, 174.5, 156.63, 161.05, 205.1, 281.25, 226.01, 215.43, 171.45, 172.91, 185.5, 149.29, 158.45, 145.09, 185.17, 251.96, 217.88, 168.25, 167.13, 192.43, 164.73, 169.7, 198.39, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.039, 1.54, 2.542, 4.054, 5.055, 6.559, 7.56, 9.06, 10.061, 11.563, 12.564, 14.065, 15.068, 16.569, 17.57, 19.072, 20.073, 21.576, 23.079, 24.08, 25.081, 25.582, 26.584, 28.086, 29.088, 30.59, 31.592, 33.094, 34.095, 35.597, 36.598, 38.099, 39.1, 40.601, 41.602, 43.104, 44.104, 44.604]
y-axis "CPU percent" 0 --> 200
line [21.93, 121.85, 79.77, 153.69, 133.87, 147.78, 161.79, 171.96, 135.83, 147.83, 141.81, 111.97, 15.98, 111.88, 61.9, 4, 69.91, 105.71, 125.76, 157.86, 109.88, 127.79, 151.64, 143.62, 135.75, 125.8, 117.76, 101.86, 89.89, 37.95, 141.92, 44, 17.97, 134.07, 81.88, 119.85, 120.01, 186.06]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.037, 1.039, 1.54, 2.542, 4.054, 5.055, 6.559, 7.56, 9.06, 10.061, 11.563, 12.564, 14.065, 15.068, 16.569, 17.57, 19.072, 20.073, 21.576, 23.079, 24.08, 25.081, 25.582, 26.584, 28.086, 29.088, 30.59, 31.592, 33.094, 34.095, 35.597, 36.598, 38.099, 39.1, 40.601, 41.602, 43.104, 44.104, 44.604, 45.239]
y-axis "Memory MiB" 0 --> 500
line [12.38, 78.74, 114.25, 125.17, 141.19, 159.81, 171.62, 163.88, 189.89, 191.99, 171.52, 187.93, 164.4, 146.52, 182.84, 175.57, 147.51, 146.91, 181.5, 160.24, 200.85, 281.23, 197.2, 198.91, 219.63, 156.41, 205.7, 196.81, 157.17, 156.96, 154.59, 193.09, 166.18, 154.08, 183.5, 179.58, 157.68, 171.14, 193.18, 0]
line [9.29, 75.33, 110.81, 121.73, 137.74, 157.46, 168.36, 160.41, 186.57, 182.74, 168.71, 184.54, 161.06, 143.14, 180.35, 172.25, 144.23, 143.62, 178.22, 156.96, 196.29, 277.55, 194.41, 196.28, 216.37, 153.15, 199.82, 193.57, 154.03, 153.74, 152.08, 189.88, 162.91, 150.81, 180.26, 176.32, 154.51, 168.01, 189.9, 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.013925%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 — ✅ 52/52 groups passed; 621 scenariosWorkers: 4 · cumulative group time: 196.89 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. |
问题与方案
页面里可读的信息不只来自文本节点。旧转换会丢掉表单值、图片的文字替代、嵌入媒体地址和空控件标签;响应式图片和懒加载占位图也可能导出错误资源。
本 PR 从 #919 拆出这组转换规则:按标准资源声明选择图片,懒加载属性只作后备;保留可读表单值和选项边界,排除密码、隐藏输入和文件输入;图片无法引用时保留替代文字。媒体链接和普通链接采用同一 URL 安全规则,标签仍按普通文字转义。
根因、方案与验收
src;把缺少地址等同于没有可读内容srcset、有效src优先,私有懒加载声明仅作后备;无资源时保留altsource、poster、相对地址、危险协议与空地址;保持可读标签本组处理转换器所收到的 DOM 值。浏览器当前值覆盖初始属性的采样属于 #1337;两者通过同一转换接口衔接。
修复机制图
flowchart LR A[DOM 资源声明与控件状态] --> B{有可用标准声明?} B -->|有| C[保留标准资源] B -->|无| D[检查懒加载后备声明] C --> E[导出资源链接与可读标签] D --> E F[表单值与选项] --> G[排除敏感值并保留文字边界] G --> E范围与依赖
基于
main的99c24fd8debf6e6cb51c30b22080c5cd673ae85e,可独立验证。本组修改moli-html2md的共享资源、表单和可读标签转换,并同步原生 DOM 验收。HTTP 测试只固定响应元数据,排除跨秒请求造成的无关差异。运行时当前值、CSS 可见性和页面资源地址解析属于后续的页面适配 PR。复杂表格中的相同内容由后续表格 PR 复用这些规则。验证
原生 DOM 导出专项:22 个场景通过。
cargo fmt --allcargo test -p moli-html2md --locked:全部通过。cargo clippy -p moli-html2md --all-targets --locked -- -D warnings:通过。红绿验证:图片作为邮件链接唯一标签时,旧转换丢失
Email,本修改保留标签。测试还覆盖响应式资源、无效候选、懒加载占位图、危险 URL、表单敏感值与文本边界。完整仓库测试交由 CI。测试检查实际导出内容及 Markdown 渲染语义,不要求表格采用特定表示格式。
分支验证与集成验证
此前的 PR 集成 CI 对应提交
d9695fe6870e4f191a0906c187ca391c2797d101。main 的 gamepad 和 credential 测试曾引用已移除的 context 字段,分别由 #1343 与 #1351 修复并合入;当前集成快照已包含两项修复。与 #1305 的关系
#1305 直接基于 main,负责执行调用者明确指定的脚本,等待 Promise 和导航后走标准导出路径。这四组修复负责导出内容的完整性与语义。双方没有代码前置依赖;组合后,交互后的 DOM 会使用这些共享转换规则。
默认只读采集和明确交互采集是不同的测量协议。报告中的历史成绩仍绑定原调用协议;不能给单一方法补交互后替换同一行成绩。
报告
完整 WebMainBench 报告 保留 #919 已发布的完整运行及方法对比。该运行对应
721bd2e329f96c06573db6e6b257a149cf17a6fe,不代表本拆分分支的新测量。完整测试的两个验收边界
原生 DOM 的图片替代文字验收随本组修改,覆盖无资源、空资源、邮件链接、空标签和字面 Markdown。后续格式组单独更新属性换行验收,避免把一个 PR 的必要测试留到后面的 PR。
HTTP 输出格式测试对同一响应逐字节比较。测试服务固定
Date,并让 JSON 的两次请求跨越一秒,验证结果不受自动响应日期影响;产品响应头和完整输出断言保持原样。HTTP 日期场景已完成红绿验证:未固定日期时,跨秒的 JSON 完整输出比较失败;固定日期后通过。完整输出比较未放宽。
PR stack
GitHub 原生依赖链:#1334 → #1335 → #1336 → #1337 → #1380 → #1428 → #1431 → #1432。
每个 PR 的 GitHub base 都是左侧紧邻分支,因此 Files changed 只显示本层增量。按从左到右的顺序合入。#919 是保留的历史完整组合,不是这条链的依赖;#1429 独立面向
main,只提供通用 CI 评测入口。