Repository navigation
promote: one pool copy of a file lectures share, kept together and recorded by its users - #62
Conversation
…corded by its users The rule a shared `_admonition/` include got in #60 now holds for every pool asset (#23), and an asset's record follows the lectures that use it. - One version. The pool keeps one copy of a file. A series whose copy was the pool's version and changes it leads: the pool takes the new version for every lecture that uses the file, in the batch or not. Copies that did not follow are recorded stale; two leaders that differ and a stale copy that moves to a third version are refused. - Lectures that share a file stay on one pool path. A lecture outside the batch counts as a user of the version the batch brings, so a partial refresh no longer splits a shared file in two. When a file's pool path must change, the lectures that use it are pulled into the batch; one that cannot be re-promoted holds the mover back. A lecture that stops using a shared file takes its remaining users along, so the record follows them. - Provenance from users. An asset's sources are its copies in the series its user lectures come from, while those lecture copies are still the lecture the pool recorded; never a series that merely has a file of that name. A copy that was never the pool's version is recorded as a different file (`differs: true`) and never followed or handed to a lecture. - A destination collision refuses every lecture involved, naming all of them, whatever order they were given in. - The drift-check applies the same rule to every asset, asks for a refresh when a stale copy has caught up (so the record says so) or a record names a canonical series that is no longer a user, and watches only copies behind a user lecture. sync/ledger.yml: the header comment, and the three `markov_perf` figures lose `advanced` as a source (no advanced lecture uses them). No pool lecture or asset changes. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🔵 Needs a closer look
Because the change entails a substantial refactor of tools/promote and tools/drift-check affecting shared asset/version and ledger rewrite behavior, it needs human validation against real pool/legacy ledgers and nightly refresh workflows (including --exclude and subfolder lecture paths) beyond the synthetic test harness.
No open issues 🎉
What changed in this PR
Generalizes the pool’s “single canonical shared asset with recorded per-series provenance” behavior across all shared files, keeping promote/refresh and drift-check consistent while preventing split-path assets and preserving stale/differing copies (closes #23).
Changes:
- Extends shared-asset rules beyond
_admonition/to track canonical/stale/differing copies and keep ledger records aligned with lecture users. - Updates
tools/promote --refreshto batch/pull in all user lectures for shared assets so moves and placement remain atomic and consistent. - Adds comprehensive tests, updates documentation, and adjusts the ledger header/affected entries to match the new semantics.
| File | Description |
|---|---|
| tools/tests/test_shared_assets.py | Adds a new regression test suite covering shared-asset placement/provenance rules, collisions, and stale/differing copy behaviors. |
| tools/tests/test_admonition.py | Updates and expands admonition-related tests to match the generalized shared-file rules and source semantics. |
| tools/tests/conftest.py | Adjusts shared test utilities/fixtures to support deterministic pin movement and stale-since related assertions. |
| tools/promote | Implements generalized shared-asset canonical selection, provenance recording, and same-batch pull-in logic to keep shared assets on one pool path. |
| tools/drift-check | Aligns drift detection with the new shared-asset rules and adds findings to keep ledger records and recorded sources consistent over time. |
| sync/ledger.yml | Updates the header documentation and revises affected asset records to ensure sources reflect only series with user lectures under the new rule. |
| README.md | Documents the generalized “file lectures share” rule set, including canonical/stale/differing handling and batch behavior. |
Review effort: Balanced
…eft out; a shared file is never restored over a hand edit - An asset that moves to another pool path in the run keeps its record: its stale copies stay stale, and a series left out keeps its item. - A hand-edited shared file is refused even with every user in the batch and no version change, as on main. Only a lecture's own file is restored by re-promoting the lecture. - A series left out of a run keeps its item if the ledger has it as a user series, whether or not it is canonical for a user. - A file moved or renamed upstream with the same bytes is still the recorded asset, and a recorded asset is one file however its series spell its path: its users are counted together and its pool path is decided once. - A lecture pulled in only so that a record could follow its users is let go with a warning if it cannot be re-promoted; it never fails the run. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
… it; say what a declined pull-in means - A file in the same series with the same bytes as a recorded asset whose path is gone upstream is that asset only for a lecture that already used it. A new lecture that carries an identical file has an asset of its own. - The warning for a pull-in that could not be re-promoted says what follows: from the next run the drift-check asks for the record to be rewritten through that lecture, and the refresh fails on it until it is settled. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU
Asset placement and provenance: the four gaps in #23, with the same-batch re-homing and the differing-bytes record from the promote hardening on QuantEcon/project-monorepo#11. It extends the rule a shared
_admonition/include got in #60 to every pool asset.What it changes in the pool: tooling, tests, the README, and
sync/ledger.yml(its header comment, and three records, below). No pool lecture or asset changes.The rule
The pool keeps one copy of a file, used by every pool lecture that refers to it, while the series those lectures come from each carry their own. Today six assets are shared by lectures from different series: the GPU admonition (55 lectures),
duopoly_mpe.py(markov_perffrom intermediate,rob_markov_perffrom advanced) and the fourarellanofigures (advanced and jax).digestand astale_sincetime), reported as information for seven days and as drift after that, and are current again at the first refresh after they follow. (Decided by the owner on 2026-11-16: the admonition rule, for every shared file.)arellano_jaxno longer needs promoting by hand in one batch witharellano.differs: true, reported as information, never followed, and a lecture that comes only from that series and uses the name gets its own series' file.The drift-check
check_assetapplies the same rule to every asset: a leading copy is arefreshfinding, a stale copystale-copy, a forkasset-diverged. Two newrefreshfindings keep the record true, so that promote and the drift-check never disagree about a copy:asset-caught-up(a copy recorded as stale now matches the pool; without it, the next change by that series was refused as a fork, which was also true of the admonition as merged in #60) andasset-record(a record whose canonical series is no longer a user). The refresh acts on both.sync/ledger.yml_static/markov_perf/judd_fig1.png,judd_fig2.pngandmpe_vs_monopolist.pngloseadvancedas a source: advanced has files of those names with the same bytes, and no advanced lecture uses them. These were the three records the new rule changes; a full re-promotion of all six series' tocs changes nothing else, in the ledger or the pool.Left out, by the owner's call on 2026-11-16
Two of the four older hardening items: a per-series name map (no pool lecture has a different name in another series), and refusing many-to-one rewrites (the one case in the pool,
long_run_growth, writes one figure two ways and both resolve to the same file; a test keeps it accepted).Checks
tools/tests: 209 passed, 1 skipped (28 new tests, most intest_shared_assets.py; one admonition test replaced by two, since a series with no lecture using a file is no longer a source of it).tools/drift-checkandtools/pool-checkclean;tools/promote --refreshhas nothing to refresh.duopoly_mpe.py: intermediate leads (advanced recorded stale, one pool file), advanced catches up (recorded, run clean), advanced leads, intermediate forks (a drift issue, no refresh loop). The pool-check was clean throughout.differs); a caught-up copy never recorded, so its next change was refused; a refresh loop when a non-canonical series edits both its lecture copy and the file; a record left naming a series whose lecture stopped using the file; two records for what became one file never merged; a hand-edited file lost when its asset moved; one lecture's refusal taking down unrelated users of the same asset; a pulled-in lecture written although the lecture that needed it failed; pulled-in lectures not named in the output. The organiser's review then found, reproduced, and these are fixed with tests: an asset that moved in the run lost its stale record; a hand-edited shared file was restored silently when every user was in the batch; a series left out with--excludethat only holds a copy was dropped from the record; a file renamed upstream split in two; an optional pull-in could turn the run red. Its re-review found that a renamed file could be matched to an unrelated new lecture's identical file; a rename is now recognised only for a lecture that already used the asset.Known limits
.pyfile a lecture loads, that pairs text and code no series published together, until the refused lecture is settled.asset-record), and the refresh fails on it, every night, until its own refusal (a real divergence) is settled.--excludethat caught up to a version the pool has since left.promoted_atpin stays at its old value until a--tocrun (as on main).Closes #23.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMXuHMiWb8victibwcU