Skip to content

Sync/upstream 2026 10 - #517

Closed
yennanliu wants to merge 507 commits into
rohitg00:mainfrom
yennanliu:sync/upstream-2026-10
Closed

yennanliu wants to merge 507 commits into
rohitg00:mainfrom
yennanliu:sync/upstream-2026-10

Conversation

@yennanliu

Copy link
Copy Markdown

What this PR does

Kind of change

  • New lesson
  • Fix to an existing lesson
  • Translation
  • New output (prompt, skill, agent, MCP server)
  • Docs / website / tooling

Checklist

  • Code runs without errors with the listed dependencies
  • No comments in code files (docs explain, code is self-explanatory)
  • Built from scratch first, then shown with a framework (for new lessons)
  • Lesson folder matches LESSON_TEMPLATE.md structure
  • ROADMAP.md row for the lesson is a markdown link ([Name](phases/...)), not bare text
  • One lesson per commit (atomic per-lesson rule)
  • Tested locally / code output matches what docs/en.md claims

Phase / lesson

Notes for reviewer

jim and others added 30 commits August 2, 2026 17:24
jim and others added 28 commits September 8, 2026 18:53
Adds quiz.zh.json; the lesson body was already translated.
Adds quiz.zh.json; the lesson body was already translated.
Adds quiz.zh.json; the lesson body was already translated.
Adds quiz.zh.json; the lesson body was already translated.
Adds quiz.zh.json; the lesson body was already translated.
Adds quiz.zh.json; the lesson body was already translated.
The phase-13/22 zh retranslation dropped the last ```figure t3-skill-layers
fence in the corpus, which came from the superseded lesson that zh.md still
translated. figure-manifest.js is gitignored and rebuilt, so its content hash
moved while lesson.html kept the old ?v=, failing the build-artifact test.
The MCP caching page is published under server/utilities/caching, not
basic/utilities/caching, which returns 404. Fixed in en.md and zh.md
together so the translation stays byte-identical on links.
Syncs 7 upstream commits: the AI Engineering Learning Paths feature, 12 new
Phase 14 lessons (43-54), server-rendered /lesson and /certification SEO
routes, and three book-rendering fixes.

Conflicts, and how each was resolved:

- site/build.js, site/content-source.js, site/lesson.html — upstream replaced
  the hardcoded repo slug with window.__AIFS_SOURCE, but resolves owner/repo
  from VERCEL_GIT_REPO_OWNER/SLUG only, which GitHub Pages never sets. Kept
  upstream's shape and slotted the fork's GITHUB_REPOSITORY -> origin-remote
  resolver underneath as the fallback, so a Pages build still serves its own
  lesson markdown instead of upstream's. build-meta.js keeps emitting
  __AIFS_REPO alongside __AIFS_SOURCE.
- site/assessment.html, site/certification.html — kept the fork's i18n script
  tags, took upstream's header.js cache-buster.
- site/lesson.html continue-panel link — took upstream's clean /lesson URL,
  kept the fork's translated label.
- .gitignore — kept both ignore blocks.
- .github/workflows/build-book.yml — kept fonts-noto-cjk (the zh-Hant PDF
  renders blank without it) and added upstream's poppler-utils and the new
  book-rendering validation step.
- i18n/pt, i18n/ru README headings — took upstream's translations.
- site/data.js — regenerated with node site/build.js.

Verified: audit_lessons.py clean (523 lessons, 0 issues), check_readme_counts
matches, no file deleted relative to main.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…tion

Upstream now rewrites /lesson and /certification to /api/lesson and
/api/certification so Vercel can server-render their SEO <head>, and 664
links across the site moved to the clean /lesson?path= URL. GitHub Pages
runs no functions, so pages_aliases.mjs was writing a stub that redirected
every lesson link to a 404.

Map each /api/ destination to the template its function renders — the page
works, only the prerendered metadata is missing — and skip any /api/
destination without a static equivalent rather than emitting a dead stub.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The SEO manifest test pinned sourceUrl to github.com/rohitg00/…, which fails
in a fork whose build correctly resolves its own owner. Compare against
githubSourceUrl() instead, so the assertion still proves the URL points at
the repo the site was built from.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
i18n_curriculum.py exits non-zero when a phase's translation list and lesson
list disagree, so the generator was blocked at 42 titles for 54 lessons.
Lesson bodies stay English until docs/zh.md lands for each; lesson.html
already falls back per lesson.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both files conflicted in the upstream merge and were resolved by taking
upstream's side whole, which restored upstream's "From the creator of Agent
Memory" promo in place of this fork's "Demo code" section. The other ten
languages already carried the fork's version, so build_readme_i18n.py --check
failed the curriculum job with "stale README translations: ['pt', 'ru']".

Regenerated from README.md, which keeps upstream's newly translated "start
here" headings and restores the fork's section. All twelve languages now
match the generator's output.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The merge resolution put resolveRepo() inside sourceRepository(), which
githubSourceUrl() calls once per lesson while building the SEO manifests. With
GITHUB_REPOSITORY unset the resolver shells out to `git remote get-url origin`,
so a build spawned ~560 subprocesses: 0.78s -> 5.7s.

That hit every local build and every Vercel deploy — Vercel exports
VERCEL_GIT_REPO_OWNER, not GITHUB_REPOSITORY, so the fallback ran and its
result was then discarded. CI was unaffected, which is why it stayed hidden.

Memoize the resolver and take the Vercel env vars before computing a fallback
at all. Back to 0.78s; all three resolution paths still produce the same
build-meta.js.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
pages_aliases.mjs had no test, and it is the only thing turning vercel.json's
clean URLs into something GitHub Pages can serve. That gap is what let /lesson
redirect to /api/lesson — a serverless route Pages cannot run — on a deploy
where hundreds of links point at it.

The load-bearing assertion is that every stub the generator writes resolves to
a file that actually ships in site/; the rest cover the serverless fallback,
skipping an /api/ destination with no static equivalent, leaving conditional
rewrites to Vercel, relative targets (this fork publishes under a
/ai-engineering-from-scratch/ base path), and carrying the query string
through the redirect, which is the entire payload of a /lesson?path= link.

Verified against the pre-fix generator: 4 of the 6 fail, the first with
"/lesson redirects to ../api/lesson, which does not exist in site/".

Runs in pages.yml, which is fork-only, so the pristine upstream curriculum.yml
stays conflict-free on the next sync. Added a pull_request trigger and a
read-only validate job so a broken rewrite fails review instead of failing a
publish; deploy now waits on it and stays push-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The largest fork-only script had no test and ran in no workflow, while
rewriting a committed file in place. Its pairing is positional — title N in
TITLES_ZH goes to lesson N out of data.js — so a length disagreement would
attach every later title to the wrong lesson. It refuses to run instead, which
is exactly what fired when upstream added twelve lessons to phase 14, and
nothing but a hand-run would have revealed it.

17 tests: the count guard, idempotent regeneration, replacing the previous
generated block rather than stacking a second, hand-written keys winning over
generated ones in the flat namespace, and emit()'s dedup, wrapping and
non-escaped CJK.

The last test is the --check this script never had: regenerate into a temp
root and compare against the committed dictionary, so staleness fails CI
instead of silently serving English. It copies the repo rather than writing to
it, so an interrupt cannot leave the real file half-written.

main() was called at import, so the module could not be imported without
rewriting the dictionary; it now sits behind a __main__ guard. Running the
script is unchanged.

Verified by mutation: dropping the count guard fails the suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
--verify is the only automated guard on a docs/<lang>.md: audit_lessons.py
reads en.md alone and build.js never opens a translation, so a structural
mistake in one ships.

17 tests over shape()/verify()/totals()/collect(), including the two places a
naive implementation reports the opposite of the truth: a `# macOS` comment
inside a fenced block is not a heading, and alt text that survives translation
untouched passes every check that only compares image paths. Also pins the
checks that protect documented invariants — figure widget names must stay
verbatim or lesson-figures.js mounts nothing, and code blocks must not drift
from the code/main.* they mirror.

Verified by mutation: counting headings without stripping fences, and dropping
the code-block comparison, each fail the suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
19 tests, one per documented rule Q001-Q009 plus the carve-outs. Q005 carries
the weight: a `correct` index that drifts between quiz.json and
quiz.<lang>.json teaches the wrong answer to every reader of that language,
and reading the Chinese cannot reveal it — the prose is fluent and the option
it points at is plausible.

Also pins the deliberate exceptions, which are easy to "fix" into bugs: a
blank explanation is legal where the English is blank too, and Q008/Q009 are
zh-only because a Japanese translation is neither untranslated nor Simplified.
A table test asserts every rule documented in the docstring is one the checker
can still emit.

Verified by mutation: removing the Q005 comparison fails the suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream rewrote this quiz in the merge — rebalanced the stages, reworded
every option, moved the `correct` indices and added a sixth question on
transposition. The Traditional Chinese translation still mirrored the old
shape: 5 questions where English has 6, and stages pre/pre/post/post/post
against pre/check/check/check/post/post.

lesson.html renders a translated quiz through the same code path as the
English one, so a Chinese reader was served a truncated quiz with its
pre/check/post pacing wrong.

Retranslated against the new English: same order, same stages, same `correct`
indices, same option counts, prose only.

Found by scripts/check_quiz_translations.py, which now runs in CI.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The three fork-only i18n scripts ran in no workflow at all, so their tests
would only ever execute by hand. Adds a fork-only workflow that runs the three
new unit suites plus the two checkers over the real curriculum — the unit
tests pin the rules, these prove the repo still satisfies them.

Its own workflow, not a step in curriculum.yml: the fork has kept that file
byte-identical to upstream, which is what keeps a sync merge tractable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Conflicts resolved by keeping the fork's i18n.js / i18n.zh-Hant.js
loader and not loading upstream's langs.js / lang-picker.js (they drive
upstream's separate translations branch), while taking upstream's
asset-version bumps, program-notice ids, sponsor links and the
aria-hidden quiz-title glyph. site/data.js regenerated with build.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream corrected model ids, commands, links and prose in 57 lessons; the matching docs/zh.md files kept the old code blocks and links, failing i18n_status --verify in 51 lessons. Code blocks are copied verbatim from en.md and the changed prose is retranslated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
phase-17/04 post question changed its answer from 1 to 0, so the zh copy graded the wrong option (Q005). phase-18/09 and phase-19/47 were reworded upstream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Upstream added a /sponsors rewrite, so pages_aliases.mjs now generates site/sponsors/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Walkthrough

Warning

Review details and warnings were omitted to fit the comment limit.

@yennanliu yennanliu closed this Sep 30, 2026
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