Repository navigation
Description
Part of #554. Change set B. Rulings: #554 rulings 1, 5, 6, 13, 15, 16.
Summary
- Today. Every deploy type-checks the webapp three times:
- the
📝 Type Checkjob (tsc --noEmit); 🏗️ Build Verification, whosenext buildruns Next's own type check;next buildagain, inside the webapp image build on the prod host.
- the
- The third check is on the critical path, inside
🏗️ Build Docker Images. It took 25.2–48.1 s, median 31.2 s, in six recent deploys: theCreating an optimized production buildoffset minus theChecking validity of typesoffset.
| Run | Deploy job | Type check start (s) | Compile start (s) | Type check (s) |
|---|---|---|---|---|
| 38068638114 | 114262648443 | 3.428 | 35.70 | 32.3 |
| 38239392350 | 114780192678 | 3.286 | 31.58 | 28.3 |
| 38392614215 | 115281929767 | 2.844 | 46.00 | 43.2 |
| 39275929831 | 118142985559 | 3.100 | 28.34 | 25.2 |
| 39297468969 | 118217497479 | 3.623 | 33.75 | 30.1 |
| 39398067267 | 118549257854 | 3.195 | 51.32 | 48.1 |
- After. The prod deploy passes
--build-arg NEXT_SKIP_TYPECHECK=1to the webapp image build. The two gates still type-check the same commit, and🚀 Deploy Productionneeds Build Verification to pass. - Expected saving. About 25–48 s of M3 and M1 (Measure CI/CD time to live after the v2.3 work: 1090 s median before #569) per deploy. After Build the deploy images while the quality gates run #565 lands, the saving applies to the image path only.
Depends on / Blocks
- Depends on: Roll back only after the deploy has started rolling services #555. Today
🚨 Rollback on Failureruns on a bareif: failure()(prod.docs.plus.yml:855-857). A failure in🏗️ Build Docker Imagesthen rolls back all live services. Do not start until Roll back only after the deploy has started rolling services #555 is onmain. - Blocks: nothing.
- Shares lines with: Build the deploy images while the quality gates run #565, Run the backend and webapp image builds at the same time, to cut the image build step #567 and Measure whether the backend image build still needs --no-cache #566 (the
🏗️ Build Docker Imagesstep); Cut the webapp image installs from 158 s to about 25 s per deploy #559 and Make CI failures reach Telegram: set the watchdog secrets, alert on red E2E pushes #557 (apps/webapp/docker/Dockerfile.bun). The issue that lands second re-reads those lines on currentmainand keeps both changes.
Current behaviour
All links are pinned to d0a53756f8676556358b6adc6c2397d2ed7c64c8.
-
The only
typescriptblock innext.config.jsnever applies (next.config.js:77-94):...(process.env.NODE_ENV === 'development' && { // Skip type checking during dev (Next.js handles it separately) typescript: { ignoreBuildErrors: false // Still check, but don't block compilation },
Lines 79–82 set Next's default, against their own comment.
next devruns no build type check, and thebuilderstage setsNODE_ENV=production(Dockerfile.bun:132,:155). So the block changes nothing. -
There is no top-level
typescriptkey. The nearest one iseslint: { ignoreDuringBuilds: true }(next.config.js:195-197). -
The installed Next is
15.5.27(apps/webapp/package.json:81). Innext/dist/build/type-check.js,startTypeCheckingreadsconfig.typescript.ignoreBuildErrors. When it is true, Next logsSkipping validation of typesand does not start the check. -
The
builderstage order (Dockerfile.bun:123-219):
line 191RUN bun install --frozen-lockfile; line 198COPY apps/webapp ./apps/webapp; lines 200–210GIT_HASHandNEXT_PUBLIC_GIT_HASH, below the install (AGENTS.md:295); line 219RUN --mount=type=cache,target=/app/apps/webapp/.next/cache bunx next build, which never caches. -
The deploy builds the webapp in one compose call with no build argument (
prod.docs.plus.yml:612-642):docker compose -f "${COMPOSE_FILE}" --env-file "${ENV_FILE}" \ build webapp admin-dashboard
-
The compose file has no
NEXT_SKIP_TYPECHECK(docker-compose.prod.yml:493-518). Stage (stage.docs.plus.yml:48) andapps/webapp/Makefile(Makefile:32) also read this file. -
Two gates already type-check every deploy commit:
📝 Type Checkrunsbun run typecheck(prod.docs.plus.yml:189-212), which isbun run --filter '*' typecheck(package.json:74). The webapp script istsc --noEmit(apps/webapp/package.json:15).🏗️ Build Verificationrunsbun run --filter @docs.plus/webapp build:ci(prod.docs.plus.yml:390-396).build:ciisnext build(apps/webapp/package.json:11), with noNEXT_SKIP_TYPECHECK.
-
🚀 Deploy Productionneedsneeds.build.result == 'success'(prod.docs.plus.yml:427-435). -
skip_quality_gatesdoes not skip Build Verification. The input is atprod.docs.plus.yml:41-45. Thebuildjob'sifonly accepts failed gates under it (:366-376). -
The admin type check is off the critical path. In job 118217497479 it printed
Finished TypeScript in 18.3s, and itsnext buildended at 18:00:57 UTC. The webappnext buildstarted at 18:03:02 UTC and ran 185.4 s.
Target behaviour
- Prod
pushdeploy andforce_deploydispatch: the webappnext buildprintsSkipping validation of types. skip_quality_gatesdispatch: the Docker build passesNEXT_SKIP_TYPECHECK=0and still type-checks.- No change for Build Verification, stage, the Makefile, dev compose, self-hosters and the admin image.
- Install cache: changing only
NEXT_SKIP_TYPECHECKleaves thebuilderinstallCACHED.
Implementation steps
Read every file in Read first before Step 0.
Step 0. Read and check the base
-
Confirm each cited line still matches on
main:git show main:apps/webapp/next.config.js | sed -n '77,94p;195,197p' git show main:apps/webapp/docker/Dockerfile.bun | sed -n '123,132p;190,219p' git show main:.github/workflows/prod.docs.plus.yml | grep -n -A30 'name: 🏗️ Build Docker Images' git show main:docker-compose.prod.yml | grep -n -A28 '^ webapp:'
-
Expect the quotes in Current behaviour. If Build the deploy images while the quality gates run #565 has landed, the build step lives in the
imagesjob instead ofdeploy. Make the Step 3 change there. -
If the dev-only
typescriptblock is gone, or a top-leveltypescriptkey exists, stop. Re-derive Step 1 from the new file, and comment here with what changed. -
Confirm Next is still
15.x:grep -n '"next"' apps/webapp/package.json grep -n "Skipping validation of types" apps/webapp/node_modules/next/dist/build/type-check.js
If Next is 16 or later, or the second command prints nothing, stop. Read the new type-check code first, and comment here.
-
Confirm the rollback guard is on
main:git show main:.github/workflows/prod.docs.plus.yml | grep -n -A2 'name: 🚨 Rollback on Failure'
Expect an
if:of the formfailure() && env.<marker> == 'true'. If it is still a bareif: failure(), stop and comment here.
Step 1. apps/webapp/next.config.js
-
Delete lines 79–82, the comment and the
typescriptblock inside theNODE_ENV === 'development'spread. Keep every other key in that spread. -
Add a top-level key just before
eslint: {(line 195 today):// The prod deploy sets NEXT_SKIP_TYPECHECK=1 on the Docker build only. The // `typecheck` job and Build Verification already type-check that commit. typescript: { ignoreBuildErrors: process.env.NEXT_SKIP_TYPECHECK === '1' },
-
Check it with
node. Next loads this file under Node, and Bun fails torequireit in a-escript.cd apps/webapp NODE_ENV=production node -e "console.log(JSON.stringify(require('./next.config.js').typescript))" 2>/dev/null | tail -1 NODE_ENV=production NEXT_SKIP_TYPECHECK=1 node -e "console.log(JSON.stringify(require('./next.config.js').typescript))" 2>/dev/null | tail -1 NODE_ENV=production NEXT_SKIP_TYPECHECK=0 node -e "console.log(JSON.stringify(require('./next.config.js').typescript))" 2>/dev/null | tail -1
Expect
{"ignoreBuildErrors":false}, then{"ignoreBuildErrors":true}, then{"ignoreBuildErrors":false}.
Step 2. apps/webapp/docker/Dockerfile.bun
-
Add this block after line 210, the end of the
GIT_HASHENV. It must sit below line 198, so the line 191 install keeps its cache key.# Below the install for the same cache reason as GIT_HASH. Only the prod deploy # sets 1; empty (stage, Makefile, dev, self-hosters) keeps Next's type check. ARG NEXT_SKIP_TYPECHECK ENV NEXT_SKIP_TYPECHECK=${NEXT_SKIP_TYPECHECK}
-
Do not move or edit any other line. Do not add the argument to the
deps,build-extensionsorrunnerstages. -
Check placement:
grep -n 'RUN bun install --frozen-lockfile\|^COPY apps/webapp\|NEXT_SKIP_TYPECHECK\|bunx next build' apps/webapp/docker/Dockerfile.bunExpect lines in this order:
COPY apps/webapp/package.json ./apps/webapp/indeps(59 today);- the
build-extensionsinstall (107 today); - the
builderinstall (191 today); COPY apps/webapp ./apps/webapp(198 today);- the
ARG NEXT_SKIP_TYPECHECKandENV NEXT_SKIP_TYPECHECKlines; bunx next build(219 before the change).
Both
NEXT_SKIP_TYPECHECKlines must sit betweenCOPY apps/webapp ./apps/webappandbunx next build.
Step 3. .github/workflows/prod.docs.plus.yml, step 🏗️ Build Docker Images
-
Add one
enventry to the step'senv:map. Find it by the step name; it was lines 613–615 at the pin. Onpushit isfalse. On a dispatch it is the boolean input.env: DOCKER_BUILDKIT: '1' COMPOSE_DOCKER_CLI_BUILD: '1' SKIP_QUALITY_GATES: ${{ github.event_name == 'workflow_dispatch' && inputs.skip_quality_gates }}
-
Replace the webapp call, the
docker compose … build webapp admin-dashboardlines and the 3-line comment above them (636–640 at the pin), with:# No --parallel: it is not a `docker compose build` flag in Compose v2 # (absent from `docker compose build --help`). Named services already # build concurrently. # Typecheck and Build Verification already ran tsc on this commit. An # emergency dispatch (skip_quality_gates) keeps the check in the image. NEXT_SKIP_TYPECHECK=1 if [ "${SKIP_QUALITY_GATES}" = "true" ]; then NEXT_SKIP_TYPECHECK=0; fi docker compose -f "${COMPOSE_FILE}" --env-file "${ENV_FILE}" \ build --build-arg "NEXT_SKIP_TYPECHECK=${NEXT_SKIP_TYPECHECK}" webapp admin-dashboard
--build-argapplies to both services; the admin build ignores it. Do not split the call into two. Do not touch the backend--no-cachecall (633–634 at the pin). -
Check the branch logic with no runner:
for v in true false ''; do SKIP_QUALITY_GATES="$v" bash -c 'NEXT_SKIP_TYPECHECK=1; if [ "${SKIP_QUALITY_GATES}" = "true" ]; then NEXT_SKIP_TYPECHECK=0; fi; echo "[$SKIP_QUALITY_GATES] -> $NEXT_SKIP_TYPECHECK"'; done
Expect
[true] -> 0,[false] -> 1and[] -> 1. -
Run
actionlint(see Verification). Expect no new finding.
Step 4. Binary cache-hit check
Run this on a dev machine with Docker, never on the prod host. It checks cache hits and log lines only, so the architecture does not matter.
-
Stop any running
next devforapps/webappfirst. -
From the repo root, build the
builderstage twice with the cache on. Change onlyNEXT_SKIP_TYPECHECK:ARGS="--build-arg NEXT_PUBLIC_RESTAPI_URL=http://localhost:4000/api \ --build-arg NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321 \ --build-arg NEXT_PUBLIC_SUPABASE_ANON_KEY=dummy-key" docker build -f apps/webapp/docker/Dockerfile.bun --target builder --progress=plain \ $ARGS -t docsplus-webapp-tc:unset . 2>&1 | tee /tmp/tc-unset.log docker build -f apps/webapp/docker/Dockerfile.bun --target builder --progress=plain \ $ARGS --build-arg NEXT_SKIP_TYPECHECK=1 -t docsplus-webapp-tc:skip . 2>&1 | tee /tmp/tc-skip.log
-
Check the results:
grep -c 'Checking validity of types' /tmp/tc-unset.log # expect 1 grep -c 'Skipping validation of types' /tmp/tc-skip.log # expect 1 grep -c 'Checking validity of types' /tmp/tc-skip.log # expect 0 grep -A1 '\[builder .*RUN bun install --frozen-lockfile' /tmp/tc-skip.log | grep -c CACHED # expect 1
-
If the last command prints 0, the argument moved the install cache key. Stop and fix the placement in Step 2.
-
Remove the two local images:
docker rmi docsplus-webapp-tc:unset docsplus-webapp-tc:skip. -
Post the four
grepresults as a comment here.
Review checkpoint
-
Show the change set:
git status --short git diff -- apps/webapp/next.config.js apps/webapp/docker/Dockerfile.bun .github/workflows/prod.docs.plus.yml
-
Expect changes in those three files only.
-
Do not commit inside these steps. After the maintainer reviews the diff, commit and push per SP2 ([Tracking] Faster, change-aware CI/CD pipeline #554). Land after Roll back only after the deploy has started rolling services #555.
Acceptance criteria
-
next.config.jshas one top-leveltypescriptkey,ignoreBuildErrors: process.env.NEXT_SKIP_TYPECHECK === '1'. The dev-onlytypescriptblock is gone, and the other dev-only keys remain. - The Step 1
nodechecks printfalse,trueandfalse. -
Dockerfile.bundeclaresARG NEXT_SKIP_TYPECHECKand itsENVin thebuilderstage, belowCOPY apps/webapp ./apps/webappand abovebunx next build. - The Step 4 cache-hit check prints
1,1,0and1, posted as a comment here. - The webapp compose call passes
--build-arg "NEXT_SKIP_TYPECHECK=${NEXT_SKIP_TYPECHECK}", which is1unlessskip_quality_gatesis true.docker-compose.prod.ymlis unchanged. -
actionlintreports no new finding on.github/workflows/prod.docs.plus.yml. - The
🏗️ Build Verificationlog of the first CI run that carries this change still printsChecking validity of types. That run is the PR run if a PR exists, otherwise the first push run onmain. - On the first
(build):deploy with this change, the webappnext buildprintsSkipping validation of types, notChecking validity of types. - On that deploy,
Creating an optimized production buildprints at an offset of 6 s or less. The baseline median is 34.7 s. - On that deploy, the admin build still prints
Finished TypeScript. - On that deploy,
🩺 Verify Deploymentpasses and the webapp containers are healthy. - A "Measured, " comment is posted here (see Accountability).
Verification
Before the change reaches main:
actionlint -config-file .github/actionlint.yaml .github/workflows/prod.docs.plus.yml- No
parse-build-trigger.test.shrun and nodry_run_subjectdispatch: triage and jobifs do not change. - Do not run a real
skip_quality_gatesorforce_deploydispatch. That deploys production. Step 3.3 checks the branch logic.
After the change reaches main, on the first (build): push deploy that carries it:
-
Find the job that holds
🏗️ Build Docker Images:🚀 Deploy Productiontoday, theimagesjob after Build the deploy images while the quality gates run #565.gh run view <run_id> --repo docs-plus/docs.plus --json createdAt,jobs \ -q '.jobs[] | select(.steps[]?.name | test("Build Docker Images")) | .databaseId'
-
Read the webapp type-check lines from that job:
gh run view --job <job_id> --repo docs-plus/docs.plus --log \ | grep -E 'webapp builder .*bunx next build|validity of types|Skipping validation of types|Creating an optimized production build|Finished TypeScript'
The webapp
next buildlines share one BuildKit step number, for example#109. Read the offsets after that number. -
Record per SP3 ([Tracking] Faster, change-aware CI/CD pipeline #554). Metrics are defined in Measure CI/CD time to live after the v2.3 work: 1090 s median before #569. This issue's rows:
| Metric | Run to read | Baseline | Expected |
|---|---|---|---|
Type-check phase (Creating an optimized production build offset) |
the job from item 1 | median 34.7 s (range 28.34–51.32 s, six jobs above) | 6 s or less |
| M3 | same run | median 546 s, range 316–866 s (14 deploys, 2026-09-22 to 2026-10-20) | about 31 s lower than a deploy of the same cache class; not judged from one deploy |
| M1 | same run | median 1090 s, p90 1386 s | about 31 s lower, inside normal noise; final result in #569 |
| M2g, M2i, M4, M5, W, M6 | same run | as in #569 | no change from this issue |
#559 and other set B items also change M3 and M1. This issue owns only the type-check phase.
Accountability
- Who checks. The builder, or the maintainer if the builder cannot.
- What. Verification items 1–3 and the last four acceptance criteria, on the first
(build):deploy with this change. - Where. The SP3 comment here, plus the job id, the quoted
Skipping validation of typesline, theCreating an optimized production buildoffset, the adminFinished TypeScriptline and the🩺 Verify Deploymentresult.
Rollback
Revert per SP4 (#554). The revert touches only apps/webapp/next.config.js, apps/webapp/docker/Dockerfile.bun and .github/workflows/prod.docs.plus.yml.
Stop condition: revert when any of these holds:
- the first deploy with this change fails in
🏗️ Build Docker Images, and the error comes from the build argument ornext.config.js; - the webapp containers fail their health check, or
🩺 Verify Deploymentfails, after this change; - Build Verification stops printing
Checking validity of types; - the Step 4 check shows the
builderinstall no longerCACHEDwhen onlyNEXT_SKIP_TYPECHECKchanges.
Fix forward, do not revert, when the deploy is green but still prints Checking validity of types. The change is then a no-op. Find why the argument did not reach next build, and comment here.
No host step or setting change: nothing on the prod host stores NEXT_SKIP_TYPECHECK.
Docs to update
None. No doc says that the Docker build type-checks. No CHANGELOG entry: self-hosters see no change. The code comments in Steps 1–3 carry the reason.
Out of scope
- Skipping the type check anywhere else, editing
docker-compose.prod.yml, or changing the admin-dashboard build. - The other dev-only keys, and lint inside
next build(already skipped). - The backend
build --no-cachecall (Measure whether the backend image build still needs --no-cache #566), concurrent compose calls or--parallel(Run the backend and webapp image builds at the same time, to cut the image build step #567), a new build job (Build the deploy images while the quality gates run #565),--ignore-scriptsor extension copy order (Cut the webapp image installs from 158 s to about 25 s per deploy #559), "Collecting build traces" oroutputFileTracingExcludes(Measure and trim the Next.js build-trace step in the webapp build #568). - Turbopack:
next-pwa, thechunkGraphexclude and the Sentry plugin need webpack. - A test: the acceptance criteria check the log line.
- The Bun version, the
oven/bun:1-slimbase (Keep the Actions cache under its limit and pin Bun in CI #561 owns the CI Bun pin), the metascraper pin or any dependency.
Read first
AGENTS.md§Docker, and §Git And Commits.apps/webapp/next.config.js, lines 70–209.apps/webapp/docker/Dockerfile.bun, thebuilderstage..github/workflows/prod.docs.plus.yml: Build Verification, the deployif, and🏗️ Build Docker Images.docker-compose.prod.yml, thewebappbuild section.apps/webapp/node_modules/next/dist/build/type-check.js, functionstartTypeChecking(installed Next 15.5.27).- Measure CI/CD time to live after the v2.3 work: 1090 s median before #569 for the metric definitions; [Tracking] Faster, change-aware CI/CD pipeline #554 for the change sets and SP1–SP4.
Activity
HMarzban commentedon Oct 26, 2026
Built and committed on local main. Awaits the maintainer's final push.
Remaining gate: the push and the first
(build):deploy. That run must show the type-check skip line, Build Verification, the admin type check and Verify Deployment. Then the Measured comment.perf(ci): skip the duplicate webapp type check in the prod Docker build
HMarzban commentedon Nov 3, 2026
Status, 2026-11-03.
975b9cacais pushed and deployed on 2026-11-03. Run 41608014517 behaved as planned:Skipping validation of types.Creating an optimized production buildappears at 4.7 s.Checking validity of types.Finished TypeScript.Left:
Measuredcomment.1, 1, 0, 1), which is only in the commit body.HMarzban commentedon Nov 3, 2026
Measured, 2026-11-03.
Sources: Run Report job 125827136949. Build lines from Build Images job 125822892492. Health from Deploy Production job 125826444636.
next build(BuildKit step#105, job 125822892492):#105 4.115 Skipping validation of types#105 4.698 Creating an optimized production build ...#90, same job):#90 16.71 Finished TypeScript in 14.0s .... Pass.--build-arg "NEXT_SKIP_TYPECHECK=${NEXT_SKIP_TYPECHECK}"withNEXT_SKIP_TYPECHECK=1.@docs.plus/webapp build:ci: Checking validity of types .... Pass. No PR carried this change, so this is the first push run onmain.🩺 Verify Deployment:success. Its log prints✅ webapp: 2 running, 2 healthy.Skipping validation of types, optimized build at 5.162 s, adminFinished TypeScript in 13.0s. BV job 125886115400 printsChecking validity of types.Skipping validation of types, optimized build at 3.798 s, adminFinished TypeScript in 11.5s. BV job 125921466487 printsChecking validity of types.975b9cacacommit body: "Local Docker check (Step 4): 1, 1, 0, 1. The builder install stayed CACHED." Expected1,1,0,1. Pass.next.config.jshas one top-leveltypescriptkey withignoreBuildErrors: process.env.NEXT_SKIP_TYPECHECK === '1'.nodechecks printfalse,trueandfalse.Dockerfile.bundeclaresARG NEXT_SKIP_TYPECHECKand itsENVat lines 219–220. That is belowCOPY apps/webapp ./apps/webapp(line 202) and abovebunx next build(line 231).actionlintreports no finding.975b9cacachanges only three files.docker-compose.prod.ymlis not one of them.Can close now: yes