Make the paper render hermetic; render-check it in CI#64
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The manuscript pinned `jupyter: policybench-paper`, a user-level kernelspec whose argv points at one specific checkout's .venv. Rendering from any other checkout silently executed that other checkout's policybench, fresh machines could not render at all, and the render env relied on undeclared deps. - paper/index.qmd: switch the Jupyter kernel from the named `policybench-paper` kernelspec to the standard `python3` kernel. - paper/render_paper.py: pin the Jupyter engine to the invoking virtualenv. QUARTO_PYTHON selects the interpreter, but QUARTO_PYTHON alone is not enough because Quarto resolves the `python3` kernel by name and a user-level `python3` kernelspec can shadow the venv's own kernel. JUPYTER_PREFER_ENV_PATH=1 makes Jupyter search the venv's share/jupyter first, so the kernel resolves to the invoking venv. Updated the install hint to `uv run python`. - pyproject.toml / uv.lock: declare the full render env by adding nbformat and nbclient to the docs extra (previously only transitive). Lock diff is minimal; no unrelated upgrades. - .github/workflows/paper.yml: new job, gated to paper/** and policybench/** changes, that installs the locked docs env + quarto + rsvg-convert, generates the embedded figure, and renders the manuscript to HTML only (no PDF/TeX). The render executes the venv's policybench and fails the job on any cell error. Rendered output goes to paper/out (gitignored); nothing rendered is committed. - paper/README.md: document the hermetic render and the `uv sync --extra docs` + `uv run python paper/render_paper.py` workflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
16bb213 to
13afbf4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The paper render depended on a user-level Jupyter kernelspec (
policybench-paper) registered against one specific checkout's venv. Rendering from any other checkout silently executed the other checkout'spolicybenchcode, fresh machines couldn't render at all, and the env needed undeclared deps (nbformat/nbclient). All three bit us during the #62 render.What
paper/index.qmduses the standardpython3kernel;render_paper.pysetsQUARTO_PYTHON(already did) plusJUPYTER_PREFER_ENV_PATH=1— the load-bearing discovery: Quarto resolves thepython3kernel by name, and a user-level~/Library/Jupyter/kernels/python3can shadow the venv kernel and point at an unrelated checkout (it does on this machine — proven empirically with a probe render that imported the wrongpolicybench). The env var makes Jupyter search the venv's kernels first.nbformat+nbclientdeclared in thedocsextra (uv.lock diff: 6 lines, no version changes).paper.ymlworkflow renders the manuscript (HTML-only, no TeX) on PRs touchingpaper/**,policybench/**, or dependencies — failing on any notebook cell error. This catches the import-drift class of failure (e.g. a dep bump breakingpolicybenchimports the paper executes). The job also runsgenerate_figures.py+ installslibrsvg2-bin, without which the embedded scatter PNG never gets generated and the render fails.paper/README.md: render flow is nowuv sync --extra docs+uv run python paper/render_paper.py; the kernelspec/JUPYTER_PATH workaround instructions are gone.Committed rendered artifacts under
app/public/paper/are untouched — the header change has no effect on them, and CI renders go to gitignoredpaper/out/.Verification
policybench(probe:policybench.config.__file__resolves into the worktree), exit 0, all 19 cells clean.uv run pytest -m "not slow"(279 passed), ruff clean,uv sync --lockedconsistent, actionlint clean on both workflows.🤖 Generated with Claude Code