Repository navigation
fix(next-plugin): fail a build whose coordinator CSS is incomplete - #938
Merged
Merged
Conversation
The coordinator's /css wait used to give up after a quiet window or its hard timeout and still answer 200 with whatever the sheet held. A build bundles that first answer as its stylesheet, so a missing file shipped class names without their rules and the build reported success. The base and bucket waits now resolve with a reason when they give up, and /css answers 500 with a message naming the files that never extracted. The CSS loader passes the coordinator's reason into the loader error, so Turbopack fails the build with it. Only builds wait; next dev never asks to, so development behaviour is unchanged. The idle heuristic used when no expected file set exists still answers 200. Refs #686 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This was referenced Nov 15, 2026
css-loader.ts now reaches the coordinator through callCoordinator (#917); keep this branch's status-plus-reason error message on top of reply.body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owjs3901
added a commit
that referenced
this pull request
Nov 17, 2026
Resolve the conflict with #938 in packages/next-plugin/src/coordinator.ts. #938 adds no new module state: its error-returning waitForBase and waitForBucket, missingFiles and incompleteCssError now read the app's own CoordinatorState, so one app's extractions never complete another app's CSS. A test covers two apps expecting the same base files. #939's shared-slot reservation runs on the app's own engine session; its test now expects that session instead of the shared engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes audit item NXT-15 (P1, WRONG). When the coordinator's
/css?waitForIdle=truewait ended on the quiet window (quietMs) or the hard timeout (maxWaitMs), it served the incomplete bucket/base sheet as is with HTTP 200. Production Turbopack builds bundle this first response as the stylesheet, so if some files had not been extracted, CSS with class names but no rules could ship as a successful build.waitForBase/waitForBucketnow also return the reason when they give up./cssresponds with 500 and a message listing the files that were not extracted. ([devup-ui] coordinator: bucket "src/bucket.tsx" is incomplete (no extraction for 10000ms); refusing to serve partial CSS. Files not extracted: src/m1.tsx.)next devdoes not sendwaitForIdle). So dev mode behavior does not change and no separate dev-only fallback is needed.maxWaitMsin that state, it is now an error.Overlap with other PRs
fix/next-coordinator-client) modifies the port cache / request path ofcss-loader.ts. This PR only changes the non-200 handling infetchCssFromCoordinator, so a small conflict may arise depending on which merges first.fix/next-coordinator-exit-writes) modifies the close / write path ofcoordinator.tsand does not overlap with the wait functions this PR changed.Test plan
bun test --coverage(next-plugin: coordinator, css-loader, loader, plugin, coordinator-port, prewarm):coordinator.ts,css-loader.tsat 100% lines / functionsmaxWaitMs(getCssnot called)bunx tsc --noEmit -p packages/next-pluginbunx prettier --single-quote --no-semi --check(changed files)plugin.test.ts(native engine /seedFileMap) fail the same way on main too, because of stale WASM / native builds.요약
감사 항목 NXT-15 (P1, WRONG) 수정입니다. 코디네이터의
/css?waitForIdle=true대기가 quiet window(quietMs)나 hard timeout(maxWaitMs)으로 끝나면, 완료되지 않은 버킷/베이스 시트를 그대로 HTTP 200으로 응답했습니다. 프로덕션 Turbopack 빌드는 이 첫 응답을 스타일시트로 번들링하므로, 추출되지 않은 파일이 있으면 클래스 이름만 있고 규칙이 없는 CSS가 성공한 빌드로 배포될 수 있었습니다.waitForBase/waitForBucket이 포기할 때 이유를 함께 반환하도록 바꿨습니다./css는 500과 함께 추출되지 않은 파일 목록을 담은 메시지를 응답합니다. ([devup-ui] coordinator: bucket "src/bucket.tsx" is incomplete (no extraction for 10000ms); refusing to serve partial CSS. Files not extracted: src/m1.tsx.)next dev의 CSS 로더는waitForIdle을 보내지 않음). 따라서 개발 모드 동작은 바뀌지 않으며 별도의 dev 전용 fallback은 필요하지 않습니다.maxWaitMs까지 idle이 되지 않으면 이제 에러입니다.다른 PR과의 겹침
fix/next-coordinator-client)이css-loader.ts의 포트 캐시 / 요청 경로를 수정합니다. 이 PR은fetchCssFromCoordinator의 비-200 처리 부분만 바꾸므로, 둘 중 먼저 머지되는 쪽에 따라 작은 충돌이 날 수 있습니다.fix/next-coordinator-exit-writes)는coordinator.ts의 close / 쓰기 경로를 수정하며, 이 PR이 바꾼 대기 함수와는 겹치지 않습니다.테스트 계획
bun test --coverage(next-plugin: coordinator, css-loader, loader, plugin, coordinator-port, prewarm):coordinator.ts,css-loader.ts100% lines / functionsmaxWaitMs후 500 + 누락 파일 목록 (getCss미호출)bunx tsc --noEmit -p packages/next-pluginbunx prettier --single-quote --no-semi --check(변경 파일)plugin.test.ts의 3개 테스트(native 엔진 /seedFileMap)는 오래된 WASM / native 빌드 때문에 main에서도 동일하게 실패합니다.Refs #686
🤖 Generated with Claude Code