Repository navigation
feat(reporting): finish report leftovers for language, names, summaries and Mermaid - #408
lanyue-llk wants to merge 15 commits into
Conversation
… track filter rules
Ship mermaid.min.js (SHA-256 pinned; matches the upstream SRI integrity) as harness.reporting package data with its MIT license under harness/licenses. Web Fetch, WebMainBench sample and WCXB reports install the runtime and its license into assets/ and load it relative to their own script, so diagrams render without a CDN. The Web Fetch publication package serves the runtime beside report.js, keeps it out of packed content and verifies its bytes; the privacy projection passes the pinned vendored file unchanged. Web Search and the public WebArena replay keep the pinned CDN loader.
…er Use Browser Use renders dynamic catalog text in the edition being rendered. Web Fetch drops each label's English form from Chinese pages once the English edition is derived, and from the English pages it writes. check_one_language rejects a page that embeds the other edition.
…labels reporting/names.py adds display_name (registry label, unregistered names unchanged), check_display_names (no raw registered id in a body cell) and check_interface_language (no untranslated interface word in a Chinese page's headings, headers and controls; dataset text is marked verbatim). The shared presentation gate runs the interface check; Web Fetch, WCXB and Browser Use run the display-name check against their registries. WCXB tables, options and headings use browser labels instead of ids and translate its Mean header; Browser Use localizes Task #N; curated replay task titles are marked as dataset text.
…/P50/P95 The Web Fetch overall ranking puts the overall pass rate right after the method and the WCXB core table puts qualified F1 right after the browser. Both fold Mean/P50/P95 into one cell (shell.spread): the mean is the compared and sorted value, P50 and P95 stay as exact text beside it. On desktop, shell.js widens a table's scroller toward the viewport edges when the table is wider than the text column; narrow pages keep the swipe cue. Also: Web Fetch drops English labels only when the English edition is generated (a Chinese-only build keeps them for a later English pass), the matched-latency and implementation tables use method display names, and the interface vocabulary leaves out words that are also product names.
Ranking tests read one folded Mean/P50/P95 cell and the new primary-metric order. Baselines change only in rendered HTML, CSS and JS (and the new vendored Mermaid files); every JSON/JSONL data entry is unchanged.
There was a problem hiding this comment.
This review found 4 issue(s), including 4 blocking issue(s).
| attributes and verbatim evidence keep ids and are not read. | ||
| """ | ||
| soup = BeautifulSoup(html, "html.parser") if isinstance(html, str) else html | ||
| raw = {name for name in labels if display_name(labels, name) != name} |
There was a problem hiding this comment.
This always computes raw IDs against the English label, even on Chinese pages. For example, {"foo": {"en": "foo", "zh": "中文名称"}} allows <td>foo</td> on a Chinese page despite its registered Chinese display name. Conversely, when the Chinese label equals the ID but the English label differs, the valid Chinese label is rejected. Derive the edition from the page's language (normalizing zh-CN to zh), or accept an explicit language argument, and use it when resolving labels.
| if ((declared is not None and not declared["lang"].lower().startswith("zh")) | ||
| or node.find_parent(attrs={"data-verbatim": True}) is not None | ||
| or node.has_attr("data-verbatim") | ||
| or node.find_parent(attrs={"translate": "no"}) is not None |
There was a problem hiding this comment.
The advertised language exemptions are not fully honored: find_parent excludes the inspected node, so <button translate="no">Next</button> raises, and collecting descendant text without checking its language makes <h2><span lang="en">Results</span></h2> raise as well. These valid exemptions can therefore fail the shared presentation/release gate. Check translate="no" on the node itself and filter text using its effective language/translation exemptions; add regression tests for both cases.
| contained_path(out,'references/'+c['id']+'.txt') | ||
| out.mkdir(parents=True,exist_ok=True);(out/'assets').mkdir(exist_ok=True) | ||
| (out/'assets/style.css').write_text(STYLE+EXTRA, encoding='utf-8');(out/'assets/report.js').write_text(JS, encoding='utf-8') | ||
| (out/'assets/style.css').write_text(STYLE+EXTRA, encoding='utf-8');(out/'assets/report.js').write_text(JS, encoding='utf-8');install_mermaid(out/'assets') |
There was a problem hiding this comment.
The new runtime is installed into the renderer's output, but presentation refresh renders into a staging directory and copies only the explicit routes allowlist in report_build.py. That list includes assets/report.js but neither Mermaid asset. Refreshing a report generated before this change therefore installs the new local-only loader without assets/mermaid.min.js, so diagrams fail to load. Include the runtime and license in the refresh installation path, allowing these files to be newly created (the current non-review refresh also rejects routes absent from the original report).
| for route in expected: | ||
| path = root / prefix / route | ||
| html = path.read_text(encoding='utf-8') | ||
| check_display_names(html, display_labels) |
There was a problem hiding this comment.
This new gate rejects the generated analysis/index.html: the individual-results inventory in wcxb_report.py still writes esc(r['provider']) into a <td>. For example, chromium is registered as Chromium, so check_display_names raises on that cell in either edition. The page writer performs no name normalization. Convert the remaining inventory provider cells to browser_label(r['provider']) before enabling this gate; keep the raw IDs in data attributes and links.
…Mermaid - check_display_names resolves labels in the page's language. - check_interface_language honours translate="no" and another declared language on the element itself and on text inside it. - WCXB result inventory cells show browser labels. - Presentation refresh installs the vendored Mermaid runtime and license beside report.js, including into reports built before it was vendored.
|
OCR round 1: all four findings were fixed in c621b5c.
|
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| if not raw: | ||
| return | ||
| for cell in soup.select("main td, main tbody th"): | ||
| for text in cell.find_all(string=True): |
There was a problem hiding this comment.
This checks parser text nodes rather than visible names. With labels={'chromium': 'Chromium'}, <td><span>chrom</span>ium</td> passes even though it displays the raw ID, while <td><!--chromium-->Chromium</td> raises because BeautifulSoup includes comments in find_all(string=True). Extract visible text across inline elements (while retaining separator boundaries and verbatim exclusions), exclude comments/non-rendered content, and add regression tests for both cases so the release gate neither misses split IDs nor rejects invisible ones.
Comments and other non-rendered nodes are skipped, and the cell is also read across inline elements so an id split by markup is still caught.
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
ℹ️ All inline findings were already present in unresolved threads or duplicated within this review; nothing new was posted.
Existing unresolved findings:
| if _edition(soup) != "zh": | ||
| return | ||
| for node in soup.select(_INTERFACE): | ||
| text = " ".join(str(part).strip() for part in node.find_all(string=True) if _interface_text(part)).strip() |
There was a problem hiding this comment.
Exclude non-rendered text before validating interface language. find_all(string=True) includes HTML comments and script/style contents, and _interface_text does not filter them. On a Chinese page, <h1>Chromium<!-- Status --></h1> incorrectly raises, while <h1>Results<!-- 中文 --></h1> incorrectly passes because the invisible comment satisfies _CJK. This affects the shared presentation gate. Apply the same NavigableString filtering used by check_display_names, exclude script/style descendants, and add regression tests for both cases.
|
OCR round 3: fixed in ec8844a. |
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| and text.find_parent(attrs={"data-verbatim": True}) is None] | ||
| # Each text node, and the cell read across inline elements, so a split id is still seen. | ||
| for text in (*texts, "".join(texts)): | ||
| for part in _CELL_PARTS.split(text.strip()): |
There was a problem hiding this comment.
Splitting before checking the complete text misses registered IDs that themselves contain a separator. For example, with labels {"vendor/model": "Model"}, a cell containing only vendor/model passes because only vendor and model are checked. The mapping API does not restrict ID characters. Check text.strip() against raw before splitting composite cells, and add a regression test for a separator-bearing ID.
|
OCR round 4: fixed in 95f5704. Each cell's whole text is now checked before it is split, so an id that contains a separator is still caught. Regression test: |
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| # Each text node, and the cell read across inline elements, so a split id is still seen. | ||
| for text in (*texts, "".join(texts)): | ||
| # The whole text first: an id may itself contain a separator. | ||
| for part in (text.strip(), *_CELL_PARTS.split(text.strip())): |
There was a problem hiding this comment.
A registered display label can be rejected as a raw ID after splitting. For example, with labels={"foo": "foo / bar"}, a cell containing the exact result of display_name(labels, "foo") raises because the split component foo is in raw. Profile participant labels are also accepted by the callers, so this can block a correctly rendered report. Recognize resolved display labels before inspecting their separator-delimited components, and add a regression test for this case.
| INTERFACE_WORDS = ("Mean", "Median", "Average", "Total", "Status", "Result", "Results", "Pass", "Passed", | ||
| "Fail", "Failed", "Task", "Tasks", "Latency", "Score", "Rank", "Back", "Next", | ||
| "Previous", "Close", "Details", "Owner", "Revision") | ||
| _INTERFACE_WORD = re.compile(r"\b(?:" + "|".join(INTERFACE_WORDS) + r")\b") |
There was a problem hiding this comment.
|
OCR round 5: the display-label finding is fixed in 5e56f64. A cell's registered display labels are now recognized as whole labels before the text is split. Regression test: |
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| and text.find_parent(["pre", "code", "script", "style", "template"]) is None | ||
| and text.find_parent(attrs={"data-verbatim": True}) is None] | ||
| # Each text node, and the cell read across inline elements, so a split id is still seen. | ||
| for text in (*texts, "".join(texts)): |
There was a problem hiding this comment.
Checking individual text nodes before recognizing complete labels rejects valid labels split across inline markup. With {'foo': 'foo / bar'}, <td><span>foo</span> / bar</td> raises on the first text node, although its visible text is exactly the registered display label (the unformatted equivalent is already covered as valid in the tests). Recognize complete labels across inline nodes before checking their constituent text, while retaining detection of split raw IDs.
| for text in (*texts, "".join(texts)): | ||
| text = text.strip() | ||
| for label in shown: | ||
| text = text.replace(label, "\0") |
There was a problem hiding this comment.
Unrestricted substring replacement can hide a raw registered ID. For example, with labels {'foo': 'Friendly', 'other': 'oo'}, a cell containing only 'foo' becomes 'f\0' and passes validation. Profile-provided labels are also accepted by callers, so label/ID overlaps are not excluded. Match complete display-label spans at cell-part boundaries rather than arbitrary substrings, and add an overlapping-label regression test.
|
OCR round 6: fixed in a6c0002. Each cell is now read once as its visible text across inline markup and split into separator-delimited parts. A part counts as a name when it belongs to a whole display label, and the comparison uses complete parts, not substrings. Regression cases cover a label split by markup and labels whose ids overlap. The previous failure of the rendered reference checks was a 5-minute action timeout during capture, which is infrastructure. |
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| found = text if text in raw and text not in shown else next( | ||
| (part for index, part in enumerate(parts) if part in raw and index not in covered), None) |
There was a problem hiding this comment.
Separator-containing IDs escape the gate in compound cells. With labels={"vendor/model": "Model"}, <td>vendor/model · 42</td> passes: the whole text is not a raw ID, and splitting leaves vendor, model, and 42, none of which matches it. Detect complete registered IDs within compound cells as well, retaining the display-label exemptions, and add a regression test alongside the existing standalone vendor/model test.
| if _edition(soup) != "zh": | ||
| return | ||
| for node in soup.select(_INTERFACE): | ||
| text = " ".join(str(part).strip() for part in node.find_all(string=True) if _interface_text(part)).strip() |
There was a problem hiding this comment.
Joining every text node with an inserted space lets inline markup bypass the interface-language check. On a Chinese page, <th>La<span>tency</span></th> visibly reads Latency, but this produces La tency, so no interface word matches. Preserve adjacency across inline text fragments (while retaining the language/verbatim exemptions) and add a split-word regression test.
|
OCR round 7: I am not adopting either finding, and I am stopping OCR cycles here.
|
Purpose
This PR finishes the open report-quality items from #396 and #397. Charts and the detail-page and case-navigation redesign are out of scope and continue in #405.
flowchart LR R[Track renderer] -->|labels from registry| N[reporting/names.py<br/>display_name] R -->|Mean, P50, P95| S[shell.spread<br/>one folded cell] R -->|zh page plus English labels| E[English pass] E --> EN[en/ page] E -->|drop_other_edition| ZH[zh page, Chinese only] ZH --> G{Release gate} EN --> G G --> C1[check_one_language] G --> C2[check_display_names] G --> C3[check_interface_language] M[reporting/vendor/mermaid.min.js] -->|install_mermaid| A[report assets/]What changed
#396 A4: summaries
shell.spread. The mean is the value that gets compared and sorted, and the exact P50 and P95 values stay as text in the same cell.shell.jswidens a table's scroller toward the viewport edges when the table is wider than the text column. Narrow pages keep the swipe cue.#396 A11: names and labels
reporting/names.py:display_namereturns the registry label for a name and leaves unregistered names as they are.check_display_namesrejects a table cell that shows a raw registered id.check_interface_languagerejects an untranslated interface word in a Chinese page's headings, table headers or controls.data-verbatim.#396 A15: Mermaid (
reporting/vendor/mermaid.min.js, MIT license inlicenses/)reporting/mermaid.py.install_mermaidand load it relative to the page. The narrow-width text fallback is unchanged.#396: Replay headings
#397: one language per page
data-report-encopy from the Chinese pages, and from the English pages it writes, once the English edition is generated. A Chinese-only build keeps those copies so that a later English pass can still derive from it.check_one_languageruns in the Web Fetch and Browser Use release checks.Removed
bilingual_textand its English span rewrite are removed.mermaid_script_attributes) is kept only for the two reports listed under "Not changed".Not changed
<base>.Allowlists
There are no changes to the architecture allowlists.
Baselines
The baselines were refreshed. Only rendered HTML, CSS and JS entries changed, plus the new vendored Mermaid runtime and its license. All JSON and JSONL data entries are byte-identical, so scores, counts and latencies are unchanged. Per track:
shell.jsandshell.css(breakout and spread).Verification
uv run --frozen --all-extras python -m pytest -n 8 --dist worksteal tests: 21759 passed, 78 skipped, 2 xfailed, 0 failed (baselines included)make lint-checkuv run --frozen lexbench-webfetch versionis unchanged, and the scoring sources were not touched.Closes #396
Part of #397 (its chart items continue in #405)