Skip to content

perf(builder): optimize build pipeline and gate types in CI - #945

Merged
realcodesiman merged 5 commits into
mainfrom
perf/builder-build-optimization
Aug 13, 2026
Merged

perf(builder): optimize build pipeline and gate types in CI#945
realcodesiman merged 5 commits into
mainfrom
perf/builder-build-optimization

Conversation

@realcodesiman

@realcodesiman realcodesiman commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace parallel routes (@channel/@integration slots) with dynamic segments + a shared RouteAccordionShell, cutting the route permutations Next.js has to compile for settings/channels and settings/integrations
  • Disable in-build type-checking (typescript.ignoreBuildErrors) since the duplicated tsc pass OOMs a default 4GB heap; add .github/workflows/ci.yml and a check gate in release.yml so turbo run check-types lint test is the one source of truth for types
  • Add BuildKit cache mounts (pnpm store, .next/cache) and optional Turbo remote-cache secrets to the Docker build, restored via buildkit-cache-dance in release.yml
  • Guard module-scope Redis/Postgres/auth initialization during next build's page-data collection phase (no services reachable then): lazyConnect on the worker-config Redis client, static trustedOrigins, parseEnvBool for logger flags that skip zod coercion under SKIP_ENV_CHECK=true
  • Bump next 16.3.0-canary.8116.3.0 (stable) and related lockfile updates
  • Fix CI timeouts caused by turbo's default 10-way task concurrency plus one vitest worker per CPU fighting for the runner's 4 vCPUs: cap turbo run check-types lint test at --concurrency=4, pin vitest maxWorkers=1 on CI, and raise testTimeout/hookTimeout to 30s
  • Backfill missing translation keys (added by earlier ads/permissions features) across all non-English locales so the i18n key-parity check passes

Changes

  • Routing refactor: apps/builder/src/app/space/[workspaceId]/(settings)/settings/{channels,integrations}/ — parallel-route slots converted to <channel>/page.tsx dynamic routes; new channels-accordion-shell.tsx, integrations-accordion-shell.tsx, shared src/components/route-accordion-shell.tsx, src/lib/workspace/resolve-visible-channels.ts, src/lib/workspace/require-visible-channel.ts, src/features/integrations/settings-registry.ts
  • Build/CI: new .github/workflows/ci.yml (now with --concurrency=4); release.yml type-check gate + BuildKit cache-mount restore/inject; apps/builder/docker/Dockerfile cache mounts; apps/builder/next.config.ts (ignoreBuildErrors, optimizePackageImports); turbo.json passThroughEnv; .dockerignore broadened .next/.turbo ignores; packages/vitest-config/src/node.ts (maxWorkers=1 on CI, 30s test/hook timeouts)
  • Build-phase safety: packages/auth/src/server.ts (static trustedOrigins during build), packages/database/src/client.ts + packages/utils/src/env.ts (parseEnvBool), packages/worker-config/src/lib/connection.ts + packages/redis/src/index.ts (lazyConnect/createRedisConnection)
  • Test stabilization: hoisted a heavy dynamic import out of a per-test timeout window (account-rail.test.tsx), added a missing createRedisConnection mock (ads-conversion-rule.service.test.ts), dropped now-redundant per-test 15s timeouts in analytics tests
  • i18n: all 17 non-English locale files backfilled with keys already present in en.json (errors.superAdminRequired, ctwa*, etc.)
  • Docs/skills: AGENTS.md, CLAUDE.md, docs/tenancy.md, .agents/skills/*, .devin/rules/chatbotx.md, .github/copilot-instructions.md synced to reflect the above
  • New tests: settings-tab-active-state.test.ts, trusted-origins-build-phase.test.ts, connection-build-phase.test.ts, env.test.ts; updated channel-route-guard/visibility tests for the dynamic-route shape

Test plan

  • pnpm lint
  • pre-commit hooks (ultracite fix, typecheck) passed
  • pnpm --filter builder check-types
  • CI workflow (ci.yml) green on this PR, no timeouts
  • Manual verification: settings/channels and settings/integrations pages render and navigate correctly per channel/integration
  • Docker build completes with BuildKit cache mounts locally or in CI

realcodesiman and others added 3 commits August 13, 2026 17:17
- Replace parallel routes (@channel/@integration slots) with dynamic
  segments + a shared RouteAccordionShell, cutting route permutations
  next.js has to compile for settings/channels and settings/integrations
- Disable in-build type-checking (typescript.ignoreBuildErrors) since the
  duplicated tsc pass OOMs a default 4GB heap; add ci.yml and a release.yml
  gate so `turbo run check-types lint test` stays the one source of truth
- Add BuildKit cache mounts (pnpm store, .next/cache) and optional Turbo
  remote cache secrets to the Docker build, restored via
  buildkit-cache-dance in release.yml
- Guard module-scope Redis/Postgres/auth initialization during
  `next build`'s page-data collection phase (no services reachable then):
  lazyConnect on the worker-config Redis client, static trustedOrigins,
  parseEnvBool for logger flags that skip zod coercion under
  SKIP_ENV_CHECK=true
- Bump next 16.3.0-canary.81 -> 16.3.0 (stable) and related lockfile updates
Floating v2 tag can move to a breaking release without warning;
pin the exact version used in ci.yml and release.yml.
…timizing builds

Broadens db-client mocks across builder/worker tests to include columns
read eagerly at module scope by the contact-filter/variables import
chain, so tests don't depend on unmocked initializers. Also fixes an
encryption AAD precedence bug, an Instagram private-reply endpoint that
addressed the Page node instead of the IG business account, and adds a
Popover `portal` opt-out used by ComboboxField's allowClear support.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… timeouts

Turbo's default of 10 concurrent tasks combined with one vitest worker
per CPU multiplied into dozens of node processes fighting for the
runner's 4 vCPUs, pushing cold module-graph imports past the 5s test
timeout. Caps turbo at --concurrency=4, pins vitest to maxWorkers=1 on
CI, and raises testTimeout/hookTimeout to 30s so a slow import doesn't
poison the next test in the same file. Also fixes cross-cutting bugs
surfaced while chasing the flakiness: a missing createRedisConnection
mock, hoisting a heavy dynamic import out of a per-test timeout budget,
and dropping now-redundant per-test 15s timeouts.
CI's i18n key-parity check requires every locale to carry the same key
set as en.json. Keys added by earlier ads/permissions features
(ctwa*, errors.superAdminRequired, etc.) were never backfilled into
non-English locales, so this fills the gap.
@realcodesiman
realcodesiman merged commit 8b6a0c5 into main Aug 13, 2026
15 checks passed
@realcodesiman
realcodesiman deleted the perf/builder-build-optimization branch August 13, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Refactor or performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant