fix(docker): install the dev frontend from the lockfile - #42
fix(docker): install the dev frontend from the lockfile#42devin-ai-integration[bot] wants to merge 1 commit into
Conversation
docker/docker-frontend.sh ran a bare `npm install`, which ignores superset-frontend/package-lock.json and resolves fresh versions when the dev container starts. The non-dev path in Dockerfile already uses `npm ci`; this aligns the in-container dev path with it. Generated-by: Devin (https://devin.ai) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Upstream issue filed: apache#42979 Verified against |
|
Superseded by #33. Its sole change — npm install to npm ci in docker/docker-frontend.sh — is already in #33, which pairs it with the .npmrc cooldown files that motivate installing from the lockfile. #42's explanatory comment is better and should be carried over to #33. Closing in favour of #33. Reviewed together with the other open PRs on this fork; reopen if this was the wrong call. |
SUMMARY
docker/docker-frontend.sh:36ran a barenpm install. That resolves dependency versions afresh at container start and ignoressuperset-frontend/package-lock.json, so a dev container started today can install a package version published minutes ago and never reviewed here. The non-dev build path already installs from the lockfile (Dockerfile:75,npm ci); this change makes the in-container dev path do the same.The diff is three lines:
npm installbecomesnpm ci, with a comment stating why. No lockfile-less install is required at that point in the script — the lockfile is present in the bind-mountedsuperset-frontenddirectory, andnpm ciresolves against it.Behaviour this changes, beyond version pinning:
npm cideletesnode_modulesand reinstalls from scratch on every container start.superset-frontendis bind-mounted from the host (docker-compose.yml:33), so the host'snode_modulesis wiped and rebuilt each timesuperset-nodestarts, wherenpm installwas close to a no-op on repeat starts. Measured cost with a warm npm cache:added 3020 packages, and audited 3056 packages in 1m.npm cifails hard whenpackage.jsonandpackage-lock.jsondrift, instead of silently resolving something new. Withset -eat the top of the script, that surfaces as thesuperset-nodecontainer exiting before the webpack dev server starts, rather than as a dev server running against unreviewed versions. This is the intended trade, but it is a change in failure mode.NPM_RUN_PRUNE=truestill works.npm run pruneremoves./{packages,plugins}/*/{node_modules,lib,esm,tsconfig.tsbuildinfo,package-lock.json}; the rootpackage-lock.jsonthatnpm cineeds is untouched.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable — no UI change.
TESTING INSTRUCTIONS
Evidence below was produced against this branch on
node:24-trixie-slim, the base image the dev frontend container uses (Dockerfile:32), withsuperset-frontend'spackage.json,package-lock.json, and all workspacepackage.jsonfiles and no pre-existingnode_modules— i.e. the post-npm run prunestate.npm ciresolves against the committed lockfile:node_modules/*entry inpackage-lock.json, the installed package's ownpackage.jsonversion was compared to the locked version:(The 3020 − 2974 difference is lockfile entries with no
versionfield or no installedpackage.jsonto read, e.g. platform-specific optional packages resolved for other architectures.)pre-commit, per AGENTS.md), withdocker/docker-frontend.shstaged:shellcheckis not installed in this environment and is not apre-commithook in this repo, so the script was only syntax-checked.docker/docker-frontend.sh; there is no shell-script test target. The frontend Jest harness was run as a smoke check that the change did not disturb it:Manual verification of the full path:
Expect
Running "npm ci"in the log, followed by the webpack dev server on http://localhost:9000.Limitations of the evidence:
npm ciwas verified in the same base image with the same manifests, not by startingsuperset-nodeunderdocker compose, so the full dev stack was not brought up.npm cion this machine's host toolchain (node v20.18.1 / npm 10.8.2) reportsMissing: @noble/hashes@1.8.0 from lock fileandMissing: dompurify@3.4.13 from lock file. The same command on the container's pinned toolchain (node v24.19.0 / npm 11.17.0, matchingengines:node ^24.16.0,npm ^11.13.0) succeeds. Contributors runningnpm cion an npm older than the pinned major will see spurious drift errors; inside the container, which is what this script governs, the toolchain is pinned and correct.Adversarial self-review of the diff — what was checked and what was found:
npm ciat this commit? Yes on the pinned toolchain; no on npm 10. Recorded above.npm run pruneremove somethingnpm cineeds? No. It deletes workspace-level lockfiles, not the root one; the test ran in exactly that state.npm install's add-a-package behaviour?docker-compose.yml:211anddocker-compose-light.yml:176invoke it as a container command; neither passes package names, and the script installs no packages beyond the manifests.set -e(line 18) means a failednpm cistops beforenpm run dev-server.npm installinDockerfiletouched? No. It was alreadynpm ci; this branch changes one file.ADDITIONAL INFORMATION
AI DISCLOSURE
This change was authored with AI assistance (Devin). A human reviews it before merge.
AUTHOR'S NOTE
Link to Devin session: https://app.devin.ai/sessions/cc4b160760994e49a6e20054fc9d4934
Requested by: @jethac