Repository navigation
fix(web-search): stop rendering Chinese punctuation on English pages - #212
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Reviewed head 86b64db8 against base 0565b4ab, which is still the tip of main. No defects found.
What I verified
-
Separator swaps, byte level.
t(", ")andreport_text("; ", zh)resolve to the old、and;in Chinese."{label}: {count} findings"yields the samelabel:N 条发现bytes as the old concatenation. In English they yield,,;and:. Removing" findings"leaves no other callers. -
Base and head builds compared. I built a two-edition synthetic report on each commit, with requested sites, independent benchmark populations and a query containing all three marks. I also rendered the review summary directly with all five resolutions.
- The only HTML routes that differ are
en/index.htmland the twoen/details/fixture-1-*.htmlpages. manifest.jsondiffers only inrenderer_sha256and the hash ofbrowser-eval-version.json, which records the checkout it was built from.- The Chinese review summary is byte-identical. The English summary differs only at the separator.
- The only HTML routes that differ are
-
Marks left on English pages. In that build they appear only in the measured query, on
en/dataset.html, the two detail pages and the data script inen/results.html. No literal or escaped mark remains in anysrc/harness/web_search/*.pyfile, apart from the check's own regex. -
Golden snapshot. The only moved entry is
manifest.json, which matches the PR's explanation.renderer_sha256is written only to the build manifest, so no profile or evidence binding depends on it. -
Tests fail without the fix. Each mutation below made the relevant tests fail:
- restoring the literal
、or; - disabling
_check_english_separators - dropping either of its selectors
- setting the catalog value for
", "to an English comma
The findings separator has no separate mutation. Its assertion compares the exact rendered text of both editions, and the source scan in
test_messages.pyrejects a literal mark. - restoring the literal
-
Release check scope. The selectors match only report-authored places, so a measured query with all three marks still passes.
check()skips the scan only forevidence_only=True, which the evidence-reading callers use. Scanning only these places instead of the whole page follows the AGENTS.md rule that measured text stays verbatim. -
Scope.
Closes #191is accurate: all three marks, the snapshot explanation and the negative controls are done. The diff touches no evidence, profile or receipt.
Test results
tests/web_search,tests/test_golden_reports.pyandtests/test_source_language_policy.py: 551 passed, 45 subtests passed.- Lint gate: passed.
- CI on this head: all checks pass, including "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".
Not verified
- I did not run the browser visual gate.
- I did not run the check against a real report instance. A real report whose English population label contains one of these marks would now fail the check. That looks like the intended result, because those labels are report-authored.
The review findings list, requested sites and population scopes now take their separators from the message catalog, so English pages use English punctuation and the Chinese edition keeps its bytes. The release check rejects those marks in these report-authored places on English pages, and leaves measured queries and responses verbatim.
86b64db to
05c86a5
Compare
Issues
Closes #191
Summary
English Web Search pages no longer render the three Chinese punctuation marks from the issue. The Chinese edition keeps its bytes.
review.pyCorrected:1 findingsCorrected: 1 findingsreport.pyone.invalid、two.invalidone.invalid, two.invalidreport.pyA 1 queries;B 1 queriesA 1 queries; B 1 queriesAll three now go through the message catalog. The catalog gains
", "and"{label}: {count} findings". The second key replaces" findings", which nothing else used."; "was already there.Release check
check()now fails when an English route has one of these marks in the findings list, the population note or the requested-sites paragraph.It looks only at those places, not the whole page. English routes keep measured queries and responses verbatim, so a Chinese query may contain these marks, and a whole-page scan would reject valid reports. A test covers this case: a query containing all three marks still passes.
test_messages.pyalso rejects the marks in catalog keys and renderer source, so a new inline use fails even outside those three places.Golden snapshot
One route moved:
manifest.json: onlyrenderer_sha256changed, because the manifest records the hash ofreport.py, which this PR edits. I diffed a normalized base build against this branch to confirm that this is the only changed line.No HTML route moved. The snapshot's example builds the Chinese edition plus the English not-generated notice, so it doesn't cover English pages or any of the three places. The new tests in
test_search_languages.pycover those instead.I also built a richer two-edition synthetic report on base and on this branch, with requested sites and independent benchmark populations, and rendered the review summary directly with findings:
en/index.html, the twoen/details/fixture-1-*.htmlpages and the English review summary, each with the expected separator change.Test plan
tests/web_search,tests/test_golden_reports.pyandtests/test_source_language_policy.py: 551 passed, 45 subtests passed.check().ruff checkwithF,TID252, then default): passed.