Skip to content

fix(docker): copy css.d.ts into app build stage to fix nightly build - #2632

Merged
kodiakhq[bot] merged 7 commits into
mainfrom
jordansimonovski/fix-nightly-css-dts-docker
Jul 13, 2026
Merged

fix(docker): copy css.d.ts into app build stage to fix nightly build#2632
kodiakhq[bot] merged 7 commits into
mainfrom
jordansimonovski/fix-nightly-css-dts-docker

Conversation

@jordan-simonovski

@jordan-simonovski jordan-simonovski commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Why

The nightly release (run 29215841780) has been failing across the App, All-in-One, and Local image builds with:

Type error: Cannot find module or type declarations for side-effect import of '@mantine/core/styles.css'.

The TypeScript 6 upgrade (#2617) introduced the stricter TS2882 check for side-effect imports of otherwise-untyped modules. To satisfy it, that PR added packages/app/css.d.ts with ambient declare module '*.css' (and .scss/.sass) declarations, which cover the stylesheet imports in pages/_app.tsx.

This works locally, but both Dockerfiles only copy mdx.d.ts into the build stage, not css.d.ts. Inside the container the ambient declaration is missing, so next build fails type-checking. Local tsc/CI passed because css.d.ts is present on disk there — a source-level type check fundamentally cannot catch a file that exists in the repo but was never COPYed into the image.

What

The fix

  • Add css.d.ts to the COPY line in docker/hyperdx/Dockerfile (App / All-in-One / Local nightly + release images) and packages/app/Dockerfile (standalone app image), right alongside the existing mdx.d.ts.
  • Drop a stray export on getAlertWindowStart (packages/api/src/tasks/checkAlerts/index.ts) — only used within its own file. Pre-existing dead export flagged by the pre-commit knip check, which was blocking commits through the hook.
  • Patch changeset for @hyperdx/app.

Prevention — new Docker Build workflow (.github/workflows/docker-build.yml)

  • Builds each released image on PRs with push: false, so image-only build failures are caught in review instead of the nightly.
  • Conditional on changed paths (via tj-actions/changed-files, matching the existing otel-collector gating in main.yml) so unrelated PRs skip the builds:
    • OTel Collector image → docker/otel-collector/**, packages/otel-collector/**
    • App/prod image → packages/{api,app,common-utils}/**, docker/hyperdx/**, root deps
    • All-in-one image → the above plus docker/clickhouse/**, docker/otel-collector/**
  • Single-arch (amd64), warmed from the nightly gha cache scopes, to keep PR runtimes low. Build errors here are arch-independent.

Verification

Ran the docker/hyperdx builder target locally (the stage that runs next build) with the fix:

#34 [builder 10/11] RUN yarn workspace @hyperdx/api run build && yarn workspace @hyperdx/app run build
#34   Running TypeScript ...
#34 ✓ Compiled successfully in 25.7s
...
#36 DONE   (exit 0)

The TS2882 error is gone and the image builds cleanly.

The TypeScript 6 upgrade (#2617) added ambient 'declare module *.css'
declarations in packages/app/css.d.ts to satisfy TS2882 for side-effect
stylesheet imports in pages/_app.tsx. Both Dockerfiles copied mdx.d.ts but
not css.d.ts, so next build failed type-checking inside the container,
breaking the App, All-in-One, and Local nightly image builds.

Also drops a stray 'export' on getAlertWindowStart (only used in-file) so
the pre-commit knip check passes.
A source-level type check can't catch failures that only surface inside the
Docker image — like the css.d.ts declaration file that existed in the repo
but was never COPYed into the build stage, which broke every nightly image
build. Add a Docker Build workflow that builds each released image with
push:false so these are caught in PR review.

Builds are conditional on changed paths (via tj-actions/changed-files, matching
the existing otel-collector jobs in main.yml) so unrelated PRs skip them:
- OTel Collector image: docker/otel-collector or packages/otel-collector
- App/prod image: api/app/common-utils/docker-hyperdx or root deps
- All-in-one image: the above plus clickhouse/otel bundled-service inputs

Single-arch (amd64) and warmed from the nightly gha cache scopes to keep
runtimes low; build errors are arch-independent.
The all-in-one target does COPY --from=prod /app /app, so it already builds
the full App/prod image. With the app paths in both filters, every app change
ran both jobs and built the Node app twice (~8 wasted minutes). Gate the
all-in-one job only on the incremental bundling inputs (ClickHouse / OTel /
the shared Dockerfile); api/app/common-utils/deps are covered by the App
Image job and can't affect the bundling layers.
Add .yarnrc.yml, .prettierrc, .prettierignore to the app-image
changed-files gate and .vex/** to the all-in-one gate, so a PR touching
only those Dockerfile inputs still runs the build check.

Make workflow_dispatch force-build all three jobs (changed-files finds
nothing without a PR payload) and fall back to github.run_id for
CODE_VERSION so it is never a bare 'pr-'.
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e0c5eed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Jul 13, 2026 2:22pm
hyperdx-storybook Ready Ready Preview, Comment Jul 13, 2026 2:22pm

Request Review

@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches auth, data models, config, tasks, OTel pipeline, ClickHouse, or CI/CD.

Why this tier:

  • Critical-path files (2):
    • docker/hyperdx/Dockerfile
    • packages/api/src/tasks/checkAlerts/index.ts
  • Cross-layer change: touches frontend (packages/app) + backend (packages/api)

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 3
  • Production lines changed: 6
  • Branch: jordansimonovski/fix-nightly-css-dts-docker
  • Author: jordan-simonovski

To override this classification, remove the review/tier-4 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Docker image builds and adds PR checks for released images. The main changes are:

  • Copies css.d.ts into both app Docker build stages.
  • Builds the app, collector, authenticated all-in-one, and no-auth Local targets on relevant pull requests.
  • Removes an unused API export.
  • Adds a patch changeset for @hyperdx/app.

Confidence Score: 5/5

This looks safe to merge.

  • The no-auth Local target is now built explicitly.
  • The new build uses the same inputs as its authenticated sibling while exercising its distinct final layer.
  • No blocking issues remain in the updated code.

Important Files Changed

Filename Overview
.github/workflows/docker-build.yml Adds path-gated Docker builds and explicitly validates both authenticated and no-auth all-in-one targets.
docker/hyperdx/Dockerfile Copies the CSS declaration file into the shared app build stage.
packages/app/Dockerfile Copies the CSS declaration file into the standalone app build stage.
packages/api/src/tasks/checkAlerts/index.ts Makes getAlertWindowStart file-local without changing its behavior.
.changeset/fix-nightly-css-dts-docker.md Adds a patch changeset for the app Docker build fix.

Reviews (4): Last reviewed commit: "Merge branch 'main' into jordansimonovsk..." | Re-trigger Greptile

Comment thread .github/workflows/docker-build.yml
The all-in-one job only built the auth target, but noauth is a sibling off
all-in-one-base with its own entry-script COPY layer. A break there (gated
under docker/hyperdx/**, so the job runs) would pass the PR check and fail
the nightly Local build. Build both siblings; the base is reused from
buildx's local cache so noauth only adds its one COPY layer.
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 236 passed • 3 skipped • 1565s

Status Count
✅ Passed 236
❌ Failed 0
⚠️ Flaky 2
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found.

This is a low-risk build/CI fix. The css.d.ts COPY addition is correctly placed: the builder stage is FROM node_base and copies only src/pages/public/styles/types from the app context, so the root-level ambient declaration must come from node_base — where the fix lands. Both root *.d.ts files (css.d.ts, mdx.d.ts) are now copied in both Dockerfiles. Dropping export from getAlertWindowStart is safe — the symbol is referenced only within its own module (call at index.ts:1525).

🔵 P3 nitpicks (1)
  • docker/hyperdx/Dockerfile:55 — The app-config COPY line is byte-identical to packages/app/Dockerfile and enumerates each *.d.ts by hand, which is precisely the drift that dropped css.d.ts and broke the nightly.
    • Fix: Copy the declaration files via a glob (e.g. COPY ./packages/app/*.d.ts ./packages/app/) so a newly added *.d.ts is picked up automatically in both Dockerfiles.

Reviewers (5): correctness, reliability, maintainability, project-standards, kieran-typescript.

Testing gaps:

  • The docker-build.yml path-gating lists enumerate root inputs (.prettierrc, tsconfig.base.json, nx.json, etc.) that mirror the Dockerfile COPY at docker/hyperdx/Dockerfile:50; a future root file added to the Dockerfile but not to the changed-files gate would silently skip the build check for PRs touching it — the same failure class this workflow exists to catch.
  • No assertion verifies that a build actually ran, so a tj-actions/changed-files false-negative (shallow-clone or API edge case) would report the job green without validating the image.

@kodiakhq
kodiakhq Bot merged commit 0dd23e8 into main Jul 13, 2026
23 checks passed
@kodiakhq
kodiakhq Bot deleted the jordansimonovski/fix-nightly-css-dts-docker branch July 13, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-4 Critical — deep review + domain expert sign-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants