Skip to content

promote: retire a lecture removed or renamed upstream; let a shared include lead - #60

Merged
mmcky merged 3 commits into
mainfrom
promote/retire
Nov 15, 2026
Merged

mmcky merged 3 commits into
mainfrom
promote/retire

Conversation

@mmcky

@mmcky mmcky commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Two things that could turn the daily run red until someone fixed it by hand: a lecture renamed or removed upstream (#40), and a shared _admonition/ include that one series edits before the others (#22). This is the first of the promote-robustness changes; asset placement and provenance (#23) follow separately.

Retirement

  • tools/promote --refresh never retires. It skips an entry whose canonical copy is gone, so the rest still refresh. The drift-check keeps reporting it as canonical-removed until it is retired or re-homed.
  • tools/promote --toc SERIES retires on its own, before it plans its batch, each entry canonical in SERIES whose lecture has left that toc, whose canonical copy is gone, and whose name no series in the manifest holds. A renamed lecture is retired under its old name and promoted under its new one by the same run. More than five in one run retires none and fails, naming them. A toc that lists no lecture retires nothing.
  • tools/promote --retire SLUG … retires by name, all or nothing, for anything the rule above leaves alone (for example a lecture dp still holds). It refuses a lecture its canonical series' toc still lists, and one another canonical-eligible series still holds and lists (that one is re-homed with tools/promote SLUG).
  • Cut-over guard: retirement only acts on an entry whose canonical series is in sync/manifest.yml, so nothing of a series the pool has taken over is ever retired.
  • Retiring removes the pool file and the ledger entry and prunes the assets no other pool lecture uses. There is no tombstone: git history and the run's summary are the record. The run warns of pool lectures that link to the retired lecture with {doc}.

A shared include that one series edits first

Today _admonition/gpu.md is carried by programming, intermediate and jax, and 55 pool lectures use the pool's one copy. Before this change, an edit in one series was refused ("differs across series") and raised a drift issue until every series had made the same edit.

  • A series whose copy was the pool's version leads. The refresh takes its new version for every lecture that uses the include, whether or not those lectures are in the refresh batch, and whether or not the leading series has a lecture of its own that uses it.
  • The copies that did not follow are recorded as stale on the asset in sync/ledger.yml: their own digest and a stale_since time (the leading series' synced_at, so a recompute gives the same ledger). An asset with no stale copy is recorded exactly as before.
  • The drift-check reports a stale copy as information for seven days, and as drift, with an issue, after that. The copy is current again at the first refresh after its series makes the same change.
  • Refused, as before: two series that change the include differently. Also refused: a stale copy that changes to anything but the pool's version or the leaders' (a copy that is behind may only catch up), a copy in a series never recorded that differs, and overwriting a pool include that was edited by hand.
  • A series left out of a run with --exclude keeps its record; if the pool's version changes in that run, its copy, which was not read, is recorded as stale at the version it was last seen at.
  • If every series that held the pool's version drops the file, the pool follows the copies that remain, which must agree.

Also

  • The ledger's header gains three lines describing the new fields (the only change to sync/ledger.yml).
  • Messages in tools/promote, tools/drift-check and the refresh workflow name the remedy; the README has a section on each behaviour.

Checks

  • tools/tests: 171 passed, 1 skipped (29 new tests in test_retire.py and test_admonition.py; two existing tests updated, since a removed canonical copy is now a skip in the refresh and not a failure).
  • On main's pool: tools/drift-check and tools/pool-check clean; tools/promote --refresh has nothing to refresh.
  • Rehearsed on scratch copies of the real pool: an edit to intermediate's (and, separately, jax's) gpu.md is taken by the refresh with the other two series recorded as stale and the drift-check at information only; a lecture dropped from intermediate is skipped by the refresh and retired by --toc intermediate, with the drift-check and pool-check clean afterwards.
  • Two adversarial reviews, on scratch copies, before this was opened. Their reproduced findings are fixed here and each has a test: a refresh that the drift-check asked for and promote never performed, --exclude dropping a stale record, the holder of the pool's version dropping the file, a false asset-diverged for a copy catching up, a hand-edited include overwritten, an empty toc read as "lists nothing", and the order of writes when a retirement is interrupted. The organiser's review then found that a run with --exclude could record a left-out series as holding a new version, so that the next full refresh took the pool back; fixed with a test, with the subfolder and re-homing points above.

Known limits, left for later

  • An asset shared by a lecture whose canonical copy is gone and a lecture that moved keeps a refresh finding until the first is retired.
  • Links to a retired lecture are warned of, not checked; the {doc}-target check comes with the pool checks.
  • A lecture moved into a subfolder upstream is retired at its old path and promoted at the subfolder path (tested). The refresh itself still looks a subfolder entry up by its base name and fails on it, loudly, as it does on main; no pool lecture is in a subfolder today.
  • A stale copy that catches up only part of the way (to a version that is neither the pool's nor a leader's) is refused, and that refusal applies to every lecture that uses the include until the copy reaches the pool's version.

Closes #40. Part of #22.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU

…nclude lead

Retirement (#40). A pool lecture whose canonical copy is gone upstream could
only be reported: the refresh failed on it every day. Now:

- `--refresh` never retires. It skips an entry whose canonical copy is gone,
  so the rest still refresh; the drift-check keeps its canonical-removed issue.
- `--toc SERIES` retires, before it plans its batch, each entry canonical in
  SERIES whose lecture left that toc, whose canonical copy is gone and whose
  name no series in the manifest holds. More than five in one run retires
  none and fails, naming them. An empty toc retires nothing.
- `--retire SLUG...` retires by name, all or nothing. It refuses a lecture
  its canonical series' toc still lists, and an entry whose canonical series
  is not in sync/manifest.yml, so nothing of a series the pool has taken
  over is ever retired.
- Retiring removes the pool file and the ledger entry and prunes the assets
  no other pool lecture uses. There is no tombstone.

Shared `_admonition/` includes (#22). Several series carry their own copy and
the pool keeps one. A series whose copy was the pool's version and changes it
now leads: the refresh takes the new version for every lecture that uses the
include, in the batch or not, and records the copies that did not follow as
stale on the asset (their own digest and a stale_since time). The drift-check
reports a stale copy as info for seven days and as drift after that. Two
series that change it differently are refused, and a stale copy may only
catch up. A hand-edited pool include is never overwritten.

The ledger's header gains three lines describing the new fields.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
Copilot AI balanced review requested due to automatic review settings November 15, 2026 23:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

The change still has an active moderate issue where admonition_version() can crash with StopIteration when no eligible series provides an include and there is no ledger record, indicating the tool may fail without an actionable error.

1 open issue
What changed in this PR

Improves robustness of the pool promotion tooling by adding a supported retirement path for lectures removed/renamed upstream and by allowing a shared _admonition/ include to be updated by a leading series while tracking lagging copies as stale.

Changes:

  • Add tools/promote --retire plus --toc-driven auto-retire (with guardrails) and make --refresh skip missing canonicals instead of failing.
  • Implement shared _admonition/ leader/stale semantics in tools/promote, record stale metadata in the ledger, and escalate stale status in tools/drift-check after a grace period.
  • Update tests, documentation, and workflow messaging to reflect the new behaviors and remedies.
File Description
tools/​tests/​test_retire.py Adds new test coverage for lecture retirement scenarios, guardrails, and related asset/ledger behavior.
tools/​tests/​test_refresh.py Updates refresh tests to reflect skipping entries whose canonical copy is missing upstream rather than failing the run.
tools/​tests/​test_consumer.py Adjusts consumer-related tests to align expectations with the new refresh skip behavior for missing canonicals.
tools/​tests/​test_admonition.py Adds tests covering shared _admonition/ leader/stale handling, escalation timing, and refusal cases.
tools/​promote Implements retirement workflows and shared _admonition/ leader/stale logic, updating refresh/TOC planning and ledger updates accordingly.
tools/​drift-check Adds stale-copy reporting/escalation for shared _admonition/ includes and updates guidance around canonical-removed situations.
sync/​ledger.yml Updates the ledger header documentation to describe newly recorded stale metadata fields for shared includes.
README.md Documents the retirement behavior and the shared _admonition/ leader/stale model, including recommended remedies.
.github/​workflows/​drift-check.yml Updates workflow messaging/comments to reflect the new skip/retire and stale-include behaviors.

Review effort: Balanced

Comment thread tools/promote Resolved
mmcky and others added 2 commits November 16, 2026 10:19
… as last seen; retire by full path

- A run with --exclude that moves the pool to a new version of a shared
  include recorded the left-out series as holding it. Its copy was not read,
  so it is now recorded as stale at the version it was last seen at, and the
  next full run judges it. Before, that run could take the pool back.
- Retirement works on the entry as keyed, folder included, so a lecture
  moved into a subfolder is retired at its old path and promoted at the new
  one; the refresh no longer takes a subfolder entry for one whose copy is
  gone. A retired file is kept only when a surviving entry is the same file
  (a case-only rename on a case-insensitive file system).
- --retire refuses a lecture another canonical-eligible series still holds
  and lists in its toc, and points at re-homing.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
@mmcky
mmcky merged commit c07baa9 into main Nov 15, 2026
5 checks passed
@mmcky
mmcky deleted the promote/retire branch November 15, 2026 23:46
mmcky added a commit that referenced this pull request Nov 16, 2026
…corded by its users (#62)

The admonition rule from #60 now holds for every pool asset: one pool copy; a series whose copy was the pool's version leads, laggards are recorded stale, and forks are refused. Lectures that share a file stay on one pool path, and are pulled into the batch when that path must change. An asset's sources are its copies in the series its user lectures come from; a copy that was never the pool's version is recorded as `differs: true` and never followed. A destination collision refuses every lecture involved, and a hand-edited shared file is never restored. drift-check applies the same rule to all assets and gains two refresh findings, `asset-caught-up` and `asset-record`.

It also repairs #60: a stale copy that caught up by a file-only edit is now recorded as caught up.

sync/ledger.yml changes its header comment, and three records (`_static/markov_perf/judd_fig1.png`, `judd_fig2.png`, `mpe_vs_monopolist.png`) lose `advanced` as a source, since no advanced lecture uses them. No pool lecture or asset changes.

Closes #23
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.

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

2 participants