promote: a new lecture that shares a single-consumer asset with a switched lecture can never be promoted
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the promotion destination pass and the test harness described in the issue. Read the existing test test_an_asset_shared_with_a_guarded_lecture_stays_guarded and trace how destination paths are chosen for assets with a canonical: pool ledger entry. Add a regression test for the reproduced transition; done means the new lecture promotes successfully, shares the existing pool path, and leaves the switched lecture and asset record unchanged.
索引モデルが issue の本文から書いたものです。
説明
Follow-up from the review of https://github.com/QuantEcon/lectures/pull/14.
What happens
After promote --switch SERIES, a switched lecture can never be re-promoted (by design: the pool copy is the source of truth). Its single-consumer assets stay at _static/<slug>/.... If a lecture from another series is later promoted and references the same asset (same mirror path, same bytes), the destination step decides the asset now has two consumers and belongs in _static/_shared/..., finds the old location is still used by a lecture outside the batch, and refuses with:
[other] FAILED: asset _static/lecture_specific/mccall/fig.png is recorded at _static/mccall/fig.png but now maps to _static/_shared/mccall/fig.png — re-promote its other consumer(s) (mccall) in the same batch
The remedy it names is impossible. Adding mccall to the batch gives:
[mccall] FAILED: lectures/mccall.md is canonical in the pool (switched from intermediate on 2026-10-08) — promotion would overwrite the pool copy
So the new lecture cannot enter the pool while it shares that asset. Switching the new lecture's series does not help either, since the switch only touches ledger entries and the lecture has none yet.
Reproduction (with the tools/tests harness)
repo = make_repo(["intro", "intermediate"])
fig = b"figure bytes"
repo.mirror_file("intermediate", "_static/lecture_specific/mccall/fig.png", fig)
repo.lecture("intermediate", "mccall", lecture_text("McCall", refs=["_static/lecture_specific/mccall/fig.png"]))
assert repo.promote("mccall").returncode == 0
assert repo.promote("--switch", "intermediate").returncode == 0
repo.mirror_file("intro", "_static/lecture_specific/mccall/fig.png", fig)
repo.lecture("intro", "other", lecture_text("Other", refs=["_static/lecture_specific/mccall/fig.png"]))
assert repo.promote("other").returncode == 1 # the error above
assert repo.promote("other", "mccall").returncode == 1 # the suggested remedy also fails
When it bites
Only mid-transition: one series switched, another still fed from its mirror, and a new lecture in the second reusing a figure the first already owns. Assets that already live in _static/_shared/ are unaffected (the destination does not change, and #14 already keeps a switched asset's record when another lecture comes to share it).
Suggested fix
Treat a switched asset's location as frozen. In the destination pass, when the old pool path of (src_rel, digest) is referenced by a lecture whose ledger entry is canonical: pool, keep dest_map[(src_rel, digest)] = old instead of recomputing it, so the new lecture is rewritten to the existing path and shares the file in place. The switched lecture's pool text is untouched, the ledger gains the new lecture as a user of the asset, and the asset keeps its canonical: pool record. A test alongside test_an_asset_shared_with_a_guarded_lecture_stays_guarded would cover it.
- 主要言語
- Python
- スター
- 1
- フォーク
- 0
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 17
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QuantEcon/lectures のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
drift
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
question
難易度 4/5 1〜2日 初心者へのやさしさ 44/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
QuantEcon/lectures#40 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
QuantEcon/lectures の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Significant-Gravitas/AutoGPT#16733 ·
メンテナーはふだん 1 日以内に返信
-
changelog investigate
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
ramnes/notion-sdk-py#444 ·
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
Judgment-Pack/judgment-pack-spec#299 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
QuantConnect/Documentation#2858 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
btclib-org/btclib#3047 ·
メンテナーはふだん 1 日以内に返信