Skip to content

markov_chains_II: link the cross-sectional example to markov_chains_I's own label - #883

Merged
mmcky merged 2 commits into
mainfrom
link-cross-sectional-example
Nov 26, 2026
Merged

mmcky merged 2 commits into
mainfrom
link-cross-sectional-example

Conversation

@mmcky

@mmcky mmcky commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Changes one link in markov_chains_II: {ref}`discussed before <mc_eg1-1>` becomes {prf:ref}`discussed before <cross-sectional-distributions>` (sphinx-proof's role, which reaches a prf:example's label, as the lecture's own {prf:ref}`stated <mc_po_conv_thm>` does).

Why. The sentence ("Recall our cross-sectional interpretation of the employment/unemployment model discussed before") points back to markov_chains_I. That section carried the label mc_eg1-1 until #479 (2026-05-28) turned it into a prf:example labelled cross-sectional-distributions. Since then the link has had no target in this site. Intersphinx found mc_eg1-1 on the retired tools-techniques site, so the live page links to https://tools-techniques.quantecon.org/finite_markov.html#mc-eg1-1. With this change it points at intro's own example again. This came out of the lecture monorepo's check of links that leave a site (QuantEcon/project-monorepo#22).

Matt chose this fix on 2026-11-26, relayed by the organiser session ("(i) intro's own example"), over prefixing the link to intermediate's finite_markov. 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

…n markov_chains_I

The sentence links back to the employment/unemployment example's
cross-sectional reading "discussed before", in markov_chains_I. That
section carried the label mc_eg1-1 until #479 made it a prf:example
labelled cross-sectional-distributions, so the link has had no target
in this site since, and intersphinx has sent it to the same label on
the retired tools-techniques site. It now points at the example again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 d528b9b
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6b081d19ea351552050b3815
😎 Deploy Preview https://deploy-preview-883--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.

…labels need

cross-sectional-distributions is a prf:example's label, which {ref} cannot
reach: the build reported it undefined. {prf:ref} does, as this lecture's
link to mc_po_conv_thm already shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
@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:56 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 d528b9b
build 45808398008 45814212235

The branch's first commit, 0c26075, used {ref}. Its build (45812076355) failed under -W with markov_chains_II.md:208: WARNING: undefined label: 'cross-sectional-distributions', because {ref} can't reach a prf:example's label. d528b9b uses {prf:ref}, as the lecture's {prf:ref}`stated <mc_po_conv_thm>` does, and builds. An earlier attempt at 0c26075 stalled installing LaTeX from the Ubuntu mirror and was cancelled.

Page What differs
ar1_processes, commod_price, eigen_I, heavy_tails, inequality, lln_clt_intro, markov_chains_I, markov_chains_II, monte_carlo, schelling, solow, time_series_with_matrices figures and printed values from unseeded draws (default_rng(), .rvs, qe.random.draw, mc.simulate), and %%time in monte_carlo. In markov_chains_II also the change above
bivariate_dist, business_cycle, observed_distributions, and mle_intro (new today) figures and estimates from data downloaded at build time (Yahoo Finance, World Bank), last digits apart
networks figures drawn with networkx's random spring layout
simple_linear_regression a memory address, and a value in its last digits
status the build times
cons_smooth, tax_smooth welfare printed in its last digit (13.285009346064836 against …834), and one figure on 0.1% of its pixels
pv, time_series_with_matrices the signs of printed zeros (0. against -0.) and a 3.55e-15 that moves between rows
eigen_II an eigenvector basis for the repeated eigenvalue −1, which is not unique, and an eigenvalue of order 1e-17
money_inflation_nonlinear, mobility values in their last digits
cons_smooth, french_rev, geom_series, money_inflation, tax_smooth, wealth_tax one or two figures each, on under 0.1% of their pixels

Corrected minutes after posting: the page counts (18 and 11, not 15 and 14), and the runner, which the logs don't name.

Conclusion. The pull request makes one link point at intro's own example, as intended, and nothing else a reader would see. Every other difference is output noise or round-off of the kinds this series' builds show between runs and between runners.

@mmcky
mmcky merged commit 5c6c77f into main Nov 26, 2026
9 checks passed
@mmcky
mmcky deleted the link-cross-sectional-example branch November 26, 2026 21:47
@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#331
Files synced (1):

  • lectures/markov_chains_II.md

mmcky added a commit to QuantEcon/lectures that referenced this pull request Nov 27, 2026
- Only a label a {ref} reaches counts: targets ((name)=, :name:) and an
  exercise's or solution's 🏷️ (sphinx-exercise's). A {math} block's
  🏷️ is an equation's and a {prf:...} directive's sphinx-proof's, and
  {ref} reaches neither (QuantEcon/lecture-python-intro#883), so a site's
  own equation no longer hides an ambiguity, and two mapped sites' proofs no
  longer make one.
- A mapped name is read as the pool site at its address, by site.yml's url
  (intro's pyprog is programming), keeping the name for the prefix and for
  intersphinx's order.
- A site's YAML or page that is not UTF-8 text is left to the site rules,
  which report it, instead of an internal error that hid every finding.

On the pool the output is unchanged: the one finding is still dp's
{ref}`lln_mr`. Each fix has a test that fails on e453d18.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
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 successfully deployed

1 active deployment
pull request — d528b9bb 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