You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The source PR added ten new lectures. Nine translated cleanly. lectures/phillips_lost_conquest.md failed the structural parity check — correctly; the translation came back with its directive sequence scrambled and the MyST target anchor dropped:
##[error]Error processing lectures/phillips_lost_conquest.md: Error: structural parity check failed:
- directive count differs: source has 28, output has 27
- directive #1 name changed: source line 15 has {raw}, output line 40 has {contents}
- directive #4 name changed: source line 68 has {code-cell}, output line 115 has {math}
...
- target anchors diverge — missing from output: (phillips_lost_conquest)=
That guard did exactly its job, and the failure issue (QuantEcon/lecture-python.myst#993) was filed with a correct \translate-resync recovery recipe. The problem is what happened next:
Processing TOC file lectures/_toc.yml...
Successfully processed lectures/_toc.yml
##[error]Translation completed with 1 errors
Creating PR in target repository...
Created PR: https://github.com/QuantEcon/lecture-python.zh-cn/pull/202
The committed lectures/_toc.yml carries - file: phillips_lost_conquest at line 131. The target build fails under -n -W: toctree contains reference to nonexisting document 'phillips_lost_conquest'.
Why this is worse than one absent file
The dangling reference is not confined to the TOC. The dropped lecture is cross-referenced from four of the nine siblings that did ship, so a partial run does not degrade gracefully to "nine good lectures and one to follow" — it degrades to nine lectures that each carry a broken cross-reference:
Location
Warning
lectures/intro.md
toctree contains reference to nonexisting document phillips_lost_conquest
lectures/phillips_drifts_volatilities.md:67
unknown document: phillips_lost_conquest
lectures/phillips_drifts_volatilities.md:2990
unknown document: phillips_lost_conquest
lectures/phillips_priors.md:523
unknown document: phillips_lost_conquest
lectures/phillips_two_stories.md:90
unknown document: phillips_lost_conquest
lectures/phillips_two_stories.md:539
unknown document: phillips_lost_conquest
When an upstream PR adds a coherent set of lectures that cite each other — which is the normal shape of a new lecture series — dropping any one member breaks the rest.
Mechanism
TOC processing runs unconditionally after the per-file loop and does not consult the run's error set; the TOC is then committed like any other output, and PR creation proceeds after Translation completed with N errors is already logged. The three stages each behave sensibly in isolation and there is no point at which the partial state is reconciled.
Declare the partial state on the PR. The body lists "Files Added" with a ✅ per file and says nothing about the file that failed. A "Files failed" section carrying the parity error and a link to the failure issue would stop a reviewer reading the red build as unexplained — at present the failure issue is filed in the source repo and nothing in the target PR points to it.
Consider whether a partially-translated new-file set should open a PR at all. Nine good translations are worth keeping rather than discarding, so 1 + 2 is probably the right balance, but the choice should be deliberate rather than incidental.
The first organic production sync on v0.23.0 (QuantEcon/lecture-python.myst#992 → QuantEcon/lecture-python.zh-cn#202) shipped a PR that cannot build, because the run committed a
_toc.ymlentry for the one file it had just refused to write.What happened
The source PR added ten new lectures. Nine translated cleanly.
lectures/phillips_lost_conquest.mdfailed the structural parity check — correctly; the translation came back with its directive sequence scrambled and the MyST target anchor dropped:That guard did exactly its job, and the failure issue (QuantEcon/lecture-python.myst#993) was filed with a correct
\translate-resyncrecovery recipe. The problem is what happened next:The committed
lectures/_toc.ymlcarries- file: phillips_lost_conquestat line 131. The target build fails under-n -W:toctree contains reference to nonexisting document 'phillips_lost_conquest'.Why this is worse than one absent file
The dangling reference is not confined to the TOC. The dropped lecture is cross-referenced from four of the nine siblings that did ship, so a partial run does not degrade gracefully to "nine good lectures and one to follow" — it degrades to nine lectures that each carry a broken cross-reference:
lectures/intro.mdphillips_lost_conquestlectures/phillips_drifts_volatilities.md:67phillips_lost_conquestlectures/phillips_drifts_volatilities.md:2990phillips_lost_conquestlectures/phillips_priors.md:523phillips_lost_conquestlectures/phillips_two_stories.md:90phillips_lost_conquestlectures/phillips_two_stories.md:539phillips_lost_conquestWhen an upstream PR adds a coherent set of lectures that cite each other — which is the normal shape of a new lecture series — dropping any one member breaks the rest.
Mechanism
TOC processing runs unconditionally after the per-file loop and does not consult the run's error set; the TOC is then committed like any other output, and PR creation proceeds after
Translation completed with N errorsis already logged. The three stages each behave sensibly in isolation and there is no point at which the partial state is reconciled.Suggested fix, cheapest first
_toc.yml, drop entries naming files the run failed to produce that are also absent from the target repo. Deterministic, no new inputs required, and would have made E2E harness: a full run should test a single release, not sync-at-ref plus review-at-@v0 #202 buildable on its own.Related