Skip to content

refactor(trajectory-replay): make English the source of the replay report renderers - #240

Merged
lanyue-llk merged 2 commits into
mainfrom
refactor/replay-report-english-source
Nov 4, 2026
Merged

lanyue-llk merged 2 commits into
mainfrom
refactor/replay-report-english-source

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What, why and how of this PR

Issues

Part of #99. This covers the replay step of the issue for the three named renderers. What remains in #99:

Summary

Interface text in the replay renderers now has English as its source, read through the existing report_text lookup. Chinese lives in trajectory_replay/messages.json under 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:

File Before After
trajectory_replay/report.py 203 2
trajectory_replay/webarena_report.py 44 8
trajectory_replay/public_webarena/report.py 346 27

Counting CJK punctuation as well, the same files go 214 to 2, 46 to 8 and 360 to 27.

test_report_messages.py now also covers report.py and public_webarena/report.py, so the existing checks for semantic IDs, literal English, placeholders and unused catalog keys apply to them. They cannot join CATALOG_RENDERERS yet 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_FINDING and MOLI_TIMING_STUDY.
  • public_webarena/report.py:
    • The selection rationale prose on the research page, including the engineering ranking reasons.
    • The three qualification rows with the 179, 4, 3 and 30 counts.
    • The remaining-boundaries list that names the 30-task subset.
  • webarena_report.py:
    • The execution convergence panel of the catalog report.
    • The method page paragraphs, including the runtime, revision and request bridge sentences.
    • The release check phrase that pins one of those paragraphs.

Hash bindings

I searched evaluation/, configs/ and the source tree for anything naming these files or messages.json, and nothing binds them by hash, so no file was left out.

  • configs/report-templates.json names webarena_report.py by path only.
  • The builder source_sha256 is a whole-tree identity that changes on every commit.

Behavior notes

  • CATALOG_SITE_LABELS became _catalog_site_labels(), so the module does not need a global t next to its per-language local ones.
  • The catalog release check now matches the full 通过后不再执行该 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.
  • The catalog report has no golden, and goldens only reach exercised branches, so I also ran a one-off AST comparison against 8f2232b7 (not committed). It replaces each t() call with its Chinese template and the same value expressions, normalizes both trees and diffs them.
    • report.py and public_webarena/report.py: the only differences are the new import and the t assignment.
    • 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.
  • Lint gate: ruff check --config 'include=["*.py"]' --select F,TID252 . and ruff check both pass.
  • Round 1 follow-up: the AST comparison predates the split of curated.recommendation.tied and curated.recommendation.tied_all. For that split, _recommendation output compared byte-identical in Chinese before and after, for all three tie shapes, and the goldens still pass with no regeneration.
  • I did not run the full suite locally; CI is that gate.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Review complete · 3650bbd

No findings in this review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, subject has no leading space, so English gives In this runboth Provider have the same number of correct results.
  • src/harness/trajectory_replay/public_webarena/report.py:621 and :577: {failure_summary}A completed ... gives No result failed in this run.A completed tool-call chain.
  • src/harness/trajectory_replay/public_webarena/report.py:622 and :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_failures and public.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 each t() call with its Chinese catalog template and value expressions, flattens the f-strings and diffs the unparsed trees.
    • report.py and public_webarena/report.py: the only differences are the import and the t assignment.
    • 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.py passes and no snapshot changed.
  • Shadowing: the only other local t in report.py and public_webarena/report.py is the comprehension variable in len(t) for t in traces, which does not reach any lookup. In webarena_report.py, each new local t is bound before it is used, and existing per-language t bindings 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.json has no removed lines, only additions. test_report_messages.py now covers report.py and public_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/ and configs/ name these files only by path, in configs/report-templates.json. The builder source_sha256 is the whole-tree identity. Nothing needed to be left out.
  • Scope: "Part of #99" is accurate, and trajectory_replay/core/report.py does still hold Chinese as the PR says.
  • Over-design: the PR adds no lookup, linter or registry, and test_report_messages.py changes by one line.
  • Lint: both ruff gates pass.
  • Tests run locally: tests/test_golden_reports.py, tests/trajectory_replay/test_report_messages.py and tests/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.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Review round 1 fixes, in 96c9674:

Fixed (P3): the English sources that are spliced into longer sentences are now spaced. public.summary.failure_summary, public.summary.no_failures and public.summary.ratio_intro end with a space, and the tie where every provider leads has its own entry, curated.recommendation.tied_all, so English reads "In this run, both providers have ...". curated.recommendation.tied now takes {leaders} instead of a pre-spaced {subject}.

Also fixed, same defect: the English source of curated.parties.all had a trailing space that produced "tasks all providers passed".

Chinese output is unchanged: golden snapshots pass with no regeneration, and _recommendation output compared byte-identical before and after for all three tie shapes. Added test_english_sentences_spliced_before_more_text_end_with_a_space and test_english_tied_recommendation_reads_as_a_sentence.

Nothing disputed.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Review complete · 96c9674

No findings in this review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 t assignments;
    • CATALOG_SITE_LABELS becoming _catalog_site_labels(), with the same values;
    • the _recommendation tie split, read by hand: 本轮 plus {count} Provider and 本轮 {leaders} produce the same strings as the old subject;
    • 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.
  • Catalog. No existing zh entry changed and the en section is identical. It grew from 335 to 982 zh keys.

  • Goldens. tests/test_golden_reports.py passes 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.all no longer produces a double space, and curated.recommendation.tied_all is a separate entry. catalog.index.lead, the one adjacent t() 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.py 203 to 2 214 to 2
    webarena_report.py 44 to 8 46 to 8
    public_webarena/report.py 346 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.json is the only hit in evaluation/, configs/ and research/. The PR description says it names webarena_report.py by path only, and nothing in this diff touches evidence.

  • Over-design. No new lookup, linter, registry or helper layer. test_report_messages.py only extends its existing RENDERERS tuple and adds two small tests for the round 1 fixes.

  • Scope. Part of #99 is accurate. trajectory_replay/core/report.py still 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.py gave 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".

lanyue-llk added a commit that referenced this pull request Nov 4, 2026
…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.
@lanyue-llk
lanyue-llk force-pushed the refactor/replay-report-english-source branch from 96c9674 to 3f3b70e Compare November 4, 2026 12:28

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Review complete · 3f3b70e

No findings in this review.

@lanyue-llk
lanyue-llk merged commit d905949 into main Nov 4, 2026
7 checks passed
@lanyue-llk
lanyue-llk deleted the refactor/replay-report-english-source branch November 4, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant