Skip to content

promote: a pool lecture renamed or removed upstream can never be retired, and every refresh after it fails #40

Closed

Description

@mmcky

Found by the review of intro's promotion for step 2 of QuantEcon/project-monorepo#24. The gap predates that promotion, but each series promoted widens it: intro adds 50 lectures to the pool, and intro changed its _toc.yml 11 times in the last six months. Line numbers are at main 83f0179.

What happens. Reproduced on a copy of the pool with intro promoted, by renaming intro's cobweb.md to cobweb_intro.md in its mirror and its toc and moving intro's pin:

  1. tools/drift-check reports two drift findings: [toc-changed] intro and [canonical-removed] lectures/cobweb.md: canonical copy intro/lectures/cobweb.md no longer exists upstream.
  2. The toc-changed remedy (tools/promote --toc intro --exclude jax, then tools/drift-check --accept-toc intro) promotes cobweb_intro, but leaves lectures/cobweb.md and its ledger entry in place at the old pin, so the pool holds both.
  3. The next night that any intro lecture moves (here solow, with the pin moved again), the workflow's refresh (tools/promote --refresh --exclude jax) fails on the old entry and exits 1, so the run is red: [cobweb] FAILED: cobweb.md is in the pool, but no canonical-eligible series this run considers holds it any more (removed or renamed upstream?).
  4. It fails the same way every night after that.

Why nothing clears it. canonical-removed asks for a decision "before the next refresh" (tools/drift-check:322), and the refresh's FAILED line asks for the same one (tools/promote:677-680), but no tool carries the decision out. Nothing removes a pool lecture together with its ledger entry, and the ledger's header says it is generated and must not be hand-edited (tools/promote:146). The toc-changed remedy text (tools/drift-check:583-589) does not mention the old entry.

Removing lectures/cobweb.md and its ledger block by hand, in one commit, does clear it: drift-check is clean and the next refresh succeeds. But that is the hand edit the header forbids, and a lecture with assets of its own would need their records removed as well.

What a fix needs. A sanctioned way to retire an entry: remove the pool lecture, its ledger entry and any asset only it uses. Two shapes, not exclusive:

  • an explicit tools/promote --retire <lecture>, which the canonical-removed detail and the FAILED line then name;
  • a --toc run that retires the entries whose lecture has left the toc and whose canonical copy is gone, which also makes the toc-changed remedy complete for a rename.

Either way, with tests for a rename, a removal, and a retired lecture's own assets.

Activity

  1. added
    bug
    on Nov 5, 2026
  2. mmcky commented on Nov 9, 2026

    @mmcky
    ContributorAuthor

    For a lecture with assets of its own, the toc-changed remedy fails at its first step. Found by the review of #46, advanced's promotion for step 2 of QuantEcon/project-monorepo#24.

    Reproduced on a copy of the pool at #46's head (98fc41a), by renaming advanced's coase.md to coase_theorem.md in its mirror and its toc, and moving advanced's pin. drift-check reports [toc-changed] advanced and [canonical-removed] lectures/coase.md, as above. The remedy's tools/promote --toc advanced --exclude jax then refuses the new name instead of promoting it: [coase_theorem] FAILED: asset _static/lecture_specific/coase/subcontracting.png is recorded at _static/coase/subcontracting.png but now maps to _static/_shared/coase/subcontracting.png — re-promote its other consumer(s) (coase) in the same batch.

    The old coase entry still counts as a user of the lecture's two figures, so to promote is to share them between the old name and the new, and the re-homing check refuses the move. cobweb, the case above, has no assets of its own, which is why its remedy got as far as promoting cobweb_intro. So for a lecture with assets, retiring the old entry has to happen before the new name is promoted, or in the same run. Of the two shapes above, a --toc run that retires the entries whose lecture has left the toc and whose canonical copy is gone would do that, provided it retires them before it plans the batch. An explicit --retire would have to come first in the remedy's text. Either way, the tests should include a rename of a lecture with assets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions