Skip to content

sync silently first-translates lectures missing from the target — unreachable when it succeeds, invisible when it fails #222

Description

@mmcky

On QuantEcon/lecture-python.zh-cn#208 — an organic production sync on v0.24.0 from source PR QuantEcon/lecture-python.myst#1006 — the run silently escalated from "apply an eight-line diff" to "translate two entire lectures from scratch". One of the two succeeded and was committed unreachable; the other failed and was dropped without a trace. Neither escalation is disclosed in the PR body, the sync metadata, or the review verdict.

What the source PR asked for

#1006 is a narrow change: add hidden pip install cells to nine lectures. Every file in it is +8/-0 or +1/-1.

Seven of those nine already existed in lecture-python.zh-cn, and the sync handled them correctly — I checked all seven diffs and they carry the pip cell and nothing substantive else.

The other two, olg_adaptive_money.md and learning_approximation.md, did not exist in the target at all. Both are present in the source _toc.yml (lines 124 and 125), so they are simply untranslated lectures — coverage gaps predating this PR. Rather than reporting that, the run translated both from scratch.

Defect A — when the implicit first-translation succeeds, the lecture lands unreachable

olg_adaptive_money.md was translated in full and committed at +1263 lines. Its state file records mode: NEW, so the engine is aware it did something other than a sync. QuantEcon/lecture-python.zh-cn#208 never touches lectures/_toc.yml.

Merged as-is, the target repo gains a 1263-line lecture that is in no toctree: not built, not linked, invisible to readers. Coverage metrics improve and the published site is unchanged. This is the exact mirror of #156 — there, a _toc.yml entry with no file; here, a file with no _toc.yml entry.

To be clear about what is not wrong: the translation itself is good. It is structurally parallel to source (62 fenced directives against 62, 23 headings against 23, 16 display-math blocks against 16), carries a complete 19-entry heading map and a translation.title, and includes the pip cell the source PR added. The output is fine; the delivery is broken.

Defect B — when it fails, the drop is completely silent

learning_approximation.md is listed in QuantEcon/lecture-python.zh-cn#208's translation-sync-metadata block as one of nine files. Only eight were delivered. It failed structural parity — the same file, from the same cause, that broke #207 the same weekend.

The difference is that QuantEcon/lecture-python.zh-cn#207 was adding _toc.yml entries, so its drop produced a dangling reference and a hard build failure. QuantEcon/lecture-python.zh-cn#208 wrote no _toc.yml entry, so the identical drop produced no dangling reference, no build failure, and no visible symptom of any kind. The only evidence is a nine-entry metadata array against an eight-file PR.

The consequence for #156 is that its observed incidence is an undercount. The defect is visible only when the run happens to also be writing ToC entries; when it is not, it fails completely silently. Both weekend PRs hit it — that is four field instances, not three.

Why the escalation is itself the problem

Concern Detail
No mandate The source PR changed eight lines. Nothing in it authorises translating a 53 KB lecture from scratch.
Wrong path's guard rails This is init work performed on the sync path, so it inherits none of init's handling — notably the ToC insertion gap tracked in #142, whose "walk the source TOC order and insert after the nearest preceding entry that exists in the target" algorithm is exactly what is missing here.
Not disclosed The PR body lists olg_adaptive_money.md under "Files Added" indistinguishably from a state file. Nothing says "this lecture was translated in full because the target lacked it", and nothing says a ninth file was attempted and dropped.
Not coordinated #207 independently first-translated the same lecture from an older source SHA. Two open PRs each create lectures/olg_adaptive_money.md and its state file; both read mergeable against main, so the collision only surfaces after the first merge.
Not caught in review The verdict scored scopeCorrect: false — correct outcome, wrong reason. It argued the file "already existed in the source's Before state, so it should have been an update", reasoning from the source when the relevant fact is the target. It never noticed the missing _toc.yml entry, and it scored the dropped ninth file as though it had never been attempted.

Suggested fix

The first question is a policy decision, not an implementation detail: should sync first-translate a file missing from the target at all?

If no — the run applies what it can, reports the gap explicitly (a failure issue or a PR-body section naming the untranslated lectures), and leaves seeding to init, where #142 and #134 are already tracked. This is the conservative option and it makes the coverage gap visible instead of half-closing it.

If yes — then the escalation must be complete rather than partial. It must insert the _toc.yml entry using #142's algorithm, and it must say in the PR body which files were first-translated rather than synced, so a reviewer knows the diff contains a full translation rather than an eight-line edit.

Either way, two things hold regardless of which is chosen:

Evidence

Fact Verified
olg_adaptive_money.md absent from lecture-python.zh-cn@main 404 via contents API
Present in source at 53,661 bytes, in source _toc.yml line 124 contents API + _toc.yml
QuantEcon/lecture-python.zh-cn#208 adds it at +1263/-0, state mode: NEW, tool-version: 0.24.0 PR files + state file
QuantEcon/lecture-python.zh-cn#208 touches no _toc.yml PR file list (16 files, none is _toc.yml)
QuantEcon/lecture-python.zh-cn#208 metadata lists 9 files, PR delivers 8 translation-sync-metadata block vs PR file list
learning_approximation.md absent from target and from both PRs; present in source at 31,311 bytes contents API
QuantEcon/lecture-python.zh-cn#207 also creates lectures/olg_adaptive_money.md (+1255/-0) and its state file PR file list

Engine version 0.24.0 throughout; both PRs carry engineVersion: 0.24.0 in their verdict blocks.

Refs: #156, #157, #142, #134, #117, #90

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghigh-priorityAddress soon

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions