Skip to content

lln_clt_intro: rename the label lln_mr to lln_mr_intro, so links to intermediate's lln_mr have one target - #882

Merged
mmcky merged 1 commit into
mainfrom
label-lln-mr-intro
Nov 26, 2026
Merged

mmcky merged 1 commit into
mainfrom
label-lln-mr-intro

Conversation

@mmcky

@mmcky mmcky commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Renames one label in lln_clt_intro, (lln_mr)= to (lln_mr_intro)=. It changes no text and no code.

Why. intermediate's lln_clt defines lln_mr too. 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 of perm_income_cons, then has two targets. Sphinx's intersphinx merges the mapped sites' inventories in sorted name order, the last one winning, so intro beats intermediate. dp's page links to https://intro.quantecon.org/lln_clt.html#lln-mr today, not to intermediate's lecture, which its copy of perm_income_cons was 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 only lln_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 own perm_income_cons and 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-intro instead 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

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
@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 54bdff1
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6b0814065c45e4c378622830
😎 Deploy Preview https://deploy-preview-882--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request November 26, 2026 11:18 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request November 26, 2026 11:19 Inactive
@mmcky

mmcky commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Validation: a full validation

Fresh builds with no cache, the same day (2026-11-26), each executing every lecture (cache.yml):

main at 41a99c7 this pull request at 54bdff1
build 45808398008 45808403262
  • The change, and nothing else a reader would see. In lln_clt_intro the section "The law of large numbers" has the anchor #lln-mr-intro instead of #lln-mr. No page of either build links to it. No page's prose differs.
  • The environment: identical on both sides, the same 504 conda packages and the same pip packages at setup.
  • Build logs: the same warning lines on both sides (none from Sphinx).
  • Cell outputs: the warnings and errors are the same on both sides, page by page.
  • Packages installed inside cells: five pages run pip install in a cell (bivariate_dist, business_cycle, eigen_II, inflation_history, input_output); "Successfully installed" is the same on both sides.
  • The HTML: 18 of 66 pages differ, every figure compared by content, all in their outputs. 15 are on intro's noise list from environment.yml: the Anaconda channels are defaults #878's comparison, and the other three come from unseeded draws too.
Page What differs
ar1_processes, commod_price, heavy_tails, inequality, lln_clt_intro, monte_carlo, schelling, solow, time_series_with_matrices figures and printed values from unseeded draws (and %%time in monte_carlo), as in #878's list. lln_clt_intro's anchor is the change above
bivariate_dist, business_cycle, observed_distributions figures drawn from data downloaded at build time (Yahoo Finance, World Bank), and the progress counter of a pip install, as in #878's list
networks figures drawn with networkx's random spring layout
simple_linear_regression a memory address in an object's repr
status the build times
eigen_I figures 14 and 15 of 19, from a random starting vector (np.random.default_rng())
markov_chains_I simulated paths and the frequencies computed from them (qe.random.draw, mc.simulate)
markov_chains_II figures 3 and 8 of 8, from mc.simulate, which draws without a seed

Conclusion. The pull request changes one anchor in lln_clt_intro, as intended, and nothing else a reader would see. Every other difference is output noise of the kinds this series' builds already show between runs.

@mmcky
mmcky merged commit 16a2705 into main Nov 26, 2026
9 checks passed
@mmcky
mmcky deleted the label-lln-mr-intro branch November 26, 2026 11:52
@mmcky

mmcky commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

✅ Translation sync completed (zh-cn)

Target repo: QuantEcon/lecture-intro.zh-cn
Translation PR: QuantEcon/lecture-intro.zh-cn#330
Files synced (1):

  • lectures/lln_clt_intro.md

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

1 inactive deployment
pull request — 54bdff12 Deployed Nov 26, 2026 by github-actions[bot]
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