Repository navigation
refactor(trajectory-replay): make English the source of the replay report renderers - #240
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Head reviewed: 3650bbd. No P0, P1 or P2 defects found. One P3 finding, in English text that is not rendered today.
Findings
P3: three English sources join sentences without a space (no effect on current output)
src/harness/trajectory_replay/report.py:386:"In this run{subject} have ...". When every provider ties,subjecthas no leading space, so English givesIn this runboth Provider have the same number of correct results.src/harness/trajectory_replay/public_webarena/report.py:621and:577:{failure_summary}A completed ...givesNo result failed in this run.A completed tool-call chain.src/harness/trajectory_replay/public_webarena/report.py:622and:563:{ratio_intro}Only values ...gives... then aggregated.Only values.
I evaluated the first two through report_text("en"); the third has the same shape. All three renderers are Chinese-only for now, so these appear only when English is switched on. Suggested fix:
- Add a trailing space to the English sources of
public.summary.failure_summary,public.summary.no_failuresandpublic.summary.ratio_intro. - Give the all-providers tie its own catalog entry with properly spaced English.
Both changes only touch English source text, so the Chinese catalog text and the goldens stay as they are.
What I verified
- Byte equivalence: I wrote my own AST comparison against
8f2232b7. It replaces eacht()call with its Chinese catalog template and value expressions, flattens the f-strings and diffs the unparsed trees.report.pyandpublic_webarena/report.py: the only differences are the import and thetassignment.webarena_report.py: the only differences are that setup,_catalog_site_labels()and the release check change to the full通过后不再执行该 case。phrase. That phrase is still rendered in full on the index page.
- Goldens:
tests/test_golden_reports.pypasses and no snapshot changed. - Shadowing: the only other local
tinreport.pyandpublic_webarena/report.pyis the comprehension variable inlen(t) for t in traces, which does not reach any lookup. Inwebarena_report.py, each new localtis bound before it is used, and existing per-languagetbindings are unchanged. - Placeholders: format specs match between English and Chinese for every used ID. The one exception is
verdict.not_passed, whose Chinese text was already in the catalog before this PR. - Catalog:
messages.jsonhas no removed lines, only additions.test_report_messages.pynow coversreport.pyandpublic_webarena/report.py. - Han line counts: these match the PR table: 203 to 2, 44 to 8, 346 to 27.
- Text left in place: every remaining Han line falls under the cohort prose the PR lists. The new catalog text is interface or method wording, and no measured or dataset text moved into it.
- Hash bindings:
evaluation/andconfigs/name these files only by path, inconfigs/report-templates.json. The buildersource_sha256is the whole-tree identity. Nothing needed to be left out. - Scope: "Part of #99" is accurate, and
trajectory_replay/core/report.pydoes still hold Chinese as the PR says. - Over-design: the PR adds no lookup, linter or registry, and
test_report_messages.pychanges by one line. - Lint: both ruff gates pass.
- Tests run locally:
tests/test_golden_reports.py,tests/trajectory_replay/test_report_messages.pyandtests/test_source_language_policy.py: 42 passed. I did not rerun the rest of the suite and relied on CI. - CI on this head: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all pass.
|
Review round 1 fixes, in 96c9674: Fixed (P3): the English sources that are spliced into longer sentences are now spaced. Also fixed, same defect: the English source of Chinese output is unchanged: golden snapshots pass with no regeneration, and Nothing disputed. |
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Head reviewed: 96c96748, base 8f2232b7 (still the tip of main). No defects found.
What I verified:
-
Rendered Chinese is unchanged. I wrote my own AST comparison against the base, separate from the author's. It replaces each
t()call with its Chinese catalog template on both sides, then compares per function. The only differences in the three renderers are:- the new import and
tassignments; CATALOG_SITE_LABELSbecoming_catalog_site_labels(), with the same values;- the
_recommendationtie split, read by hand:本轮plus{count} Providerand本轮 {leaders}produce the same strings as the oldsubject; - the English-notice lookups, which my comparison did not resolve (they use
report_text("zh")(...)). They keep the same markup around the catalog text. I did not compare the catalog values for those keys with the old英文报告未生成text by hand; - the release check now matching
通过后不再执行该 case。, which the page renders from the same catalog ID.
- the new import and
-
Catalog. No existing
zhentry changed and theensection is identical. It grew from 335 to 982zhkeys. -
Goldens.
tests/test_golden_reports.pypasses and no snapshot file is in the diff. -
Round 1 fixes are in place. The three
public.summary.*sources end with a space,curated.parties.allno longer produces a double space, andcurated.recommendation.tied_allis a separate entry.catalog.index.lead, the one adjacentt()join in the catalog report, also ends with a space. -
Line counts match the PR description.
File Han lines Han and CJK punctuation lines report.py203 to 2 214 to 2 webarena_report.py44 to 8 46 to 8 public_webarena/report.py346 to 27 360 to 27 -
Text left in place matches the "Left in place" list. Every remaining Han line in the three files is cohort prose or the release check phrase that pins it. I read the new catalog entries for cohort counts and measured text and found none moved in.
-
Hash bindings.
configs/report-templates.jsonis the only hit inevaluation/,configs/andresearch/. The PR description says it nameswebarena_report.pyby path only, and nothing in this diff touches evidence. -
Over-design. No new lookup, linter, registry or helper layer.
test_report_messages.pyonly extends its existingRENDERERStuple and adds two small tests for the round 1 fixes. -
Scope.
Part of #99is accurate.trajectory_replay/core/report.pystill has 20 Han lines and is listed as remaining.
Test results:
- Local:
tests/test_golden_reports.py tests/trajectory_replay tests/test_source_language_policy.pygave 2266 passed, 4 skipped. Both ruff gates pass. - CI on this head: all checks pass, including "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".
…port renderers Move interface text in report.py, public_webarena/report.py and the webarena_report.py catalog report to t(id, english) lookups, with Chinese in messages.json under stable semantic IDs. Rendered output is unchanged. Cohort prose stays in place.
96c9674 to
3f3b70e
Compare
Issues
Part of #99. This covers the replay step of the issue for the three named renderers. What remains in #99:
trajectory_replay/core/report.pyand the replay JS assets, which still hold Chinese and were not in this scope.Summary
Interface text in the replay renderers now has English as its source, read through the existing
report_textlookup. Chinese lives intrajectory_replay/messages.jsonunder stable semantic IDs (replay.*when shared,curated.*,public.*,catalog.*). No new lookup, linter or registry. All three renderers still generate Chinese only, so the inline English is not rendered yet.Lines containing Han characters:
trajectory_replay/report.pytrajectory_replay/webarena_report.pytrajectory_replay/public_webarena/report.pyCounting CJK punctuation as well, the same files go 214 to 2, 46 to 8 and 360 to 27.
test_report_messages.pynow also coversreport.pyandpublic_webarena/report.py, so the existing checks for semantic IDs, literal English, placeholders and unused catalog keys apply to them. They cannot joinCATALOG_RENDERERSyet because of the prose left in place.Left in place: cohort prose
These passages describe one specific cohort or run, so they belong in bound report content rather than the interface catalog. They are byte-identical to before.
report.py:MOLI_TIMING_FINDINGandMOLI_TIMING_STUDY.public_webarena/report.py:webarena_report.py:Hash bindings
I searched
evaluation/,configs/and the source tree for anything naming these files ormessages.json, and nothing binds them by hash, so no file was left out.configs/report-templates.jsonnameswebarena_report.pyby path only.source_sha256is a whole-tree identity that changes on every commit.Behavior notes
CATALOG_SITE_LABELSbecame_catalog_site_labels(), so the module does not need a globaltnext to its per-language local ones.通过后不再执行该 case。message instead of a substring of it, through the same catalog ID the page renders.Test plan
tests/test_golden_reports.py: passes with no regeneration, so no golden route changed. It covers the curated, public and replay report tracks.8f2232b7(not committed). It replaces eacht()call with its Chinese template and the same value expressions, normalizes both trees and diffs them.report.pyandpublic_webarena/report.py: the only differences are the new import and thetassignment.webarena_report.py: the only differences are that same setup, the site label function and the release check change above.pytest tests/test_golden_reports.py tests/trajectory_replay tests/test_source_language_policy.py tests/test_public_report_language.py tests/test_report_locales.py tests/test_report_software_versions.py tests/test_report_templates.py -n 2: 2374 passed, 4 skipped.ruff check --config 'include=["*.py"]' --select F,TID252 .andruff checkboth pass.curated.recommendation.tiedandcurated.recommendation.tied_all. For that split,_recommendationoutput compared byte-identical in Chinese before and after, for all three tie shapes, and the goldens still pass with no regeneration.