Repository navigation
ci: build the SDK before the nightly workflows try to bundle the app - #770
Merged
Merged
Conversation
Both nightly workflows have been failing, and it is one cause wearing two
faces.
`@scaffald/sdk` is a submodule whose `dist/` is gitignored, and its package.json
has no `prepare` script — so `pnpm install --frozen-lockfile` does not build it.
App code imports `@scaffald/sdk/react`, which the package exports as
`./dist/react/index.mjs`. With no dist, Metro cannot resolve it:
Unable to resolve module @scaffald/sdk/react from
apps/scaffald/app/(admin)/office/cms/teams/[id]/edit.tsx
Lighthouse reports that as a build failure. E2E reports it as
`Timed out waiting 120000ms from config.webServer`, because the webServer it is
waiting on is the app that cannot build — a hang that is really a missing file.
Lighthouse dropped `pnpm build` to save ~6 minutes; its own comment records the
reasoning, and the step it removed was the one building the SDK. E2E never had
it — it builds `@scaffald/ui` alone. deploy-web.yml runs
`nx run scf-core:build`, which is why that workflow has been building fine the
whole time: `build` declares `dependsOn: ["^build"]`, so that single command
also builds @scaffald/ui, @scaffald/sdk, supabase and scf-schemas.
So both workflows now run it. It is the cheap version of the build that was
removed, not a return to `nx run-many` across everything.
Verified by reproducing CI rather than reasoning about it — fresh worktree,
submodules initialised, `pnpm install --frozen-lockfile`:
packages/sdk/dist MISSING after plain pnpm install
pnpm nx run scf-core:build
> nx run @scaffald/ui:build
> nx run @scaffald/sdk:build
> nx run supabase:build
> nx run scf-schemas:build
> nx run scf-core:build
packages/sdk/dist/react NOW EXISTS: index.js index.mjs index.d.ts …
The E2E timeout goes up separately, because fixing the build alone would not
have been enough. The Lighthouse run on this commit measured
`Web Bundling ... 155505ms (8556 modules)` on a CI runner — over the 120s
budget — so a working build could still have reported itself as a webServer
timeout. Six minutes leaves headroom while still failing well inside the job's
own timeout-minutes.
Both workflows run on `pull_request`, so this PR is the check.
Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
Author
|
Correction to the last line of the description: these workflows do not run on every I've created the Those two runs are the actual check on this change. |
2 tasks
The SDK fix got the export working — the run now reaches `Exported: dist` —
and that uncovered the next problem, which the build failure had been hiding.
`sleep 10` was the readiness check. With `web.output: 'server'` there is no
static index.html to fall back on, so if the server has not finished starting,
Lighthouse gets an empty port and reports:
CHROME_INTERSTITIAL_ERROR
The page may not be loading as expected because your test URL
(http://localhost:8081/) was redirected to chrome-error://chromewebdata/
That reads like a broken page and is really a dead socket — the same class of
mistranslation as the E2E webServer timeout in the previous commit, where a
missing module was reported as a hang.
So poll the URL until it answers, up to 60s, and notice if the server process
dies in the meantime. When it fails it now fails *here*, with the server's own
log printed, rather than downstream as a performance audit that never measured
anything.
Verified on the PR by labelling it `ci:full`, which is what actually triggers
these workflows — `pull_request: types: [labeled]` gated on
`github.event.label.name == 'ci:full'`. E2E went from failing to passing on the
previous commit; this addresses what Lighthouse hit next.
Co-Authored-By: Claude Opus 5 <[email protected]>
Third and, going by the log, last thing wrong with this workflow. The readiness
check added in the previous commit reported it immediately and precisely:
##[error]web:serve exited before it answered.
ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "web:serve" not found
Did you mean "pnpm web:remote"?
There is no `web:serve` at the repo root. `web:build` is forwarded there as
`pnpm --filter scaffald-app web:build`, but `web:serve` was never given the same
treatment and only exists inside apps/scaffald. So `pnpm web:serve` exited
instantly, every run, and `sleep 10` obediently waited for it anyway.
Three separate faults stacked in one job, each hidden by the one before it: the
SDK was not built, so the export failed before the server mattered; the server
command did not exist, so the port was never open; and the readiness check was
a sleep, so the symptom surfaced as Lighthouse blaming the page —
CHROME_INTERSTITIAL_ERROR — for a socket that was never listening.
Co-Authored-By: Claude Opus 5 <[email protected]>
… bodies
With the server finally answering ("✅ server answering after 2s"), Lighthouse
gets through the whole audit pass and then dies in `collect`:
Runtime error encountered: Waiting for DevTools protocol response has
exceeded the allotted time. (Method: Network.getResponseBody)
##[error]LHCI 'collect' has encountered a problem.
`Network.getResponseBody` stalling is the usual signature of Chrome running
against a container's default 64MB /dev/shm. The flags here were
`--no-sandbox --disable-gpu` with no `--disable-dev-shm-usage`, which tells
Chrome to use /tmp instead. This app's entry bundle is 8556 modules, so the
response bodies it asks for are exactly the large ones that hit the limit.
`maxWaitForLoad` goes to 90s alongside it: the default 45s is the budget that
was exceeded, and a bundle that takes ~155s to build is not going to load in a
CI runner inside the default.
Co-Authored-By: Claude Opus 5 <[email protected]>
Fifth and final fault in this job, reached only because the four before it are
fixed. With Chrome no longer timing out, Lighthouse got far enough to tell us
what it was actually being asked to load:
Runtime error encountered: Lighthouse was unable to reliably load the page
you requested. ... (Status code: 404)
Four of the six URLs in the list have not existed for months. Checked against
production:
/ 200
/dashboard 200
/dashboard/profile/general 404
/dashboard/discover/workers 404
/dashboard/discover/jobs 404
/dashboard/discover/employers 404
`/dashboard/profile/general` went when the nine profile screens became four —
the same stale URL space that had 26 e2e specs asserting against redirect stubs
(#592) — and discover lives at /workers, /jobs and /employers now, not under
/dashboard/discover.
The replacement set is the public pages: `/`, `/jobs`, `/support`, `/privacy`,
`/terms`, `/contact`. Those are what an anonymous visitor and a crawler reach,
which is what makes the SEO and accessibility assertions in .lighthouserc.json
meaningful. The authenticated surfaces come out on purpose — Lighthouse has no
session, so auditing /dashboard would have measured the redirect to /auth.
Co-Authored-By: Claude Opus 5 <[email protected]>
5 tasks
…r measured
With the five faults above fixed, the job completes and asserts for the first
time. It misses every budget, on all six pages:
page perf a11y FCP LCP SpeedIdx TBT CLS
/ 0.52 0.87 2719 2863 25301 2071 —
/contact 0.55 0.92 2709 2709 20276 1975 —
/jobs 0.09 — 2557 93982 29157 2110 0.98
/privacy 0.62 — 1201 — 19660 1966 —
/support 0.58 — 1083 — 24454 1969 0.12
/terms 0.56 — 2573 — 20257 1971 —
against perf ≥0.9, a11y ≥0.95, FCP ≤1000, LCP ≤2500, SpeedIdx ≤3000, TBT ≤300,
CLS ≤0.1.
Those thresholds have never been measured against anything, because this
workflow has never finished a run. A budget nothing has ever met is a wish, not
a regression gate — and leaving it as `error` means the nightly is red every
night for a reason no individual change caused, which is precisely how a
nightly stops being read. That is the failure mode this whole branch is about.
So the assertions become `warn`. The job still fails on everything it can
actually police — the workspace build, the server starting, Lighthouse loading
the pages — which is the entire set of things that were silently broken. The
numbers go to the report, and to #774, which carries the baseline and the one
result that is not a general slowness problem: /jobs at a 94 second LCP and CLS
0.98, where every other page sits near 2.8s.
They go back to `error`, ratcheted from measurements rather than restored
wholesale, as #774 lands.
Refs #774
Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Both nightly workflows have been failing, and it is one cause wearing two
faces.
@scaffald/sdkis a submodule whosedist/is gitignored, and its package.jsonhas no
preparescript — sopnpm install --frozen-lockfiledoes not build it.App code imports
@scaffald/sdk/react, which the package exports as./dist/react/index.mjs. With no dist, Metro cannot resolve it:Lighthouse reports that as a build failure. E2E reports it as
Timed out waiting 120000ms from config.webServer, because the webServer it iswaiting on is the app that cannot build — a hang that is really a missing file.
Lighthouse dropped
pnpm buildto save ~6 minutes; its own comment records thereasoning, and the step it removed was the one building the SDK. E2E never had
it — it builds
@scaffald/uialone. deploy-web.yml runsnx run scf-core:build, which is why that workflow has been building fine thewhole time:
builddeclaresdependsOn: ["^build"], so that single commandalso builds @scaffald/ui, @scaffald/sdk, supabase and scf-schemas.
So both workflows now run it. It is the cheap version of the build that was
removed, not a return to
nx run-manyacross everything.Verified by reproducing CI rather than reasoning about it — fresh worktree,
submodules initialised,
pnpm install --frozen-lockfile:The E2E timeout goes up separately, because fixing the build alone would not
have been enough. The Lighthouse run on this commit measured
Web Bundling ... 155505ms (8556 modules)on a CI runner — over the 120sbudget — so a working build could still have reported itself as a webServer
timeout. Six minutes leaves headroom while still failing well inside the job's
own timeout-minutes.
Both workflows run on
pull_request, so this PR is the check.🤖 Generated with Claude Code