chore(apps): restore Daytona API-client regen machinery + regenerate clients#716
Merged
Merged
Conversation
The apps/ subtree import dropped the root-level support files that made
'yarn generate:api-client' reproducible in daytonaio/daytona:
- openapitools.json: pin openapi-generator to 7.23.0 (matches the committed
clients); without it every machine floats to the latest jar
- hack/{ts,go}-client: upstream postprocess scripts (User-Agent branding,
go version.go via go:embed) and the custom Go mustache templates
- nx target paths: written for upstream's repo-root workspace; rewrite for
the apps/-rooted workspace (api/src/..., -o api-client-go) and add
TS_NODE_TRANSPILE_ONLY for the WIP type errors
- api/.env.example: offline dev/CI env for generate-openapi.ts (upstream
commits apps/api/.env; boxlite ignores .env so ship an example + gitignore
exception, copy to api/.env before generating)
- @ApiExcludeController on boxlite-rest controllers: that surface is
spec-first (openapi/box.openapi.yaml); in the product spec its :prefix
routes and @ALL()-expanded SEARCH verb are OpenAPI-invalid and broke
generation
- api-client-drift.yml: port of upstream's format-lint-api-clients gate -
regenerate and fail on diff, so clients can no longer go stale
Signed-off-by: dorianzheng <xingzhengde72@gmail.com>
Pure openapi-generator 7.23.0 output via the restored machinery — no hand edits. Closes the client-staleness item from #711: - WebhookEvent enums now match the server: sandbox.created -> box.created, sandbox.state.updated -> box.state.updated (TS + Go) - sandboxIdOrName path-template vars -> boxIdOrName; stale sandbox doc text caught up; both clients now contain zero sandbox tokens - Go client regression fixed: version.go (go:embed VERSION) restored and UserAgent is api-client-go/<version> again instead of the stock generator string - UNKNOWN_DEFAULT_OPEN_API members added everywhere (enumUnknownDefaultCase) - new TS models picked up (api DTOs added since the previous regen) - api_box_lite_rest.go deleted: the boxlite-rest surface is spec-first (openapi/box.openapi.yaml) and its generated client had zero consumers Verified: regen idempotent; tsc exit 0 on libs/api-client; go build + vet clean in api-client-go and apps/cli. Signed-off-by: dorianzheng <xingzhengde72@gmail.com>
|
Important Review skippedToo many files! This PR contains 300 files, which is 150 over the limit of 150. To get a review, narrow the scope: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (300)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
apps/ never had a committed lockfile (the repo-root .gitignore blanket predates the apps/ import), so a fresh CI checkout had no yarn project anchor — yarn 4 walked up to the repo root and refused to install — and every CI run would re-resolve all dependencies, letting floating transitive deps (e.g. @nestjs/swagger) shift the generated spec and turn the drift gate red for the wrong reason. Commit the resolution validated end-to-end today (install, spec gen, client regen, tsc, go build all green), add the !/apps/yarn.lock gitignore exception, and switch the drift job to yarn install --immutable with the yarn cache keyed on the lockfile (corepack before setup-node so the cache probe sees yarn 4). Upstream daytona does the same. Signed-off-by: dorianzheng <xingzhengde72@gmail.com>
This was referenced Jun 10, 2026
DorianZheng
added a commit
that referenced
this pull request
Jun 10, 2026
…ame (#718) Closes the "Regenerate cli cobra docs + daemon swaggo docs" checkbox from #711. CLI Go source and daemon toolbox source are fully renamed (verified 0 `sandbox` tokens before regenerating), but the committed generated docs predated the rename — cobra markdown/YAML still said "Create a new sandbox" etc., and the toolbox swagger carried one stale token. ## Changes (all generator output + one script fix) - `apps/cli/docs/*.md`, `apps/cli/hack/docs/*.yaml` — regenerated via `hack/generate-cli-docs.sh` (`go run main.go generate-docs`). Diff = sandbox→box description catch-up + genuine drift catch-up (newly documented flags such as `--force`, `snapshot delete` usage gaining `SNAPSHOT_NAME`). - `apps/daemon/pkg/toolbox/docs/{docs.go,swagger.json,swagger.yaml}` — regenerated via the daemon `docs` target command (`swag fmt && swag init … && prettier`). Now 0 sandbox tokens. - `apps/cli/hack/generate-cli-docs.sh` (+3) — adds a prettier pass over `hack/docs/**/*.yaml`: the committed YAML is prettier-formatted while raw cobra output is not, so without this every regen produces ~700 lines of quoting/indent churn (observed 1172→478 changed lines). Mirrors what the daemon docs target already does. ## Verification - 0 `sandbox` tokens in all regenerated outputs (`git grep -i sandbox` over the three docs trees: empty). - Every changed line mechanically classified: rename catch-up, prettier/cobra whitespace normalization, or the named new-flag drift — nothing unexplained. - shellcheck clean on the script. Note: unlike the API clients (#716 added a drift gate), these docs have no CI gate — staleness will accumulate again until regenerated; a sibling drift job is a possible follow-up. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated CLI documentation to use "box" terminology instead of "sandbox" across all commands and help text. * Improved documentation formatting and alignment in command reference guides. * **New Features** * Added `boxlite autocomplete` command for shell completion support. * Enhanced `boxlite snapshot delete` to accept both snapshot ID and snapshot name. * Added `--force` flag to `boxlite stop` command for force-stopping boxes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: dorianzheng <xingzhengde72@gmail.com>
G4614
added a commit
to G4614/boxlite
that referenced
this pull request
Jun 10, 2026
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>
4 tasks
DorianZheng
added a commit
that referenced
this pull request
Jun 10, 2026
…wagger spec (#721) ## Summary Closes out the **analytics-api-client** item of #711 (Sandbox→Box Part 1 follow-ups). #706 renamed the dashboard's analytics consumers to Box-named symbols (`ModelsBoxUsage`, `organizationOrganizationIdUsageBoxGet`, …) but the committed client still only exported Sandbox-named ones — the dashboard could not typecheck against the in-repo client. The client also couldn't be regenerated from this repo at all: its generator input was an uncommitted `tmp/swagger.json` from the external analytics service (the reason #716 excluded it). ## Changes - **Commit the contract in-repo**: `apps/libs/analytics-api-client/swagger.json`, reconstructed 1:1 from the previously committed client with only sandbox→box renamed (paths `/organization/{organizationId}/box/{boxId}/…`, `models.BoxUsage`, `boxId`, `boxCount`). This is now the spec any future analytics service must implement — same spec-first direction as `openapi/box.openapi.yaml`. - **Point `generate:api-client` at it** (`project.json`), with nx cache inputs tracking the spec instead of the unrelated `apiClient` named input. - **Regenerate** with the pinned openapi-generator **7.23.0** (committed client was stale 7.12.0 output — the last client on the old generator). Zero `sandbox` tokens remain. - **Drift gate**: drop the analytics exclusion from `api-client-drift.yml` — it now regenerates + diffs analytics like the other clients (actionlint clean). - **eslint**: ignore `**/.nx/**` — the generate target caches its `src/` output under the gitignored `apps/.nx/cache`, and lint after a local regen tripped on the cached copy of generated code. ## Verification - Two-side dashboard typecheck: against the **old** client → 13 rename-mismatch errors (`'ModelsBoxUsage'… Did you mean 'ModelsSandboxUsage'?`); against the **new** client → **zero** analytics-related errors (remaining 24 are pre-existing, unrelated: Playground/VNC files + unbuilt `@boxlite-ai/sdk` dist). - Regen is byte-identical across runs (`--skip-nx-cache`), so the drift gate won't false-positive. - `make lint:apps` exit 0. ## Notes - Runtime risk is nil: the analytics client is only instantiated when `ANALYTICS_API_URL` is configured, no analytics service exists in the org today, and the API's own (already-renamed) `box/:boxId/telemetry/*` endpoints serve the dashboard otherwise (`AnalyticsApiDisabledGuard` makes the two mutually exclusive). - Pre-existing, **not** fixed here (scope): `apps/dashboard/tsconfig.app.json` path mappings (`\"@boxlite-ai/*\": [\"../../libs/*\"]`) have pointed outside the workspace since the apps tree was flattened (#460), so raw `tsc -p` never resolved any `@boxlite-ai/*` import. Worth its own follow-up. Part of #711. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added AWS Signature V4 support for API requests. * Telemetry and usage endpoints now operate at box (per-box) and organization levels (replacing sandbox-level variants). * **Documentation** * Comprehensive API docs added/updated with examples for box telemetry, per-box usage, aggregated usage, and usage chart endpoints. * **Chores** * Drift detection updated to include the analytics API client; linting ignores extended for generated files. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: dorianzheng <xingzhengde72@gmail.com>
DorianZheng
added a commit
that referenced
this pull request
Jun 10, 2026
…lient, fix dead env vars + stale refs - regenerate toolbox-api-client from the (already-renamed) committed daemon swagger: 7.12.0 → pinned 7.23.0 generator, kills the last 4 generated "sandbox entrypoint" doc-comments; missed by #716/#718 which covered only the product clients - add toolbox-api-client to the api-client-drift gate with --excludeTaskDependencies (committed daemon swagger is the contract; daemon-source↔swagger drift stays ungated, needs swag toolchain) - fix nx paths broken since the apps/ workspace flattening: generator -i specs in toolbox/runner client project.json (apps/daemon→daemon, apps/runner→runner — toolbox regen failed outright on the stale path) and nx.json cache inputs (go.work, daemon swagger), which pointed at nonexistent files and never invalidated caches - e2e bootstrap.sh + infra-local api.env wrote ADMIN_MAX_*_PER_SANDBOX but the API reads ADMIN_MAX_*_PER_BOX (configuration.ts:292) with default 0 — admin-org per-box quotas were silently unset - stack-reset.sh and infra-local README TRUNCATE/SELECT table `sandbox`, which migration 1781016743403 renamed to `box`; also /api/sandbox routes → /api/box and {{sandboxId}} → {{boxId}} per the configuration DTO example - sweep remaining sandbox vocabulary from e2e cases, teardown, runner-update-binary.sh, and infra-local docs (comments, docstrings, test function names; no selector references them) - includes 3 files prettier-normalized by the repo's `make lint:fix` pre-commit autofixer (eslint.config.mjs, Sidebar.tsx, Onboarding.tsx) — out of format on main; the hook is repo-wide and re-applies them on every commit until committed Part of #711. Signed-off-by: dorianzheng <xingzhengde72@gmail.com>
DorianZheng
added a commit
that referenced
this pull request
Jun 10, 2026
…lient, fix dead env vars + stale refs (#723) Part of #711 — closes out the "Part 1 of N" remainder. A repo-wide sweep found the rename effectively complete in source (`runner`/`cli`/`daemon`/`dashboard`/`proxy` at zero tokens; `apps/api` leftovers are historical migrations, correct as-is). What remained is below. ## Generated client (the bulk of the diff) **`toolbox-api-client` regenerated** from the committed `apps/daemon/pkg/toolbox/docs/swagger.json` (which #718 already renamed — `git grep "sandbox entrypoint"` has zero hits outside the generated client). This kills the last 4 generated `sandbox entrypoint session` doc-comments and moves the client from generator 7.12.0 to the pinned 7.23.0, same modernization #721 did for analytics (hence the `src/docs/*.md` additions — 7.23 emits them, and the drift gate requires committed == emitted). Determinism verified: regen run twice locally (with and without `--excludeTaskDependencies`), byte-identical both times. **Drift gate now covers it** (`api-client-drift.yml`): regen via `--excludeTaskDependencies` so the committed daemon swagger is the contract and the job needs no Go/swag toolchain. Daemon-source↔swagger drift stays ungated (the cli/daemon-docs sibling gate noted in #711 remains a follow-up). actionlint + shellcheck clean. ## Why the toolbox client was never regenerated: broken nx paths The regen target failed outright: `-i apps/daemon/pkg/toolbox/docs/swagger.json` resolves relative to the nx workspace root, which *is* `apps/` → `apps/apps/daemon/...` (spec not found). Kept from upstream daytona's repo layout; #716 fixed only the product clients' targets. Fixed here: - `libs/toolbox-api-client/project.json` — `-i daemon/pkg/toolbox/docs/swagger.json` - `libs/runner-api-client/project.json` — same latent bug (`-i runner/...` + its `{workspaceRoot}` input) - `nx.json` — `apiClient`/`goProduction` named inputs pointed at `{workspaceRoot}/apps/...` paths that don't exist, so swagger/go.work changes never invalidated task caches ## Functional config fixes - **`scripts/test/e2e/bootstrap.sh` + `apps/infra-local/configs/api.env`** wrote `ADMIN_MAX_{CPU,MEMORY,DISK}_PER_SANDBOX`, but the API reads `ADMIN_MAX_*_PER_BOX` (`apps/api/src/config/configuration.ts:292-294`) with default `0` — admin-org per-box quotas were silently unset. - **`apps/infra-local/scripts/stack-reset.sh` + README runbook snippets** ran `TRUNCATE TABLE sandbox, ...` / `SELECT ... FROM sandbox` — that table was renamed to `box` by migration `1781016743403`, so these failed as written. Also `/api/sandbox` → `/api/box` (route is `@Controller('box')`) and `{{sandboxId}}` → `{{boxId}}` (matches the `configuration.dto.ts` example). infra-local merged in #595 on a pre-#706 vocabulary. ## Vocabulary sweep (no behavior change) Comments, docstrings, and three e2e test function names (`test_*_above_per_sandbox_limit_*` → `per_box`; no `-k` selector, workflow, or Makefile references them) across `scripts/test/e2e/`, `scripts/deploy/runner-update-binary.sh`, and `apps/infra-local/`. File/path references verified against the tree (`box.service.ts`, `volume.manager.ts:47`, `box_sync.go`, `CREATE_BOX` journal tokens). All three trees now grep-clean for `sandbox`. Also includes 3 files prettier-normalized by the repo's `make lint:fix` pre-commit autofixer (`eslint.config.mjs`, `Sidebar.tsx`, `Onboarding.tsx`) — they were out of format on `main` and the repo-wide hook re-applies them on every commit until committed. ## Verification - Regen byte-identical across repeated runs, including the exact CI invocation - `actionlint` + `shellcheck` on the workflow; `shellcheck` on all 6 edited shell scripts (only pre-existing findings on untouched lines); `py_compile` on all 7 edited Python files - Every text replacement applied with an exact-unique-match assertion (count==1 before replace) - OS-isolation uses of "sandbox" (jailer/seatbelt/bwrap, docs/faq) deliberately untouched — different concept per the rename's scope Signed-off-by: dorianzheng <xingzhengde72@gmail.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.
Closes the "regenerate api-client/api-client-go" follow-up from #711 (post-#706 rename), and makes the regeneration reproducible so the clients can't silently go stale again.
Why the clients were stale
The
apps/subtree import from daytonaio/daytona dropped the root-level machinery that upstream uses to regenerate clients (researched against upstream —daytonaio/daytona@main):openapitools.jsongenerator pinhack/{ts,go}-client/postprocess + Go mustache templatesversion.go+ brandedUser-Agent; targets failed at the postprocess stepformat-lint-api-clientsCI drift gate (pr_checks.yaml)WebhookEvent="sandbox.created"survived the rename mergeapps/api/.envdev env.env)generate-openapi.ts(boots the full NestJS app) had no env to run underapps/)nx run api:openapiresolvedapps/apps/api/...Commit 1 — machinery
apps/openapitools.jsonpins openapi-generator at 7.23.0 (matches the committed clients; upstream pins 7.21.0 — deliberate deviation to minimize this diff).apps/hack/{ts,go}-client/copied byte-identical from upstream (User-Agent branding,version.goviago:embed, Go model templates).api,libs/api-client,api-client-goproject.json (apps/-rooted workspace), plusTS_NODE_TRANSPILE_ONLY=true(api has pre-existing WIP type errors) and upstream'senumUnknownDefaultCase=truerestored on both clients.apps/api/.env.example— offline placeholder env for spec generation (cp api/.env.example api/.env), following the repo's existing.env.examplegitignore-exception precedent.SKIP_CONNECTIONS=true(already in the nx target) keeps it offline; values are docker-compose placeholders.@ApiExcludeController()on the fourboxlite-restcontrollers. That surface is spec-first — its contract isopenapi/box.openapi.yaml(the controllers' own docs say so) — and in the swagger-emitted product spec it is OpenAPI-3.0-invalid::prefixroute tokens have no declared path param, and the proxy's@All()expands to theSEARCHverb, which OpenAPI 3.0 cannot express. This invalidity is what brokeopenapi-generatorentirely. The generatedBoxLiteRESTsurface had zero consumers (verified across cli/sdk-go/sdk-typescript/dashboard/daemon)..github/workflows/api-client-drift.yml— port of upstream's drift gate: regenerate both clients onapps/**PRs and fail on diff (redis service container avoids a bootstrap retry-race; actionlint/shellcheck clean).Commit 2 — regenerated clients (generator output only, no hand edits)
WebhookEventenums now match the server:sandbox.created→box.created,sandbox.state.updated→box.state.updated(TS + Go) — this was the consumer-facing break from Post-merge follow-ups for #706 (Sandbox→Box Part 1): client regen + staging migration + CodeQL #711.sandboxIdOrNamepath-template vars →boxIdOrName; stale "…of the sandbox" doc text → box. Both clients now contain zerosandboxtokens.version.go(go:embed VERSION) restored,UserAgent: "api-client-go/" + ClientVersioninstead of the stock"OpenAPI-Generator/1.0.0/go".UNKNOWN_DEFAULT_OPEN_APIenum members added across both clients (upstream'senumUnknownDefaultCase=true— forward-compat with unknown server enum values).src/docs/*.md— not previously committed, but the drift gate requires committed output to match emitted output exactly, so they're in (upstream suppresses docs; we commit-as-emitted).api_box_lite_rest.godeleted (−4801 lines): the excluded, consumer-less spec-first surface above.Verification
box.*webhook events, 0{prefix}paths.git status).tsc -p libs/api-client/tsconfig.lib.json→ exit 0.go build ./...clean inapi-client-goandapps/cli(the Go consumer).BoxLiteRESTgenerated API or oldSANDBOX_*enum members.Not in scope
analytics-api-client: its input swagger comes from the external analytics service (upstream excludes it from regen for the same reason); it still containssandbox.*until that service renames.apps/yarn.lockstays uncommitted (explicitly gitignored by repo policy); the drift job does a plainyarn install. Committing a lockfile would make the gate fully deterministic — separate policy decision.sandboxstrings in cli docs / shim (tracked in Post-merge follow-ups for #706 (Sandbox→Box Part 1): client regen + staging migration + CodeQL #711).