Repository navigation
Conversation
The dashboard image ran `npm install` inside packages/web-dashboard with only that package.json in the build context. It resolved dependency ranges on build day and ignored package-lock.json. The image now in production holds three package versions that appear in no lockfile entry: @next/env 16.4.6, semver 6.3.2 and semver 7.8.6. Why @next/env differed: the lockfile entry for the dashboard's next 16.4.6 recorded the dependency ranges of 16.3.3, and the @next/env entry beside it was still 16.3.3. `npm ci` and `npm ls` accept that, because they compare the recorded ranges with the lockfile, not with the registry. package-lock.json: two entries repaired from npm's own resolution of the same versions. In the next 16.4.6 entry, @next/env and the eight @next/swc-* ranges go from 16.3.3 to 16.4.6 and sharp from ^0.35.3 to ^0.35.5. The @next/env entry goes from 16.3.3 to 16.4.6. The lockfile keeps its 1018 entries; nothing is added or removed. A full regeneration was not used: with the stale entries removed, npm moves the whole Next family from the dashboard's node_modules to the repository root (11 entries added, 12 removed). packages/web-dashboard/Dockerfile: the build context is the repository root and the dependencies are installed with `npm ci --workspace=packages/web-dashboard --ignore-scripts`. The source is copied before the install, and three checks that run in between fail the build when the ignore file is not honoured: the repository's .dockerignore drops the svg public assets and keeps a local checkout's node_modules and .next in. The standalone output is read from the workspace directory. packages/web-dashboard/Dockerfile.dockerignore: an allowlist holding only what the Dockerfile copies. It replaces the root .dockerignore, which excludes the svg files under public that the image serves. packages/web-dashboard/next.config.ts: outputFileTracingRoot is the repository root. Next drops every traced file outside that root, and the dashboard's dependencies are installed from the repository root's node_modules. scripts/compare-image-deps.mjs and its tests: list every package.json under node_modules in the built image and fail when a version is in no lockfile entry. A version the lockfile pins only for another workspace is reported as a warning. .github/workflows/ci.yml: the three dashboard builds use the root context. The image is compared with the lockfile in docker-build-dashboard, in release-tooling-validation, and in publish-release-images before the image is pushed. docker-compose.build.yml and the dashboard README describe the same build context. Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
/gitwire run review |
|
|
There was a problem hiding this comment.
🤖 AI Code Review — 💬 Needs discussion
Confidence: low · Findings: 5
AI judgment: NEEDS DISCUSSION · Evidence: COMPLETE · Authority: advisory
Evidence complete · 9/9 changed files accounted for
Other findings (5)
- [medium] Described lockfile repair is not among the PR's changed files; npm ci would ship the stale @next/env
- [low] compare-image-deps silently skips packages whose package.json is unreadable or unparseable
- [medium] Cross-platform native optional dependencies may break or degrade the npm ci image build
⚠️ unverified - [medium] Building from the root lockfile pulls the entire workspace tree into the dashboard image
⚠️ unverified - [low] The new blocking CI gate ships without visible test coverage
⚠️ unverified
🔮 Devil's Advocate (2 turns): 3 missed risks found · 2 upheld
GitWire AI Review Gate (bundle-driven v2) · Structured schema · Scope-validated · Devil's Advocate · AI recommendation — maintainers and repository policy retain authority
Finding details (not annotatable inline)
-
[MEDIUM] Cross-platform native optional dependencies may break or degrade the npm ci image build
npm ci installs exactly what the lockfile records. If package-lock.json was generated on developer macOS/Windows machines, platform-conditional optional deps that Next and tooling rely on (@next/swc-linux-x64-gnu/musl, rollup/esbuild natives) may be missing from the lockfile, causing the Docker build's npm ci to fail outright or next build to silently fall back to the WASM SWC compiler (severely slower builds). The review scrutinized version drift (@next/env) but ignored platform-conditional lockfile artifacts, which are the classic failure mode of switching a Linux image build to npm ci from a lockfile authored on other OSes.
-
[MEDIUM] Building from the root lockfile pulls the entire workspace tree into the dashboard image
Running npm ci at the monorepo root installs dependencies for every workspace, not just web-dashboard. Unless the Dockerfile uses multi-stage pruning or next's standalone output tracing, the image now ships unrelated workspaces' dependencies and executes their lifecycle scripts during build — enlarging the image, widening the supply-chain surface this PR claims to tighten, and coupling the dashboard build to unrelated packages' postinstall health. The review evaluated the lockfile mechanics but never asked what population of packages now lands in the image.
-
[LOW] The new blocking CI gate ships without visible test coverage
compare-image-deps.mjs is a fail-closed gate with subtle semantics — exit 2 on malformed entries, silent null-skip on unreadable manifests, and presumably version comparison logic that finding #1's own analysis shows is easy to get wrong (the review itself debated what should throw vs. skip). None of the reviewed findings asked whether the comparator itself has unit tests covering the skip/throw/comparison branches. An untested gate can fail in both directions: blocking merges on false mismatches, or — worse for a supply-chain check — silently passing on real drift.
| # Strict npm ci, scoped to the dashboard workspace — no fallback to npm install. | ||
| # Lifecycle scripts are skipped, as in the app image. | ||
| RUN npm ci --workspace=packages/web-dashboard --ignore-scripts | ||
|
|
There was a problem hiding this comment.
[MEDIUM] Described lockfile repair is not among the PR's changed files; npm ci would ship the stale @next/env
The PR switches the Dockerfile to npm ci from the root package-lock.json, and the description states that two lockfile entries were repaired (packages/web-dashboard/node_modules/next ranges and @next/env bumped to 16.4.6). However, the PR metadata lists exactly 8 changed files and package-lock.json is not one of them. Without that commit, npm ci still succeeds — it validates the lockfile against the package.json manifests, not against next's internally recorded dependency ranges (the description itself notes npm accepts the stale entry) — so CI stays green while the image installs @next/env 16.3.3 alongside next 16.4.6, the exact drift this PR diagnoses as the production root cause. The new compare-image-deps check cannot catch this, because it compares the image against the same stale lockfile, so both sides agree and the check passes. Fix: confirm the two lockfile-entry repairs are committed on this branch (fix/dashboard-image-lockfile-v2) before merge; otherwise the stated goal of aligning @next/env with what next 16.4.6 resolves is silently lost.
| const packages = []; | ||
| const entered = new Set(); | ||
| const manifestOf = (dir) => { | ||
| try { |
There was a problem hiding this comment.
[LOW] compare-image-deps silently skips packages whose package.json is unreadable or unparseable
In scripts/compare-image-deps.mjs, manifestOf() catches every read/JSON.parse error and returns null, and record() then drops the directory from the listing entirely. For a fail-closed supply-chain gate, a corrupt, truncated, or zero-byte package.json inside node_modules makes that package invisible to the audit instead of failing the check — the image would pass (or warn) while containing an unverifiable package. Since the script's own contract treats malformed listing entries as exit 2, a package.json that exists but fails to parse should arguably be a CheckError too, rather than a silent skip. Suggested fix: in record(), distinguish 'no package.json' (skip, e.g. non-package dirs) from 'package.json exists but cannot be read/parsed' (throw a CheckError with the path). Low practical risk for npm-ci-built images, hence P3, but it is the one fail-open corner in an otherwise strict check.
|
The automated review on this pull request found one thing that was right: This pull request is therefore superseded by #498, which carries the same change with that fix and six tests for it. #498 also holds the answer to each of the five findings of the review. This pull request is closed as superseded, unmerged. Its branch and its record stay. The other four findings did not hold against the pull request:
|
Status
Create only. Merge and deploy are on hold until the diff and the build test are reviewed.
What this changes
The dashboard image was not built from the lockfile.
packages/web-dashboard/Dockerfilecopied onlypackage.jsoninto its build context and rannpm install, which resolves dependency ranges on the day of the build. This PR makes the image install frompackage-lock.json, the way the app image does, and adds a CI check that compares the packages inside the built image with the lockfile.What the current build holds
I listed every package in the running production dashboard container (read-only) and checked each against the lockfile on master. The container holds 16 packages. Three versions are in no lockfile entry:
@next/envsemver(top level)semver(undersharp)The Dockerfile as it is on master reproduces this: a local rebuild of it, compared with the master lockfile by the new check, reports the same three.
Root cause of the
@next/envdifferenceThe lockfile entry for the dashboard's
next16.4.6 recorded the dependency ranges of 16.3.3, and the@next/enventry beside it was still 16.3.3.npm ciandnpm lsaccept that, because they compare the recorded ranges with the lockfile and not with the registry.Lockfile change
Two entries repaired from npm's own resolution of the same versions, on a scratch copy:
packages/web-dashboard/node_modules/next:@next/envand the eight@next/swc-*ranges move from 16.3.3 to 16.4.6, andsharpfrom^0.35.3to^0.35.5.packages/web-dashboard/node_modules/@next/env: 16.3.3 to 16.4.6 (version,resolved,integrity).The lockfile keeps its 1018 entries. Nothing is added or removed. One installed version changes:
@next/envfor the dashboard, from 16.3.3 to 16.4.6, which is the versionnext16.4.6 declares.Recorded ranges against the published manifests (registry audit of the dashboard's production tree, 76 entries compared): 10 ranges differ from the published manifest on master, 0 after this PR.
Why not a full regeneration
npm install --package-lock-onlyon the master lockfilepackages/demo-dashboard)packages/web-dashboardA repairs nothing: npm trusts the lockfile. B relocates the whole Next family from the dashboard's
node_modulesto the repository root, which changes the tree shape for every workspace, so it is wider than this unit. C changes only the two stale entries.Build change
package-lock.json.npm ci --workspace=packages/web-dashboard --ignore-scripts. The lockfile is satisfied with only the root manifests and the dashboard manifest present, so the other workspaces are not copied.Dockerfile.dockerignore(new, next to the Dockerfile): an allowlist that admits only what the Dockerfile copies. With the context at the repository root, the repository's.dockerignorewould otherwise apply; it excludes*.svg, the public assets the image serves.node_modulesand no.nextfrom a local checkout, and the svg assets present.next.config.ts:outputFileTracingRootis the repository root. Next drops every traced file outside that root, and the dependencies now come from the repository root'snode_modules.docker-compose.build.ymland the dashboard README describe the same build context.What changes inside the image
/app/server.js/app/packages/web-dashboard/server.js/app/.next,/app/public/app/packages/web-dashboard/.next,/app/packages/web-dashboard/publicpackage.json(Linux)Nothing outside the image depends on those paths: the production compose service sets no command or working directory, and the deploy script checks the dashboard over HTTP.
The second React version comes from the root lockfile and predates this PR:
demo-dashboardresolvesreactto 19.2.8 at the repository root, while the dashboard pins 19.2.4 in its ownnode_modules. Next's standalone output copies fragments of both. In a local build the rootreacthas 3 files and the rootreact-domonly its manifest. The only package in the output at the root that requiresreactisstyled-jsx, a dependency ofnextthat this dashboard does not use.Next loads one React instance. Its build maps every
reactimport to the copy inside thenextpackage for the browser, and the server output reaches React only through one module of its own. I checked this at runtime on a local build: all 25 static pages render server-side with status 200 and no hook error, and two pages hydrate in a browser with no React error.CI change
docker-build-dashboard,release-tooling-validation,publish-release-images) use the repository root as context.publish-release-imagesthe comparison runs before the image is pushed.scripts/compare-image-deps.mjslists everypackage.jsonundernode_modulesin the image and fails when a version is in no lockfile entry. A version the lockfile pins only for another workspace is a warning. Its 15 tests are inpackages/core/tests/compare-image-deps.test.js.Verification
Manual CI run on this branch, commit
8def80f: https://github.com/Octo-Lex/GitWire/actions/runs/45063731937. All 16 jobs passed;publish-release-imagesis skipped on a manual run by design.docker-build-dashboard:npm cinext buildsemver@6.3.1at the root: pinned by the lockfile for another workspace; a lonepackage.jsonwith no code, which Next's standalone output also wrote into the old image (as 6.3.2)/dashboardrespondeddocker-build-dashboardworks on a clean checkout, so its checks show that the ignore file is honoured and nothing more.release-tooling-validationrunsnpm ciat the repository root before building, which leaves the dashboard's installed dependencies in the checkout. The checks pass there as well, so those dependencies stay out of the build context.The validator image is not touched by this PR.
Earlier attempt
The first validation run, https://github.com/Octo-Lex/GitWire/actions/runs/45062066337 on branch
fix/dashboard-image-lockfile(commit0365a92), failed indocker-build-dashboardandrelease-tooling-validation. The cause was mine: I had placed thenode_modulescheck afternpm ci, which creates that directory, so the check could not pass. Everything before it passed in that run. This branch is the same change with the checks moved before the install. The superseded branch is left in place until this PR is merged.Not verified
publish-release-imagesdoes not run on a manual CI run. Its dashboard build and comparison first run after the merge.Found while working, outside this PR
packages/demo-dashboardhas the same kind of stale entry:next15.5.28 with the ranges of 15.5.24. Its 10 recorded ranges differ from the published manifest, unchanged by this PR. Its image also installs withnpm install.bot,docsandplugin-sandboximages install withnpm installas well. Of the three images the release pipeline publishes, the app image was already lock-pinned and the executor image has no dependencies.release-tooling-validationthe app image's build context transfers 596 MB, also on master (run45047105326). The job installs dependencies at the repository root before building. I did not check whether the rehearsal image differs from the published one because of it.