Repository navigation
lln_clt_intro: rename the label lln_mr to lln_mr_intro, so links to intermediate's lln_mr have one target - #882
Merged
Merged
Conversation
intermediate's lln_clt defines lln_mr too. A link to it from outside
both sites, such as {ref}`lln_mr` in lecture-dp's copy of
perm_income_cons, then has two targets, and intersphinx takes the one
whose mapping name sorts last, intro, so dp's link lands here rather
than on intermediate's lecture, which its copy was written against. No
lecture in any QuantEcon series links to this label, so the rename
changes no link here and leaves intermediate's label the only one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
✅ Deploy Preview for taupe-gaufre-c4e660 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
Validation: a full validationFresh builds with no cache, the same day (2026-11-26), each executing every lecture (
Conclusion. The pull request changes one anchor in |
Contributor
Author
✅ Translation sync completed (zh-cn)Target repo: QuantEcon/lecture-intro.zh-cn
|
mmcky
added a commit
to QuantEcon/lectures
that referenced
this pull request
Nov 27, 2026
…get) (#101) **A draft until QuantEcon/lecture-python-intro#882 reaches the pool.** This rule's own check is red on this branch, as it should be: it reports the one case the pool has today. ## What it adds A new pool-check rule, `ref-target`, for QuantEcon/project-monorepo#22, on Matt's "Rule + two intro PRs" (2026-11-26, relayed by the organiser session): **a `{ref}` link that leaves its site has one target.** A label the site's pages don't define must be defined by at most one of the pool's sites the site maps. **Why.** Sphinx 7.4.7's intersphinx merges the mapped sites' inventories in sorted name order, each overwriting the last (`sphinx/ext/intersphinx/_load.py`, `load_mappings`). So a label that two mapped sites define sends the link to whichever name sorts last, whatever the lecture meant. Rule 3 keeps lecture names unique for `{doc}` links; this does the same for the labels a link leaves its site for. **What it doesn't count.** A prefixed link (`` {ref}`intermediate:lln_mr` ``) names its site. A mapped site outside the pool, such as a retired one that intro still maps, is not read. Labels are targets (`(name)=`, `:name:`) and a directive's `:label:` (a proof's or an exercise's), compared without case, as Sphinx does. Text in code cells and literals is not read, as for `doc-target`. ## The one case today `sites/dp: lectures/perm_income_cons.md links to {ref}`lln_mr``. intro's `lln_clt_intro` and intermediate's `lln_clt` both define `lln_mr`, and `intro` sorts last, so dp's live page links to intro's lecture rather than intermediate's, which dp's copy follows. QuantEcon/lecture-python-intro#882 renames intro's label to `lln_mr_intro`. Once it merges and the nightly refresh brings it into the pool, this check is clean, and this pull request can leave draft. The other ambiguous link QuantEcon/project-monorepo#22's check found, intro's `markov_chains_II`, isn't one this rule can see: its second target was the retired tools-techniques site. QuantEcon/lecture-python-intro#883 points it back at intro's own example. ## Changes - **`tools/pool-check`:** `check_ref_targets`, the rule, and its entry in the docstring. - **`tools/tests/test_sites.py`:** the reported case, and four clean ones: one mapped site defines the label, a prefix names the site, the site defines the label itself (in any case), and an inline literal that isn't a link. - **`sites/README.md`:** rule 8, and a note that a hard-coded address is outside the rules, since Sphinx never resolves it and only the link checker sees it. - **`README.md`:** one sentence. Locally: the tests pass (335, and 1 skipped), and pool-check reports exactly the case above. Copilot: not requested (Matt, 2026-11-22). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames one label in
lln_clt_intro,(lln_mr)=to(lln_mr_intro)=. It changes no text and no code.Why. intermediate's
lln_cltdefineslln_mrtoo. A link to that label from a site that has neither lecture, such as{ref}`our discussion <lln_mr>`in QuantEcon/lecture-dp's copy ofperm_income_cons, then has two targets. Sphinx's intersphinx merges the mapped sites' inventories in sorted name order, the last one winning, sointrobeatsintermediate. dp's page links tohttps://intro.quantecon.org/lln_clt.html#lln-mrtoday, not to intermediate's lecture, which its copy ofperm_income_conswas written against. This came out of the lecture monorepo's check of links that leave a site (QuantEcon/project-monorepo#22). With the rename, intermediate's label is the onlylln_mr.What it touches. No lecture in any QuantEcon series links to intro's
lln_mr: the label's only other uses are intermediate's ownperm_income_consand dp's copy of it, which both mean intermediate's. So no link in this repository changes. The one visible effect is the section's anchor, which becomes#lln-mr-introinstead of#lln-mr. An outside link with the old anchor still opens the page, at its top.Matt approved this change on 2026-11-26, relayed by the organiser session ("Rule + two intro PRs"). He reviews the diff before it merges. A full validation (fresh no-cache builds of main and this branch, compared page by page) follows in a comment.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG