Repository navigation
refactor(web-search): make English the source language of the report - #192
Conversation
Renderers pass English source text to one catalog lookup. messages.json maps that text to its Chinese translation instead of hash-derived IDs, and comparison.py and delivery.py no longer hold inline Chinese. Rendered pages keep the same bytes.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Head reviewed: d071ceee. I found no correctness defects, no bound-file edits and no rendered-output changes. There are three P3 findings, none of which changes rendered bytes.
Findings
P3: src/harness/web_search/report.py:3248-3250 (also :1926, :804): placeholder names do not describe their values.
The catalog key is what a translator or maintainer reads, and these names mislead:
{ids}is the defective-reference count (len(ids) - len(quality_ids)), and{ids_2}is the total.{value}in "from {value} physical requests" is a call count.{overview_case_ids}is a count, not IDs.
Suggested fix: rename them, for example to {defective}, {total}, {physical_calls} and {overview_cases}, in the key and the call. Rendered bytes stay the same.
P3: tests/web_search/test_messages.py:41-44: the lint is tied to unrelated details of pages.py.
assert dynamic == [("pages.py", 28)] fails if a line is added above that call. The 14 navigation labels are also copied by hand from the pages.py registry.
Suggested fix: compare only the file name for the dynamic lookup, and derive the navigation keys from pages._STANDARD, pages._COMPARISON and the review row.
P3: PR body, "Dead entries removed": the two named examples were not dead.
review_failures and review_unreviewed were both referenced by review.py at base. They were migrated with the same Chinese values, to "Review covers failed outputs; passing outputs are outside this review." and "Accepted passing outputs without review: ".
About 29 other entries had no reference in the six renderer modules at base, such as 非空成功响应耗时 and 排除镜像后.
Suggested fix: correct the sentence so the merge record does not suggest that review text was dropped.
What I verified
Output comparison
- I ran
tests/web_searchserially against base2c8a6947and this head, then compared every generated file. All 1,187 HTML, JS and CSS files were byte-identical after normalizing the temp root, which reproduces the PR's figure. - The PR left the other differing files unchecked, so I parsed them. The JSON differences are in timestamps, durations, PIDs, hashes, the revision and path-valued fields, plus a few fields I did not inspect individually (for example
.model[]and.environment.HOME). Differing JSONL and zip files were counted but not parsed. Nothing I inspected changed report wording. - A rebuilt example manifest differs only in
renderer_sha256,browser_evalandbundle, and that rebuild was not run under the golden test's pinned identity.tests/test_golden_reports.pypasses with only themanifest.jsonhash changed in the snapshot.
Branches the tests do not reach
These checks are static, because no measured Web Search evidence was available to rebuild.
- I compared old and new call sites by AST, inlining the old fragment lookups. Each English/Chinese pair matches base, including format specs such as
{value:.1f}. The exceptions are the zh-only entries the PR says got new English keys, which I checked by value instead. - Per-label Chinese wording counts match base. The small count differences trace to old table-header lists my pairing could not read.
- A site-by-site Chinese sequence comparison found only extraction artifacts: moved literal fragments and punctuation.
- All 18 non-navigation
context|keys and thenavigation|labels keep the base wording. - Every Chinese fragment in the new catalog exists in the base catalog or base source, so no Chinese was reworded. New English appears only in keys for zh-only text.
Helper semantics
- No template contains literal
{{or}}, and none uses the reserved nameszh,contextorsource. - Every
tcall sits in the scope that binds itszh. Thepage()helper is the only apparent exception, and it receivestthrought=t, as the old code did. - No
tcall passes a second positional argument, and noreport_textcall omitszh. - Values are now evaluated for both editions. The new eager expressions I checked, such as the partial-charge
sumand thelenvalues, are harmless on these inputs.
Bindings and scope
collection_implementation()lists no file that this PR edits, and nothing undersrc/lexbench_websearch/changed.evaluation/does not reference the edited renderers.visual.pyhashespages.pyfor capture producers, andrenderer_sha256hashesreport.py. Both are expected to change with the code and are not frozen inputs.- Han characters remain only in
messages.jsonacrosssrc/harness/web_search/,src/lexbench_websearch/andexamples/web_search/, so the #185 scope is met. - The three Chinese punctuation marks still rendered in both editions are tracked in open issue #191, which is a fair deferral because fixing them changes bytes.
- No old
text_<hash>IDs remain, andmessages.jsonis still package data.
New lint
Mutations made tests/web_search/test_messages.py fail for a missing key, an unused key, a missing value and a wrong placeholder name.
Runs on this head
tests/web_search,tests/test_source_language_policy.py,tests/test_golden_reports.pyandtests/test_report_locales.py: 542 passed, 45 subtests passed.tests/test_report_software_versions.py,tests/package_smoke.pyandtests/test_golden_reports.py: 38 passed.- Ruff, both the F,TID252 gate and the default config: passed.
- CI on
d071ceee: all checks pass, including "Tests and static checks" and "Installation and packaging". The PR is mergeable and based on current main.
There was a problem hiding this comment.
✅ Re-review complete · 9f4f975
No findings in this incremental review.
|
Review round 1 fixes, all three findings addressed and none disputed.
Local run: 571 passed and 45 subtests passed across the Web Search, source-language policy, golden, locale, software-version and package-smoke targets. Ruff passed. CI on the new head is pending. |
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Head reviewed: 9f4f9759. No defects found.
Round 1 findings
All three are fixed. Catalog placeholders are named after their values, the catalog lint derives navigation keys from reader_pages and compares only the file name for the dynamic lookup, and the PR body's dead-entries bullet is corrected.
What I verified
- Old and new text, by parsing. I parsed
report.py,comparison.pyandreview.pyat base2c8a6947and at this head, and resolved every oldtext_<hash>ID. For each function I expanded the new templates with their keyword expressions and compared the (English, Chinese) pairs, including format specs such as:.1f. I checked the differences and leftover non-pair expressions by hand. The differences are the helper bodies, the old.replacefragments infactual_panelthat are now single templates, and the.getlookups for the language name and the dataset label, which keep the same strings. None changes a rendered string. - Labels with several Chinese wordings. There are 20 such labels. I compared their order within each function, so a wrong
context|at a call site would show up. Onlyfactual_paneldiffers, because its.replacechain now uses the catalog. Those Chinese strings match the old ones. - Late binding. The old local
treadzhwhen called andpartialbinds it when created.zhis only assigned in thebuildlanguage loop, beforetis created there, so behaviour is the same. No call passes azh=override. - Direct byte comparison at base and head.
reader_pagesfor both presentations,relevance.ANNOTATION_HTMLanddelivery.BRIDGEhash identically. - Bound files. None of the changed files is in
collection_implementationor undersrc/lexbench_websearch/.visual.pyhashespages.pyinto capture receipts, but no versioned file underevaluation/orconfigs/references that capture schema orrenderer_sha256. - Catalog. There are no duplicate JSON keys, and every lookup uses a literal key with a literal context. No lookup passes a value that neither template uses. Five entries have different placeholders in English and Chinese; each comes from an old call where only one language showed the value, so they are not bugs.
- Scope of #185.
src/harness/web_search/has no Han characters outsidemessages.json, and no reference totext_<hash>IDs remains in the repository. The body'sCloses #185holds. I did not rebuild a measured report, because no real evidence exists on this machine; the parsed comparison above covers branches the synthetic build does not reach. - Lint. Adding an unused catalog key makes
test_messages.pyfail. I restored the file afterwards.
Tests
tests/web_search,tests/test_source_language_policy.py,tests/test_golden_reports.py,tests/test_report_locales.py,tests/test_report_software_versions.pyandtests/package_smoke.py: 571 passed, 45 subtests passed.- Both ruff gates passed.
- In
tests/golden/web-search.jsononlymanifest.jsonchanged, because itsrenderer_sha256hashesreport.py.
CI on 9f4f9759
"Tests and static checks", "Installation and packaging", "Rendered reference and report checks", "Python 3.11" and "Select check scope" all pass.
Issues
Closes #185
Part of #99 and #120 (each stays open for the other tracks).
Summary
English is now the source language of the Web Search report, and Chinese is only a catalog translation.
messages.pyexposesreport_text(source, zh, *, context=None, **values)andzh_text(source, ...). The localt(en, cn)helpers are nowpartial(report_text, zh=zh), so a call site readst("Known page@{cutoff}", cutoff=cutoff).messages.jsonno longer usestext_<sha256(zh)>IDs. It maps the English source text to Chinese. Chinese sentences that were split into fragments around values are now single templates with named placeholders.context|keys. 18 English labels had more than one existing Chinese wording, such asMethodas 方法 or 接口. Acontext|key keeps each wording, so the bytes do not change. Page navigation labels usenavigation|.comparison.pyanddelivery.pymoved to the catalog and joinedCATALOG_RENDERERS, so the source-language policy now rejects inline Chinese in them.text_94ad856f2c0d1003(非空成功响应耗时).review_failuresandreview_unreviewedwere not dead:review.pyused both, and they moved to English keys with the same Chinese values.tests/web_search/test_messages.pyfails on a missing or unused key, a non-English key, a placeholder that is not supplied, a placeholder namedidsor with a numeric suffix, or inline Chinese in the renderers. Navigation keys come fromreader_pages, not a copied list.Rendered output
Only one golden route changed for
web-search:manifest.json. Itsrenderer_sha256field hashesreport.py, so any edit to that file changes it. Every other route hash is unchanged.The golden snapshot only builds the synthetic example, so I also compared wider output. I ran
tests/web_searchagainst both base2c8a6947and this branch, with temp directories kept, and compared every generated file.Left unchanged
collection_implementationbindsrunner.py,core.py,adapters.py,profiles.pyand shared modules, andscoring_source_sha256bindssrc/lexbench_websearch/. None were edited. Of these, onlyharness/web_fetch/config.pycontains Chinese characters. It stays as it is because the binding prevents the edit, and it belongs to the Web Fetch track anyway.reasoninrelevance.pyis written into judge results. Only its key changed; its Chinese value is the same.:inreview.py, and、and;inreport.py, render in English pages too. Fixing that would change rendered bytes, so it is left for follow-up Stop rendering Chinese punctuation on English Web Search pages #191.Test plan
All run locally on the final commit:
tests/web_search,tests/test_source_language_policy.py,tests/test_golden_reports.py,tests/test_report_locales.py,tests/test_report_software_versions.pyandtests/package_smoke.py: 571 passed, 45 subtests passed.tests/web_search, as described above: 0 of 1,187 HTML, JS and CSS files differ. This ran before the placeholder rename in36dd1cb3. For that rename I formatted each of the 5 renamed keys and translations with the old and new names and got the same strings, and the golden snapshots show onlymanifest.jsonchanged.