Skip to content

Repoint the hansen_singleton pair at QuantEcon/data-lectures (wave B2') - #1036

Merged
mmcky merged 2 commits into
mainfrom
datasets/track-b2
Aug 13, 2026
Merged

Repoint the hansen_singleton pair at QuantEcon/data-lectures (wave B2')#1036
mmcky merged 2 commits into
mainfrom
datasets/track-b2

Conversation

@mmcky

@mmcky mmcky commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Repoints both hansen_singleton lectures at QuantEcon/data-lectures, completing wave B2′ of the datasets migration. Mirrors the wave landed in QuantEcon/data-lectures#82. Work plan: QuantEcon/workspace-lectures#39.

Deletes nothing. The _static copies and their READMEs stay until this has published, per the repoint → publish → delete ordering rule.

No figure can change

The bytes in data-lectures are byte-identical to the copies these lectures read today — verified at the landing PR, and again against main just now:

URL the lecture now reads HTTP sha256 Bytes
data-lectures/raw/main/lectures/hansen_singleton_1982_data.csv 200 3e9d4f37c31dbcab… 11,662
data-lectures/raw/main/lectures/hansen_singleton_1983_data.csv 200 dc5c1f8dac4b50ab… 26,084

Both builder links resolve too (blob/main/builders/hansen_singleton_198{2,3}_data.py, 200 each), and a never-existed control path on the same host returns 404 — so those 200s are real hits, not a soft-404 page.

Six edits, and only two of them are code reads

Three per lecture. This is the part worth reviewing carefully, because two of the three break silently:

1. The data URL — collapsed, not patched. It was a three-line string concatenation:

DATA_URL = (
    "https://github.com/QuantEcon/lecture-python.myst/raw/refs/heads/main/"
    "lectures/_static/lecture_specific/hansen_singleton_1982/"
    "hansen_singleton_1982_data.csv"
)

The stem line could not be edited in place. The published tree in data-lectures is flat — it has no _static/lecture_specific/<lecture>/ segment — so patching the stem alone would have left the filename appended to a path that does not exist. Both are now single lines on the bare main form.

2. The prose link to the maintenance script. It pointed at _static/lecture_specific/hansen_singleton_1982/make_data.py in this repo. That builder moved repos and was renamed: both files were called make_data.py, which works beside their own output where the parent directory supplies the meaning, and collides outright in a flat builders/ tree. Each took its dataset's stem.

3. The same builder path, named again in a docstring inside the data cell. Easy to miss — it is not a link and not a read, just a path in prose that would have quietly become wrong.

Nothing in this repo or anywhere else would have caught edits 2 and 3. data-url-guard.yml greps only for the LFS media host. jupyter-cache hashes code cells only, so a stale prose link cache-hits and goes green — which is exactly the failure class that made the D2 decision necessary in wave B1′. Both were found by grepping the filename and the URL stem separately; a line-based grep for the whole old URL returns a confident zero against the wrapped form.

Verification

  • Both directions. No surviving reference to lecture_specific/hansen_singleton or make_data.py in either lecture (grep exit 1, against a positive control proving the pattern matches when present); all six new references present and correct.
  • Rest of the repo swept. The only other mentions of these filenames are inside the two _static/.../README.md files, which are scheduled for deletion in the follow-up PR along with the CSVs and builders.
  • The data cell re-executes on this PR — the DATA_URL change alters the cell hash — so CI genuinely exercises the new URL rather than restoring it from cache.

What follows

  1. this PR merges → the lecture-python.zh-cn sync PR generates;
  2. migration.yml flips landedrepointed in data-lectures, recording consumers;
  3. publish lecture-python.myst, then merge the sync PR, then publish lecture-python.zh-cn;
  4. deletion of the _static copies, builders and READMEs — its own PR, after the publishes.

Note for step 4: deleting these files will not stop the site serving them. ci.yml and publish.yml restore the weekly build-cache artifact and build over it, and Sphinx never prunes removed _static assets, so a deletion keeps being served until cache.yml rebuilds clean (Mon 03:00 UTC) and a publish follows. Verify that deletion against the published URL, never against main. See QuantEcon/data-lectures#81.

🤖 Generated with Claude Code

Both lectures now read their monthly dataset from data-lectures instead of
this repo's own committed blobs. The bytes are byte-identical, verified at
the landing PR, so no figure changes.

Six edits, three per lecture — and only ONE of the three is a code read:

  * the data URL, collapsed from a three-line string concatenation to a
    single line. The stem line could not be patched in place: the flat
    published tree has no _static/lecture_specific/<lecture>/ segment, so
    editing it alone would leave the filename appended to a path that does
    not exist;
  * the prose link to the maintenance script, which moved repos and was
    renamed — both make_data.py files collide in a flat builders/ tree, so
    each took its dataset's stem;
  * the same builder path named again in a docstring inside the data cell.

The last two break silently. No check in this repo or anywhere else covers
them: data-url-guard greps only for the LFS media host, and jupyter-cache
hashes code cells only, so a stale prose link cache-hits and goes green.

Deletes nothing. The _static copies and their READMEs stay until this has
published, per the repoint-publish-then-delete ordering rule.

Mirrors the wave in QuantEcon/data-lectures#82
Work plan: QuantEcon/workspace-lectures#39

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 07:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Repoints the Hansen–Singleton (1982/1983) lectures to load their CSV datasets from the centralized QuantEcon/data-lectures repository as part of the datasets migration, while updating accompanying documentation references to the new builder scripts.

Changes:

  • Updated each lecture’s DATA_URL to fetch hansen_singleton_198{2,3}_data.csv from QuantEcon/data-lectures.
  • Updated the prose link and in-cell docstring references from the old in-repo make_data.py scripts to the renamed data-lectures/builders/hansen_singleton_198{2,3}_data.py.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lectures/hansen_singleton_1982.md Switches dataset source + updates builder references for the 1982 lecture.
lectures/hansen_singleton_1983.md Switches dataset source + updates builder references for the 1983 lecture.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lectures/hansen_singleton_1982.md Outdated
Comment thread lectures/hansen_singleton_1983.md Outdated
The repoint left three sibling references to the data in each lecture and
updated only two. The in-cell comment still called it "the vendored
snapshot", which now says the opposite of what happens: vendoring means
committing a copy here so the build does not fetch it, and the build now
fetches it from QuantEcon/data-lectures at run time.

"Fetch" rather than simply dropping the adjective — it names the network
read, which is the whole reason the comment says "once".

Raised by Copilot on #1036.

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

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-1036--sunny-cactus-210e3e.netlify.app

Commit: 1588de6

📚 Changed Lectures


Build Info

@mmcky
mmcky merged commit a501f03 into main Aug 13, 2026
2 checks passed
@mmcky
mmcky deleted the datasets/track-b2 branch August 13, 2026 08:28
@mmcky

mmcky commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

✅ Translation sync completed (zh-cn)

Target repo: QuantEcon/lecture-python.zh-cn
Translation PR: QuantEcon/lecture-python.zh-cn#250
Files synced (2):

  • lectures/hansen_singleton_1982.md
  • lectures/hansen_singleton_1983.md

mmcky added a commit to QuantEcon/data-lectures that referenced this pull request Aug 13, 2026
Both consumers now read this repo, so the tracker catches up with reality.

  status:    landed -> repointed
  repoints:  QuantEcon/lecture-python.myst#1036
             QuantEcon/lecture-python.zh-cn#250
  consumers: recorded in both manifests

Acceptance test — strict audit, dry-run both directions against the
repointed world:

  status: repointed  -> exit 0
  status: landed     -> exit 1, "marked landed but some consumer already
                        reads data-lectures", both files

The second direction is the one that matters: between the myst merge and
this flip the audit was RED, which is the design working. It has no green
state for a partially-repointed dataset.

lecture-python.zh-cn is recorded here or nowhere — it is outside the
audit's SCAN_REPOS, so nothing machine-checkable will ever see those two
reads. The generated lecture-python.notebooks mirror is a third
reference-holder and is deliberately not listed: it self-heals after a
publish tag and is not a repo anyone repoints (wave A4 precedent).

Both manifests also record what the repoint had to do beyond the URL —
each lecture named the BUILDER twice more, in a prose link and in a
docstring inside the data cell, and neither is a code read, so neither
would have failed a build had it been missed.

Track B is now fully repointed. What remains is two publishes and the
deletion of the _static copies, builders and READMEs from
lecture-python.myst.

Mirrors the wave in #82
Work plan: QuantEcon/workspace-lectures#39

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
mmcky added a commit that referenced this pull request Aug 13, 2026
…se 2) (#1037)

Six files across two directories: both CSVs, both make_data.py, and both
READMEs. All now live in QuantEcon/data-lectures, where the builders were
renamed to their dataset stems and each README's content was folded into
its manifest.

Gate satisfied. Nothing reads these:

  * both lectures here repointed in #1036, merged and published
  * both lecture-python.zh-cn twins repointed in
    QuantEcon/lecture-python.zh-cn#250, merged and published
  * lecture-python.notebooks regenerated at 09:34:21Z and both notebooks
    carry the data-lectures URL
  * migration.yml flipped to `repointed` in
    QuantEcon/data-lectures#83, strict audit green

Swept the org rather than the manifest. These files were created
2026-06-26 (a3e8443, #926), so only repos pushed since can reference
them: 88 of the org's 277, swept by Trees API, zero unreadable. Exactly
four hold any hansen_singleton path — this repo, zh-cn, data-lectures and
the notebooks mirror. zh-cn's copies are its own committed blobs, not
reads of these, and its lectures now read data-lectures; they are Track X
orphans and are deliberately left alone.

Deletes exactly six files, not the parent directories' 29 siblings.
`hansen_singleton_198{2,3}/` held nothing else, tracked or untracked;
27 sibling directories under lecture_specific/ are untouched, including
linear_algebra/ and linear_models/, whose PDFs are linked from the
published site.

NOTE: this will not stop the site serving them. Both ci.yml and
publish.yml restore the weekly build-cache and build over it, and Sphinx
never prunes removed _static assets — measured on this repo today, where
wave B1's five deleted files were still served at 200 after a successful
publish three hours later. The files stop being served after cache.yml
rebuilds clean (Mon 03:00 UTC) and a publish follows, which will settle
B1' and B2' together. Verify against the published URL with a
never-existed control, never against main.

Cause and fix: QuantEcon/workspace-lectures#41
Verification sweep: QuantEcon/workspace-lectures#40
Mirrors the wave in QuantEcon/data-lectures#82
Work plan: QuantEcon/workspace-lectures#39

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants