Repository navigation
Improve track-specific report readability (Browser Use, Replay, Extract, Web Fetch, WCXB, Lexbench) - #401
Conversation
… viewer, English rationales, baseline/comparison labels
…le theme toggle, data-driven field list
…ion test follows sections
There was a problem hiding this comment.
This review found 3 issue(s), including 3 blocking issue(s).
| @@ -1 +1,4 @@ | |||
| (()=>{const status=document.getElementById("evidence-viewer-status");const output=document.getElementById("evidence-viewer-content");const raw=document.getElementById("evidence-raw-link");const source=new URLSearchParams(location.search).get("src")||"";const valid=/^artifacts\/[a-z0-9._-]+\/executions\/[0-9]+\/execution-evidence[.]json$/i.test(source)||['data/trajectory-replay-bridge.json','data/trajectory-replay-failure-review.json'].includes(source);const english=document.documentElement.lang==="en";if(!valid){status.textContent=english?"Invalid evidence path.":"证据路径无效。";return;}raw.href=source;raw.hidden=false;fetch(new URL(source,document.baseURI),{credentials:"same-origin"}).then(response=>{if(!response.ok)throw new Error(`HTTP ${response.status}`);return response.json();}).then(value=>{output.textContent=JSON.stringify(value,null,2);status.textContent=english?"Evidence loaded.":"证据已载入。";}).catch(error=>{status.textContent=(english?"Unable to load evidence: ":"无法读取执行证据:")+error.message;});})(); No newline at end of file | |||
| (()=>{const status=document.getElementById("evidence-viewer-status");const output=document.getElementById("evidence-viewer-content");const raw=document.getElementById("evidence-raw-link");const tabs=document.getElementById("evidence-viewer-sections");const source=new URLSearchParams(location.search).get("src")||"";const valid=/^artifacts\/[a-z0-9._-]+\/executions\/[0-9]+\/execution-evidence[.]json$/i.test(source)||['data/trajectory-replay-bridge.json','data/trajectory-replay-failure-review.json'].includes(source);const english=document.documentElement.lang==="en";if(!valid){status.textContent=english?"Invalid evidence path.":"证据路径无效。";return;}raw.href=source;raw.hidden=false; | |||
| const render=(value,name,pick)=>{output.textContent=JSON.stringify(pick(),null,2);for(const button of tabs.querySelectorAll("button"))button.setAttribute("aria-pressed",String(button.dataset.section===name));}; | |||
| @media(max-width:600px){main>p.muted,main>h1{width:calc(100% - 28px)}body>nav{padding-inline:14px}} | ||
| .publication-article .lead-scope{color:var(--muted);max-width:900px} | ||
| @media(max-width:600px){.dialog-actions{position:static}} | ||
| .evidence-sections{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.evidence-sections button{padding:7px 12px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--accent);font:inherit;font-size:13px;cursor:pointer}.evidence-sections button[aria-pressed=true]{background:var(--accent);color:#fff;border-color:var(--accent)} |
There was a problem hiding this comment.
The author-level display:flex overrides the browser's default [hidden] styling, and this stylesheet has no hidden-state override. Consequently, tabs.hidden = entries.length < 3 does not hide the controls for scalar-only objects, single-nested-field objects, or {} (which displays a redundant All button). Add .evidence-sections[hidden]{display:none} or apply flex only to .evidence-sections:not([hidden]).
| const response=await fetch(source);if(!response.ok)throw Error('HTTP '+response.status); | ||
| text=await response.text(); | ||
| }if(pre.dataset.readable)text=text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g,c=>'\\x'+c.charCodeAt(0).toString(16).padStart(2,'0')); | ||
| }if(/\.json$/i.test((pre.dataset.file||pre.dataset.evidenceFile||'').split(/[?#]/)[0])){try{text=JSON.stringify(JSON.parse(text),null,2)}catch(error){}} |
There was a problem hiding this comment.
Parsing and reserializing raw JSON can change the evidence rather than merely indent it. For example, {"id":9007199254740993} is displayed as {"id":9007199254740992}, and duplicate keys are silently discarded. This viewer loads raw response/log artifacts, so such changes can mislead comparisons with the saved output. Use a token-preserving JSON formatter (or retain the original text when lossless formatting is unavailable), and test preservation of large integers and duplicate keys.
|
Addressed OCR round 1 in e2d175d: Web Fetch JSON evidence is now indented only when reserializing preserves every token (large integers, duplicate keys, escapes, number spelling), otherwise the saved bytes are shown, with a Node test for each case; |
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| @@ -1,3 +1,6 @@ | |||
| // Indent JSON only when reserializing preserves every token (large integers, duplicate keys, escapes); otherwise show the saved bytes. | |||
| function minifyJson(text){let out='',quoted=false,escaped=false;for(const c of text){if(quoted){out+=c;if(escaped)escaped=false;else if(c==='\\')escaped=true;else if(c==='"')quoted=false}else if(c==='"'){quoted=true;out+=c}else if(!/\s/.test(c))out+=c}return out} | |||
| function losslessJson(text){try{const value=JSON.parse(text);return JSON.stringify(value)===minifyJson(text)?JSON.stringify(value,null,2):text}catch(error){return text}} | |||
There was a problem hiding this comment.
Formatting runs synchronously before the large-output safeguard, so large JSON records now require parsing, a character-by-character copy, and up to two serializations on the UI thread. Indentation can also greatly expand small but deeply nested inputs (e.g. 2,000 nested arrays expand from about 4 KB to about 8 MB). The textarea check happens after this work and cannot prevent the stall or allocation spike. Bound formatting by input size and nesting/output budget, falling back to the original text when exceeded; add large and deeply nested JSON regression cases.
|
OCR round 2 (performance) addressed in 5ea2194: JSON is only reformatted below 64 KiB, and the indented form is used only when it stays under 256 KiB; deep-nesting and large-input controls added to |
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| @@ -1,3 +1,6 @@ | |||
| // Indent small JSON only when reserializing preserves every token (large integers, duplicate keys, escapes); otherwise show the saved bytes. | |||
| function minifyJson(text){let out='',quoted=false,escaped=false;for(const c of text){if(quoted){out+=c;if(escaped)escaped=false;else if(c==='\\')escaped=true;else if(c==='"')quoted=false}else if(c==='"'){quoted=true;out+=c}else if(!/\s/.test(c))out+=c}return out} | |||
| function losslessJson(text){if(text.length>64*1024)return text;try{const value=JSON.parse(text);if(JSON.stringify(value)!==minifyJson(text))return text;const indented=JSON.stringify(value,null,2);return indented.length>256*1024?text:indented}catch(error){return text}} | |||
There was a problem hiding this comment.
The output-size guard runs only after the entire indented string has been allocated. For example, the new test's 4,000-character input ('['.repeat(2000)+']'.repeat(2000)) expands to roughly 8 MB before being discarded. Wider structures at similar depth can expand substantially further while still fitting under the 64 KiB input limit. Because this executes synchronously when opening evidence, the fallback does not prevent main-thread stalls or memory pressure. Bound nesting depth or estimate indented output size before calling the pretty-printing stringify; retain the raw text when the bound is exceeded.
| const response=await fetch(source);if(!response.ok)throw Error('HTTP '+response.status); | ||
| text=await response.text(); | ||
| }if(pre.dataset.readable)text=text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g,c=>'\\x'+c.charCodeAt(0).toString(16).padStart(2,'0')); | ||
| }if(/\.json$/i.test((pre.dataset.file||pre.dataset.evidenceFile||'').split(/[?#]/)[0]))text=losslessJson(text) |
There was a problem hiding this comment.
JSON formatting is bypassed in packaged reports: loadDiagnosticEvidence delegates pre[data-file] to fill(pre) and continues before reaching this line. The generated log dialogs use data-file, and report-loader.js's fill writes the raw text without calling losslessJson, so those JSON records remain unformatted. Apply the same formatting in the delegated loader path and add a test exercising a JSON dialog with fill available.
|
Fixed the packaged-report bypass OCR found: |
There was a problem hiding this comment.
✅ Re-review complete · 41f078b
No findings in this incremental review.
… across tracks (#400) * Shared report charts, failure-first inventories and detail navigation across tracks * test(baselines): refresh after rebase on #401 * fix(reporting): paging follows track sort and inline filters, multi-select and button filters survive navigation, restore without track resets; Lexbench fallback within active filters * test(baselines): refresh for shared inventory script * fix(reporting): update pager attributes only when they change
Purpose
Second part of #398, after the correctness fixes in #399: track-specific readability findings and the #389 leftovers. Measured values (scores, counts, latencies) are unchanged in every track.
What changed
Browser Use
.audit-ladder span, so whole sentences turned into 30 px circles. It now applies only to.step-no. This also fixes the B7 vertical text at 390 px.break-all. The pairwise A/B headers are now registry baseline/comparison relations ("只有基线浏览器通过"). The evidence viewer is split into an overview of scalar fields, one section per nested record and an "All" view. The raw JSON download is kept.Trajectory Replay
<code>wraps at 390 px.Web Extract
aria-labelandaria-pressed.report.jsno longer lists product fields. Python injects them from the benchmark declaration.Web Fetch / WCXB / Codex saved matrix / Lexbench / WebMainBench
.jsonevidence is pretty-printed. Timeouts name the limit that fired against the call time. "English" already opens the not-generated notice.round_off_baseline. The run ID is secondary.Not changed here
reporting/publication_privacy._STAGED_EVIDENCEis still a ContextVar. Removing it means threading a staged-read resolver through about 120read_evidence_bindingcall sites. That is a refactor of its own, not a readability fix.Baselines
Changed intentionally, text, row order and hashes only:
browser-use*: lead, English rationales, pair labels, CSS.trajectory-replay*: diagnose buttons.web-extract-*: row order and eyebrow.web-fetch,wcxb,webmainbench-sampleandlexbench*: moved text and labels.No measured value changed. Allowlists are unchanged. The scorer hash is unchanged, because
src/lexbench_webfetch/was not touched.Verification
uv run --frozen --all-extras python -m pytest tests -n 8 --dist worksteal -q: 21674 passed, 78 skipped, 2 xfailed.lexbench-webfetch versionscoring hash unchanged (0fe89317…).make lint-checkpasses.Closes #398