Repository navigation
feat(cli): add native Bun backend support and Dockerfile.bun - #11039
diegosouzapw merged 9 commits into
Conversation
…-sqlite3 driver priority
…, update docs & unit tests
|
Solid, well-documented effort — the runtime detection, Webpack-under-Bun switch, update-notifier hardening, and DAST workflow fixes are all reasonable. Two blocking issues, both verified on real Bun 1.3.14:
[OPTIONAL] The PR mixes unrelated cleanup (virtualFactory.ts:610 Number(), |
7ddbaf6
into
cheaper-inference:release/v3.8.50
…antiation (#11039) (#11163) Cherry-picked onto the current tip (authorship preserved), noise stripped. Validated on BOTH runtimes: bun test tests/unit/db-adapters/ 44/44 under the pinned Bun 1.3.14 (native bun:sqlite path), and node --test on the same suite 52 pass / 0 fail / 1 skip (Bun-only adapter skips under Node, as designed). Dockerfile.bun entrypoint now matches the standalone runner shape. Follow-up to #11039. Thank you @rqzbeh!
…workflow (#11039) (#11168) Cherry-picked onto the current tip (authorship preserved, Dockerfile.bun conflict with the just-merged #11163 resolved additively — runner-web stage after the new entrypoint). Three pre-merge fixes on the branch: (1) generated-count noise stripped; (2) runner-web stage now returns to the non-root bun user after the apt install (mirrors the Node Dockerfile runner-web re-asserting USER node — the stage previously ended as root); (3) the 6 new build/manifest steps SHA-pinned so the zizmor ratchet stays at 191<=192 findings instead of regressing to 197 (actionlint clean). Workflow YAML parses; runner-base/runner-web targets cross-checked against the Dockerfile stages. Thank you @rqzbeh!
…-inference#11039) ⭐4 — Suporte de backend nativo Bun + Dockerfile.bun multi-stage + fallback dinâmico de driver SQLite (better-sqlite3 prioritário sob Bun, bun:sqlite fallback; Node preservado) + correção de estabilidade do DAST CI smoke. Validado a fundo (worktree board sobre tip): bun-support 4/4, typecheck:core limpo, dashboard-typecheck OK (220 dentro do baseline), open-sse-typecheck OK (5 pré-existentes), gate de runtime OK sob Node, changelog-integrity OK, file-size/complexity/cognitive/dead-code OK. Verificado que o driver preserva a cadeia Node/falback conforme AGENTS.md; teste bun-support presente. Baselines de typecheck removidos são ratchet honesto (erros não existem mais). OBS: destravei 2 base-reds do tip neste turno (push direto c4ce593): movi o changelog fragment da cheaper-inference#11050 da seção inválida breaking/ para fixes/, e rebaselinei AddApiKeyModal 1067->1073 (crescimento da cheaper-inference#11056). Sem isso a cheaper-inference#11039 e o resto da fila ficariam vermelhos.
…antiation (cheaper-inference#11039) (cheaper-inference#11163) Cherry-picked onto the current tip (authorship preserved), noise stripped. Validated on BOTH runtimes: bun test tests/unit/db-adapters/ 44/44 under the pinned Bun 1.3.14 (native bun:sqlite path), and node --test on the same suite 52 pass / 0 fail / 1 skip (Bun-only adapter skips under Node, as designed). Dockerfile.bun entrypoint now matches the standalone runner shape. Follow-up to cheaper-inference#11039. Thank you @rqzbeh!
…workflow (cheaper-inference#11039) (cheaper-inference#11168) Cherry-picked onto the current tip (authorship preserved, Dockerfile.bun conflict with the just-merged cheaper-inference#11163 resolved additively — runner-web stage after the new entrypoint). Three pre-merge fixes on the branch: (1) generated-count noise stripped; (2) runner-web stage now returns to the non-root bun user after the apt install (mirrors the Node Dockerfile runner-web re-asserting USER node — the stage previously ended as root); (3) the 6 new build/manifest steps SHA-pinned so the zizmor ratchet stays at 191<=192 findings instead of regressing to 197 (actionlint clean). Workflow YAML parses; runner-base/runner-web targets cross-checked against the Dockerfile stages. Thank you @rqzbeh!
Summary
This PR adds native Bun backend runtime support, multi-stage Docker build configuration (
Dockerfile.bun), dynamic driver fallback logic, and resolves DAST CI workflow stability.Key Changes
Bun Runtime Detection & Container Support (
Dockerfile.bun):Dockerfile.bunfor native Bun production deployments.bin/nodeRuntimeSupport.mjs,src/shared/utils/nodeRuntimeSupport.ts).SQLite Driver Adapter Prioritization (
bin/cli/sqlite.mjs,src/lib/db/adapters/driverFactory.ts):better-sqlite3driver prioritization under Bun with smooth fallback tobun:sqliteandsqlite3.bin/cli/runtime/nativeDeps.mjs) for cross-runtime binary loading.Build & Dev Tooling Adaptation (
scripts/build/build-next-isolated.mjs,scripts/dev/run-next.mjs):export const dynamic = "force-dynamic";annotations to API routes to prevent static generation build failures under Bun.DAST Smoke CI Workflow Fixes (
.github/workflows/dast-smoke.yml):REQUIRE_API_KEY: "false"to server start env so Promptfoo can testinjectionGuardonPOST /v1/chat/completionswithout failing early atrouteGuardauthorization with HTTP 401 (AUTH_002)./api/auth/login) from Schemathesis payload fuzzing (--exclude-path-regex '^/api/auth/(oidc/|login)') to avoid HTTP 429 status code assertions.promptfoo@0.122.0global installation to prevent npx package resolution failures.Test & Documentation Coverage:
tests/unit/bun-support.test.tsasserting Bun detection and SQLite driver resolution order.README.mdwith Bun deployment and container build instructions.Verification
npm run typecheck:core(0 errors)node --import tsx/esm --test tests/unit/bun-support.test.ts(3/3 passed)