Skip to content

fix(build): deliver stranded docker-build fixes lost after PR #6 squash merge - #7

Merged
SabaTech-dev merged 4 commits into
mainfrom
fix/docker-build-stranded-commits
Aug 26, 2026
Merged

fix(build): deliver stranded docker-build fixes lost after PR #6 squash merge#7
SabaTech-dev merged 4 commits into
mainfrom
fix/docker-build-stranded-commits

Conversation

@SabaTech-dev

Copy link
Copy Markdown
Owner

Context

PR #6 was squash-merged at 93d32a9 content (repin buildx SHA + Dockerfile pnpm-first + .dockerignore) as e312575. Four commits with the actual root-cause fixes were pushed to fix/ci-buildx-pnpm AFTER the merge and never reached main.

Result on main (e312575):

  • docker build fails: ERR_PNPM_ADDING_TO_ROOT during pnpm build (exit 1)
  • CI job Docker Build & Provenance: failure
  • Workflow SLSA Provenance (Build & Attest): failure
  • CI job Build: success only because the || exit 0 masking workaround is still present

What this PR does

Cherry-picks the 4 stranded commits (no new code, authorship preserved):

Commit Fix
217a3bd postinstall shim for next@16 + typescript@7 detection (scripts/fix-typescript-detection.sh) — root cause of ERR_PNPM_ADDING_TO_ROOT
440ceeb lazy-init JWT key cache — unblocks build-time page data collection without runtime secrets
4bed31e CMD via real JS entrypoint (next/dist/bin/next) — pnpm .bin shim crashed at container start
9ce9a64 remove the `pnpm build

Verification

  • docker build -t amc:verify . on this branch: exit 0 (27s), pnpm build step compiled successfully
  • Unit tests: tests/typescript-detection.test.ts + src/lib/jwt-utils.test.ts — 13/13 passed
  • Container smoke test (with JWT_SECRET + ADMIN_PASSWORD): /api/health 200, /login 200
  • Without secrets the container starts but middleware returns 500 — runtime env requirement, not a build defect

Card: workboard d3770a95

Joker added 4 commits August 26, 2026 03:23
next@16 verifies the TS toolchain by probing typescript/lib/typescript.js
(verify-typescript-setup -> has-necessary-dependencies). typescript@7 is
the Go-native port and no longer ships that file, so next build treated
typescript as missing and attempted an auto-install, dying with
ERR_PNPM_ADDING_TO_ROOT under pnpm workspaces (Docker) or throwing
missingDepsError in CI.

The postinstall now creates a tiny ESM shim at the probed path that
re-exports the package version metadata. Build-time type checking stays
disabled via typescript.ignoreBuildErrors, so the classic compiler API
is never loaded. Guarded by tests/typescript-detection.test.ts.
loadKeys() ran at module scope, so importing jwt-utils without runtime
secrets threw during next build page-data collection (Docker/CI builds
have no .env.local): 'Failed to collect page data for /api/wiki/sync'.
This was hidden behind the CI build masking workaround.

The cache now initializes lazily on first sign/verify call. Fail-fast is
preserved: the first token operation still validates JWT_SECRET/JWT_SECRETS.
node_modules/.bin/next is a POSIX shell shim in the pnpm layout; running
it with 'node' died with SyntaxError on container start. Invoke
next/dist/bin/next (the actual JS entrypoint) instead. This CMD path was
never exercisable before because the image build never succeeded.
The '|| exit 0' in the Build job (b3a99e2) converted every build exit 1
into a warning, hiding both the TypeScript detection failure and the
JWT module-scope failure. With both root causes fixed, pnpm build exits
0 on its own; the job now fails loudly again on real regressions.
@SabaTech-dev
SabaTech-dev merged commit 5e919e6 into main Aug 26, 2026
4 checks passed
@SabaTech-dev
SabaTech-dev deleted the fix/docker-build-stranded-commits branch August 26, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant