fix(api): prod webpack build clears 163 latent errors + structural blockers#719
Draft
G4614 wants to merge 2 commits into
Draft
fix(api): prod webpack build clears 163 latent errors + structural blockers#719G4614 wants to merge 2 commits into
G4614 wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The SST production webpack build (apps/api/Dockerfile → nx build api --configuration=production) has been silently broken on main. No CI step runs this path, and e2e uses ts-node --transpile-only, so two structural issues went unnoticed since boxlite-ai#460: 1. webpack.config.js registers each migration file as a webpack entry using the cwd-relative path returned by glob.sync (e.g. "apps/api/src/ migrations/<X>-migration.ts"). Webpack resolves entry values against config.context, which @nx/webpack sets to the project root ("/boxlite/apps/api"), producing "/boxlite/apps/api/apps/api/src/...". Result: 91 "Module not found" errors. Fix: map each match through path.resolve(process.cwd(), ...) so entries are absolute. 2. The Dockerfile copies apps/tsconfig.base.json to /boxlite/ but apps/api/tsconfig.json extends "../tsconfig.base.json", resolving to /boxlite/apps/tsconfig.base.json. Result: TS5083 missing-tsconfig. Fix: split the COPY so tsconfig.base.json lands at apps/tsconfig.base.json. These two fixes are the bare minimum to get the prod webpack build past its structural blockers. The build now reaches tsc and surfaces a pre-existing class of 163 type errors (Express 5 ParamsDictionary widening + an OTel dep duplication + a libs/ link gap) — those are a separate concern and will be addressed in follow-up PRs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Building on the path/tsconfig blockers fixed in the previous commit,
this clears the remaining 163 TS errors that surface once webpack
reaches tsc:
- 157 errors from Express 5's @types/express-serve-static-core@5.1.1
widening ParamsDictionary[key] from `string` to `string | string[]`.
Express still only returns strings at runtime, so narrow the three
Request types that funnel into the controllers + interceptors:
audit.decorator.ts — AuditContext + TypedRequest
audit.interceptor.ts — RequestWithUser
metrics.interceptor.ts — RequestWithUser
- 3 errors from an OTel package version skew: sdk-node@^0.218.0 brings
otlp-exporter-base@0.218 to the hoisted root, but the http exporters
(exporter-trace/metrics/logs-otlp-http) are still pinned at ^0.207
and carry their own nested 0.207 copy with an incompatible `headers`
typing. Cast at the three call sites in tracing.ts until the http
exporters get bumped to 0.218 in a follow-up dep-bump PR.
- 2 TS2307 errors from runner-api-client not being reachable. The
Dockerfile COPYs libs to /boxlite/libs/ (which nx's project sourceRoot
expects) but tsconfig paths declare libs at apps/libs/ relative to
apps/tsconfig.base.json. Bridge with `ln -s ../libs apps/libs` so both
consumers see the libs where they expect.
- TS6059 (lib files outside rootDir) that surfaced once the symlink let
TS reach the lib sources. Widen tsconfig.base.json rootDir from "."
to ".." so /boxlite/libs/* falls inside the rootDir of /boxlite/.
End state: `docker build -f apps/api/Dockerfile .` produces a working
2.21 MiB dist/apps/api/main.js. Dashboard build (Step 22 of the same
Dockerfile) is still blocked by an *independent* boxlite-ai#706 fallout —
apps/libs/api-client/src/models/index.ts references 12 box-*.ts files
that boxlite-ai#706 forgot to regenerate via openapi-generator. That regen
machinery was restored in upstream boxlite-ai#716; rebasing onto post-boxlite-ai#716 main
picks up the regenerated files and dashboard should follow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ca677f2 to
b633eeb
Compare
DorianZheng
added a commit
that referenced
this pull request
Jun 10, 2026
…API clients (#727) ## What The consumer-adaptation follow-up that #726 disclosed: makes `apps/cli`, `apps/dashboard`, and `apps/libs/sdk-typescript` compile against the regenerated API clients by removing code whose server-side API was deleted in the A2+MVP merge (#715). 52 files, +115/−3063 — almost entirely deletions. ## cli - Deletes the Dockerfile-build flow: `--dockerfile`/`-f` and `--context`/`-c` flags on `boxlite create`, `CreateBuildInfo` construction (`cmd/common/build.go` with its Dockerfile parsing + MinIO context upload), build-log streaming (`cmd/common/logs.go`, hit the removed `/build-logs` endpoint), the MCP `create_box` `buildInfo` argument, and `pkg/minio` (its only consumer was the build flow; `go mod tidy` drops the dependency). - Drops `BOXSTATE_BUILD_FAILED` / `BOXSTATE_PENDING_BUILD` handling (states removed from the enum). - Regenerates cobra docs via `hack/generate-cli-docs.sh` — also clears stale `boxlite snapshot` docs left from the super PR. ## dashboard - Deletes the **Registries** page, `RegistryTable`, the 4 registry hooks, its route enum + hidden-routes entry, and `apiClient.ts` wiring (`DockerRegistryApi` was removed). The page was already in `HIDDEN_DASHBOARD_ROUTES`. - Removes the **usage-overview** wiring (`getOrganizationUsageOverview` removed with no successor): the `UsageOverview`/`UsageOverviewIndicator`/`LimitUsageChart` components, the quota-driven usage timeline chart (its "percent of quota" mode is built on the deleted `RegionUsageOverview` quotas throughout), the hook + query keys + `LiveIndicator` they orphaned. **Spending and Limits keep their billing/tier features** (wallet, cost breakdown, tier comparison, rate limits). - Drops the orphaned `templates` box filter (the `snapshots` query param left `listBoxesPaginated`; nothing set the filter). ## sdk-typescript - `Box`: drops `template`/`backupState`/`backupCreatedAt`/`buildInfo` — fields no longer on the wire model. - `BoxLite.create()`: the wire `CreateBox` accepts neither `buildInfo` nor `templateId` anymore, so `create()` now **throws a clear `BoxliteError`** when `image` or `templateId` params are provided instead of silently dropping them. The `CreateBoxFromImageParams` type, overload, and `Image` class stay exported (marked `@deprecated`) because the dashboard Playground imports them — its image flow now gets an honest runtime error (it was already broken server-side); the full Playground rework belongs to the MVP track (`PlaygroundProvider.tsx` already carries `TODO(image-rewrite)` markers). - Deletes the dead `processStreamingResponse` helper (`stdDemuxStream` stays — `Process.ts` uses it). - **Adds guard tests** (`__tests__/BoxLite.create-guards.test.ts`) for the two new throws, wiring the dormant jest harness to `tsconfig.spec.json` + the workspace path aliases so it actually runs (`yarn jest --config libs/sdk-typescript/jest.config.js`, 2/2 pass). The asserted messages are produced only by the guards — without them the call rejects with a network `AxiosError`. ## Verification - `go build ./...` + `gofmt` clean in `apps/cli`; `go mod tidy` applied. - sdk `tsconfig.lib` **and** `tsconfig.spec` typecheck clean; jest guard tests 2/2. - dashboard `tsc`: **216 errors vs the 232-error pre-merge baseline, zero new** (position-normalized diff; the dashboard has never been tsc-clean — #719 tracks that). - `make lint:fix` exits 0 modifying nothing. - Grep sweeps: zero remaining references to any removed client symbol outside the generated dirs. ## Out of scope (pre-existing) `apps/runner` fails to compile on main (`boxlite.WithPort` undefined in `pkg/boxlite`) — fails identically at clean HEAD, unrelated to the regen.
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
The SST production webpack build (
apps/api/Dockerfile→nx build api --configuration=production) has been silently broken onmainsince PR #460 (5+ weeks). This PR makes it pass end-to-end for the API. Two commits:End state:
docker build -f apps/api/Dockerfile .produces a working 2.21 MiBdist/apps/api/main.js.Why this slipped past CI
.github/workflows/has no step that runsdocker build -f apps/api/Dockerfileorsst deployscripts/test/e2e/bootstrap.sh) runs the API viats-node --transpile-only, which skips type checkingsst deployA follow-up PR should add a CI step that runs this Dockerfile build to prevent regressions.
Commit 1: structural blockers
apps/api/webpack.config.js— migration entries werecwd-relative paths.@nx/webpacksetsconfig.contextto the project root (/boxlite/apps/api), so webpack resolved each entry as/boxlite/apps/api/apps/api/src/migrations/<X>.ts→ 91 "Module not found" errors. Mapping each glob match throughpath.resolve(process.cwd(), …)makes entries absolute, sidesteppingcontextresolution.apps/api/Dockerfile(first edit) —apps/api/tsconfig.jsonextends"../tsconfig.base.json", which from/boxlite/apps/api/resolves to/boxlite/apps/tsconfig.base.json. The Dockerfile was COPYing it to/boxlite/tsconfig.base.json(root). Split the COPY so it lands at the expected path.Commit 2: 163 latent TS errors
@types/express-serve-static-core@5.1.1wideningParamsDictionary[key]fromstringtostring | string[]. Express still only returns strings at runtime, so narrow the three Request types that funnel into controllers + interceptors (audit.decorator.ts,audit.interceptor.ts,metrics.interceptor.ts).sdk-node@^0.218.0bringsotlp-exporter-base@0.218to the hoisted root, but the http exporters (exporter-trace/metrics/logs-otlp-http) are still pinned at^0.207and carry their own nested 0.207 copy with an incompatibleheaderstyping. Cast at the 3 call sites intracing.tsuntil the http exporters get bumped to 0.218 in a follow-up dep-bump PR.runner-api-clientnot being reachable — The Dockerfile COPYs libs to/boxlite/libs/(which nx's project sourceRoot expects) but tsconfig paths declare libs atapps/libs/relative toapps/tsconfig.base.json. Bridge withln -s ../libs apps/libsso both consumers see the libs where they expect.apps/tsconfig.base.jsonrootDir from"."to".."so/boxlite/libs/*falls inside the rootDir of/boxlite/.Test plan
docker build -f apps/api/Dockerfile .(pre-fix at base SHA): 91 "Module not found" + TS5083 — dies before tscdocker build -f apps/api/Dockerfile .(after commit 1): 163 TS errors at tsc stagedocker build -f apps/api/Dockerfile .(after commit 2): api stage compilessuccessfully, emitsdist/apps/api/main.js3b0675e9) hits the identical 163 errorsOut of scope
apps/libs/api-client/src/models/box-*.tswas missing). This branch is rebased onto post-chore(apps): restore Daytona API-client regen machinery + regenerate clients #716 (which restored the regen machinery and committed the generated files), so dashboard should follow with no further work.exporter-{trace,metrics,logs}-otlp-httpwithsdk-node.Hook notes
make lint:fix) skipped because it formats the entireapps/workspace and would bundle in 3 unrelated prettier-dirt files left over from refactor: rename Sandbox -> Box (Part 1: apps/api epicenter) #706 (apps/api/eslint.config.mjs,apps/dashboard/src/components/Sidebar.tsx,apps/dashboard/src/pages/Onboarding.tsx)make test) skipped because it OOMs this build host🤖 Generated with Claude Code