You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
preview actions: a preview key, a link style and a toc, so several products can preview on one pull request #336
From the design note .qe/dev/log/2026-11-16-product-builds-design.md (#335), item 4. QuantEcon/lectures will build several products from one pool of lectures (QuantEcon/project-monorepo#77), each with its own preview on the same pull request. Three things in the preview actions stand in the way, all in the scripts that preview-netlify, preview-cloudflare and preview-workers share:
scripts/preview-comment.cjs finds its comment by one marker per provider, <!-- quantecon-preview:<provider> -->, so a second product's preview replaces the first's comment.
Its links to changed lectures are <deploy url>/<path>.html, Jupyter Book 1's layout; a mystmd site serves /<slug>.
scripts/detect-changed-lectures.sh lists every added or modified .md under lectures-dir, at any depth, except paths that begin <lectures-dir>/_ and <lectures-dir>/intro.md. With the pool as lectures-dir it lists changed lectures the product does not publish, and, with no _toc.yml in the pool, keeps lectures/ in links that a product serves at its root. A product's own pages live in products/<key>/, outside the pool.
Proposed: on all three preview actions, preview-key (added to the marker and the heading; empty keeps today's marker), link-style (html, the default, or slug), and toc (the _toc.yml whose files count as the product's lectures, which also strips the pool folder from the links and reaches the product's own pages). Every default keeps what callers get today. One pull request, with the chapters, a harness job that fails on today's code, a CHANGELOG entry and a staged release.
A naming update for the body above: the folder QuantEcon/lectures uses is sites/<key>/, not products/<key>/ (decided 2026-11-17; the folders are open as QuantEcon/lectures#64). A site's own pages live in sites/<key>/, outside the pool, and its table of contents is sites/<key>/_toc.yml, which is the file the proposed toc input would name.
A check of this issue against origin/main at 52e8a72 and QuantEcon/lectures' main at 868773d, before any code, with the maintainer's decisions on its four questions. Nothing has merged here since it was written that touches the two scripts or the preview actions' steps, and that still holds at 8ee53d7 (v0.21.1).
The facts hold, with three refinements. Two previews on different providers already get separate comments, so the collision is between two previews on the same provider. QuantEcon/lectures' build stages a site's _toc.yml into lectures/ before it builds, so a preview step inside the build leg would strip lectures/ from links; a deploy job of its own, which would hold the secrets and check out afresh as the preview chapters advise, and the placeholder, which reads the repository through the API, never see that file, so for them the links keep lectures/ as the issue says, and a change to a site's own page in sites/<key>/ is never listed. A mystmd site's address for a page isn't its file name: mystmd turns mccall_model.md into /mccall-model/ (lower case, _ to -, at most 50 characters, numbered when two collide, with folders when the site sets folders: true).
Decided scope: two new inputs on all three preview actions, comment-key and toc-file, both empty by default, which is today's behaviour. link-style waits until #337 lands and a mystmd site needs a preview, when its rule can be checked against a real build.
comment-key is lowercase words joined by single dashes, at most 28 characters; any other value fails the input check on every event. A key adds itself to the marker (<!-- quantecon-preview:netlify:dp -->) and to both headings (## 📖 Netlify Preview Ready! (dp)), and a keyed run finds only its own keyed comment, never a heading-only or unkeyed one. An unkeyed run finds its comment exactly as today, so an existing pull request's comment is never touched by a keyed preview, and a comment an older release wrote stays the unkeyed caller's. The key separates the comments only: each site deploys to its own Netlify site, Pages project or Worker at pr-<N>, and the key doesn't reach the alias.
toc-file is the path of a _toc.yml from the repository root, such as sites/dp/_toc.yml. A changed .md counts when the toc names it, as a pool lecture in lectures-dir or as a page in the toc's own folder; the toc's root: page isn't listed, as intro.md isn't today, since the preview's own link opens it. Its link is the toc entry at the site's root, with no folder. A pool lecture the toc doesn't name isn't listed. A missing or empty toc is a warning, the comment still posts, and no lectures are listed. The toc is read line by line (root: and file: entries, with quotes, extensions and trailing comments dropped), since the placeholder runs where no YAML library is available.
Every existing caller gets the same comment, marker and links: the harness's byte-exact comment fixtures and change-detection cases run unchanged with the new inputs unset, and new cases, which fail on today's scripts, cover keyed and unkeyed comments side by side, keys that share a prefix, refused keys, and the toc's filter in both the deploy's script and the placeholder, which must give the same list. At release, a canary pull request at the candidate shows the two existing comments unchanged beside a keyed one filtered by a second toc. One pull request, with the chapters, a CHANGELOG entry and a staged release; not breaking.
Activity
mmcky commentedon Nov 16, 2026
A naming update for the body above: the folder QuantEcon/lectures uses is
sites/<key>/, notproducts/<key>/(decided 2026-11-17; the folders are open as QuantEcon/lectures#64). A site's own pages live insites/<key>/, outside the pool, and its table of contents issites/<key>/_toc.yml, which is the file the proposedtocinput would name.mmcky commentedon Nov 19, 2026
A check of this issue against
origin/mainat52e8a72and QuantEcon/lectures'mainat868773d, before any code, with the maintainer's decisions on its four questions. Nothing has merged here since it was written that touches the two scripts or the preview actions' steps, and that still holds at8ee53d7(v0.21.1).The facts hold, with three refinements. Two previews on different providers already get separate comments, so the collision is between two previews on the same provider. QuantEcon/lectures' build stages a site's
_toc.ymlintolectures/before it builds, so a preview step inside the build leg would striplectures/from links; a deploy job of its own, which would hold the secrets and check out afresh as the preview chapters advise, and the placeholder, which reads the repository through the API, never see that file, so for them the links keeplectures/as the issue says, and a change to a site's own page insites/<key>/is never listed. A mystmd site's address for a page isn't its file name: mystmd turnsmccall_model.mdinto/mccall-model/(lower case,_to-, at most 50 characters, numbered when two collide, with folders when the site setsfolders: true).Decided scope: two new inputs on all three preview actions,
comment-keyandtoc-file, both empty by default, which is today's behaviour.link-stylewaits until #337 lands and a mystmd site needs a preview, when its rule can be checked against a real build.comment-keyis lowercase words joined by single dashes, at most 28 characters; any other value fails the input check on every event. A key adds itself to the marker (<!-- quantecon-preview:netlify:dp -->) and to both headings (## 📖 Netlify Preview Ready! (dp)), and a keyed run finds only its own keyed comment, never a heading-only or unkeyed one. An unkeyed run finds its comment exactly as today, so an existing pull request's comment is never touched by a keyed preview, and a comment an older release wrote stays the unkeyed caller's. The key separates the comments only: each site deploys to its own Netlify site, Pages project or Worker atpr-<N>, and the key doesn't reach the alias.toc-fileis the path of a_toc.ymlfrom the repository root, such assites/dp/_toc.yml. A changed.mdcounts when the toc names it, as a pool lecture inlectures-diror as a page in the toc's own folder; the toc'sroot:page isn't listed, asintro.mdisn't today, since the preview's own link opens it. Its link is the toc entry at the site's root, with no folder. A pool lecture the toc doesn't name isn't listed. A missing or empty toc is a warning, the comment still posts, and no lectures are listed. The toc is read line by line (root:andfile:entries, with quotes, extensions and trailing comments dropped), since the placeholder runs where no YAML library is available.Every existing caller gets the same comment, marker and links: the harness's byte-exact comment fixtures and change-detection cases run unchanged with the new inputs unset, and new cases, which fail on today's scripts, cover keyed and unkeyed comments side by side, keys that share a prefix, refused keys, and the toc's filter in both the deploy's script and the placeholder, which must give the same list. At release, a canary pull request at the candidate shows the two existing comments unchanged beside a keyed one filtered by a second toc. One pull request, with the chapters, a CHANGELOG entry and a staged release; not breaking.
Claude Code (on behalf of mmcky)
fix(preview-*): a page called EOF, and a toc at the root, in toc-file…
docs(preview-*): where each half reads toc-file, and what one reader …
feat(preview-*): comment-key and toc-file, for several sites on one p…
site-build: name preview-cloudflare at v0, now that v0.22.0 carries i…