make build-theme never cleans, so artifacts from a previous build can leak into the bundle

Open Beginner friendly
#233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, playwright, typescript

Research direction

Start with the Makefile build-theme target and inspect the npm run clean script, which removes rimraf public/build build api. Add the clean step before the existing deployment cleanup, then build two theme revisions and compare their rendered output using the workflow documented in tests/visual/README.md and configured by playwright.config.ts.

Written by the indexing model from the issue text.

Description

maintenance

The build-theme target removes only .deploy/<theme> before building. It then runs npm run prod:build, and neither the target nor that script runs npm run clean (rimraf public/build build api), so whatever build/ and public/build already contain survives the build — and Makefile lines 21-22 copy both directories wholesale into the bundle.

Step What it clears
rm -rf .deploy/$(THEME) the deploy directory only
npm run prod:build nothing — prod:copy, build:thebe, build:css, remix build, relative-css-asset-urls.mjs
cp -r public / cp -r build copies both into the bundle, stale files included

The consequence that matters is for A/B comparisons: building one revision, then another, and diffing the rendered output. This was hit while working on #225, where a bundle intended as the "baseline" rendered as the candidate instead, and npm run clean before building fixed it. I have verified the missing clean step and the wholesale copy above; I have not reproduced the exact file that leaked, so I would not want the issue to assert a precise mechanism beyond that. A plain single build is generally fine in practice, since remix build rewrites its own entry bundle each time — the hazard is stale other files and anything that compares two revisions.

That pattern is not exotic here: tests/visual/README.md and playwright.config.ts both document diffing one theme build against another as the way to validate a visual change, and THEME_TEMPLATE exists precisely to support it. So the trap sits directly in a documented workflow, and it fails silently — the comparison produces a plausible-looking result rather than an error.

Suggested fix

Add the clean to the target, so the documented workflow is safe by default:

build-theme: check
	npm run clean
	rm -rf .deploy/$(THEME)

Failing that, a note in tests/visual/README.md's "To diff one theme build against another" recipe and in CONTRIBUTING.md would at least make it discoverable. The target is already slow enough that a rimraf of three directories is not a meaningful cost.

🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
1
Forks
1
Avg merge
1d 6h
Merged PRs (30d)
56

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantEcon/quantecon-theme.mystmd

All issues in QuantEcon/quantecon-theme.mystmd

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.