Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ Node-version output: only those checkouts resolve and install their production N
job level. Current composites skip that fallback. Integration evidence verifies and records
the actual selected version.

Docker Bun builders, runtimes and the React service generator use the same Bun
version as the root `packageManager` and CI, pinned to official `oven/bun`
multiarchitecture image digests. Update every flavor together; the CLI toolchain
guard rejects drift and native image checks execute the runtime version. Client
builds share `packages/ui/bin/build-client.ts`, which awaits Vite and its plugin
output before an explicit success exit. Keep each service's working directory;
SSR and development/watch commands retain their own arguments. The completion
marker distinguishes a build that resolved from a stalled process exit; it is
not proof of the cause of a stall before Vite resolves.

Shared checks and native CLI builds use the same Bun download key inputs: the root
manifest, every declared workspace manifest, lockfile, patches and `bunfig.toml`.
The independent document-node npm manifest is outside that workspace identity.
Expand Down
7 changes: 5 additions & 2 deletions .github/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ A published version is not a deployment. Deployments follow their own procedure.
The workflow test stubs `gh`, so it proves the step's branching, not GitHub's lookup. This is
a recorded decision: the step treats any failed lookup as a missing release and calls
`gh release create`, so the draft check is only as reliable as gh's lookup.
- **A failed Release run after the tag.** Never move the tag. Re-run the Release run's failed
jobs (its concurrency never cancels a release), or release the fix as the next version.
- **A failed Release run after the tag.** Never move the tag. For a transient failure,
re-run **all jobs** of the same Release run (its concurrency never cancels a release).
The maintained adopter requires the complete publication job matrix from one current
attempt; failed-job-only retries omit earlier successes, and mixing attempts is refused.
If source must change, fix `main`, validate a new candidate and release the next version.

## Merging during a release, and the release lease

Expand Down
4 changes: 3 additions & 1 deletion knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,14 @@ export default {
entry: [
...Object.values(uiPackage.exports),
...Object.values(uiPackage.bin),
// Invoked by path from service build scripts, not a published bin.
'bin/build-client.ts',
'src/**/*.stories.{ts,tsx}',
],
// Tailwind's CSS compiler must see public stylesheet imports too.
project: ['**/*.{ts,tsx,css}'],
ignoreDependencies: [
// Type-only import in src/{pwa,seo/runtime}/vite-plugin.ts. Declared
// Build helper and src/{pwa,seo/runtime}/vite-plugin.ts imports. Declared
// as an optional peer so consumers without a vite-driven service
// don't have to install it; knip flags optional peers that are
// referenced, which is exactly the pattern we want here.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// The Playwright webServer chains client build → preview with `&&`, so the
// chain advances only when the build PROCESS exits. `bun --bun vite build`
// Client build chains (Docker, workspace scripts and local preview) advance
// only when the build PROCESS exits. Keep the calling service as the cwd so
// Vite selects its own config and output paths. `bun --bun vite build`
// occasionally never exits after a successful build, and the silent hang
// starves the chain until the webServer timeout with zero tests run.
// Building through the JS API and exiting explicitly removes the implicit
Expand All @@ -8,7 +9,7 @@
// fires. The exit itself needs Bun ≥ 1.4.1 — earlier Bun ran rolldown's
// N-API finalizers and cleanup hooks inside `process.exit()`, and the
// evidence places CI's remaining stalls there (pinned in
// `.github/actions/setup-turbo/action.yml`). The line logged after `build()`
// `.github/actions/setup-turbo/action.yml` and Docker images). The line after `build()`
// resolves puts any future stall on one side of the exit or the other.

import { build } from 'vite';
Expand Down
6 changes: 3 additions & 3 deletions services/ai-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AI Gateway Dockerfile — the Vite panel, served by the Bun server that also runs the gateway
ARG VERSION=dev

FROM oven/bun:1.3.12 AS bun-bin
FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS bun-bin

# ============================================================================
# Stage 1: workspace deps
Expand Down Expand Up @@ -58,14 +58,14 @@ WORKDIR /app/services/ai-gateway
# stage carries no `node_modules`, so every import `server.ts` makes —
# `@tale/ui/server`, the service's own modules, its dependencies — has to
# be inlined here (the pattern `services/web` and `services/docs` use).
RUN bun --bun vite build \
RUN bun --bun ../../packages/ui/bin/build-client.ts \
&& bun build server.ts --target=bun --outfile=server.js --external bun
WORKDIR /app

# ============================================================================
# Stage 3: runtime
# ============================================================================
FROM oven/bun:1.3.12-slim AS runner
FROM oven/bun:1.4.2-slim@sha256:cb3bbbb08e13a4a2ff400f24c7a2a1d5efa83f6ef8544d52d95a519631e2fc61 AS runner

ENV NODE_ENV=production \
PORT=3004 \
Expand Down
2 changes: 1 addition & 1 deletion services/ai-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"setup": "echo 'Dependencies managed by root workspace'",
"dev": "bun --bun vite",
"build": "bun --bun vite build",
"build": "bun --bun ../../packages/ui/bin/build-client.ts",
"start": "bun server.ts",
"lint": "bunx oxlint --type-aware",
"lint:fix": "bunx oxlint --type-aware --fix",
Expand Down
6 changes: 3 additions & 3 deletions services/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tale Docs Dockerfile — Vite SPA + Bun server, mirrors services/web.
ARG VERSION=dev

FROM oven/bun:1.3.12 AS bun-bin
FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS bun-bin

# ============================================================================
# Stage 1: workspace deps
Expand Down Expand Up @@ -60,7 +60,7 @@ WORKDIR /app/services/docs
# `dist-seo/` and serves it via `createPrecompiledServer`, so no source
# markdown is read at request time.
RUN bun --bun scripts/build-search-index.ts \
&& bun --bun vite build \
&& bun --bun ../../packages/ui/bin/build-client.ts \
&& bun --bun vite build --ssr app/entry-server.tsx --outDir dist-ssr \
&& bun --bun scripts/prerender.ts \
&& bun --bun /app/packages/ui/bin/seo-compile.ts ./scripts/seo.config.ts --out dist-seo \
Expand All @@ -70,7 +70,7 @@ WORKDIR /app
# ============================================================================
# Stage 3: runtime
# ============================================================================
FROM oven/bun:1.3.12-slim AS runner
FROM oven/bun:1.4.2-slim@sha256:cb3bbbb08e13a4a2ff400f24c7a2a1d5efa83f6ef8544d52d95a519631e2fc61 AS runner

ARG LOCALE_COOKIE_DOMAIN=
# Re-declare DOCS_BASE_URL here so the runner stage can promote it to ENV;
Expand Down
4 changes: 2 additions & 2 deletions services/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"setup": "echo 'Dependencies managed by root workspace'",
"dev": "bun --bun scripts/build-search-index.ts && bun --bun vite",
"build": "bun --bun scripts/build-search-index.ts && bun --bun vite build && bun --bun vite build --ssr app/entry-server.tsx --outDir dist-ssr && bun --bun scripts/prerender.ts && bun run seo:compile",
"build:client": "bun --bun vite build",
"build": "bun --bun scripts/build-search-index.ts && bun --bun ../../packages/ui/bin/build-client.ts && bun --bun vite build --ssr app/entry-server.tsx --outDir dist-ssr && bun --bun scripts/prerender.ts && bun run seo:compile",
"build:client": "bun --bun ../../packages/ui/bin/build-client.ts",
"build:ssr": "bun --bun vite build --ssr app/entry-server.tsx --outDir dist-ssr",
"prerender": "bun --bun scripts/prerender.ts",
"build:search-index": "bun --bun scripts/build-search-index.ts",
Expand Down
4 changes: 2 additions & 2 deletions services/docs/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default createPlaywrightConfig({
// the web suite hit — the deps optimizer never finishes; `vite preview`
// has no optimizer). SSR/prerender/SEO stay out of the command — the
// suite exercises the SPA the dev server serves. The build runs through
// `scripts/build-client.ts` (vite's JS API + an explicit exit), not the
// `../../packages/ui/bin/build-client.ts` (vite's JS API + an explicit exit), not the
// `vite build` CLI: the CLI process occasionally never exits after a
// successful build, and the `&&` chain then starves silently until this
// webServer timeout with zero tests run. The explicit exit is only safe
Expand All @@ -35,7 +35,7 @@ export default createPlaywrightConfig({
// search. Ordinary local runs keep the client-only build below.
(process.env.E2E_USE_BUILD === '1'
? ''
: `bun --bun scripts/build-search-index.ts && bun --bun scripts/build-client.ts && `) +
: `bun --bun scripts/build-search-index.ts && bun --bun ../../packages/ui/bin/build-client.ts && `) +
`bun --bun vite preview --port ${PORT} --strictPort`,
url: `http://localhost:${PORT}`,
// Locally reuse an already-running `bun run dev`; in CI boot fresh.
Expand Down
4 changes: 2 additions & 2 deletions services/platform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ARG VERSION=dev

# Bun binary for all stages
FROM oven/bun:1.3.12 AS bun-bin
FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS bun-bin

# Node binary for the 0.5 backend roles (api/worker). The backend runs its .ts
# sources directly via Node's type stripping (>= 22.18); only the binary is
Expand Down Expand Up @@ -115,7 +115,7 @@ ENV NODE_ENV=production
# `dist-seo/`. The runtime stage serves these via @tale/ui's precompiled
# SEO server, so no source markdown is needed at request time.
WORKDIR /app/services/platform
RUN bun --bun vite build \
RUN bun --bun ../../packages/ui/bin/build-client.ts \
&& bun scripts/check-sw-manifest.ts \
&& bun scripts/check-entry-budget.ts \
&& bun scripts/prerender-boot-shell.tsx \
Expand Down
2 changes: 1 addition & 1 deletion services/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"setup": "echo 'Dependencies managed by root workspace'",
"dev": "bun scripts/dev.ts",
"dev:fast": "TALE_DEV_SKIP_DOCKER=1 bun scripts/dev.ts",
"build": "bun run configs:validate && bun --bun vite build && bun scripts/check-sw-manifest.ts && bun scripts/check-entry-budget.ts && bun scripts/prerender-boot-shell.tsx",
"build": "bun run configs:validate && bun --bun ../../packages/ui/bin/build-client.ts && bun scripts/check-sw-manifest.ts && bun scripts/check-entry-budget.ts && bun scripts/prerender-boot-shell.tsx",
"start": "bun --bun vite preview",
"lint": "bunx oxlint --type-aware",
"lint:fix": "bunx oxlint --type-aware --fix",
Expand Down
14 changes: 10 additions & 4 deletions services/platform/scripts/dev-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,16 @@ export async function runDevFleet() {
done: 'Production bundle built',
},
() =>
runCommand('bun', ['--bun', 'vite', 'build'], {}, platformRoot, {
label: 'vite',
classifier: viteClassifier,
}),
runCommand(
'bun',
['--bun', '../../packages/ui/bin/build-client.ts'],
{},
platformRoot,
{
label: 'vite',
classifier: viteClassifier,
},
),
);
} else {
infoLine('Reusing existing dist/ (skipping vite build)');
Expand Down
24 changes: 24 additions & 0 deletions services/platform/tests/integration/container-image-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,30 @@ async function main(): Promise<number> {

if (r.failed > 0) return 1;

const { packageManager } = await Bun.file(
`${PROJECT_ROOT}/package.json`,
).json();
const expectedBun = packageManager.replace('bun@', '');
for (const svc of ['platform', 'sandbox', 'sandbox-runtime']) {
const image = images.get(svc)!;
const bun = await capture([
'docker',
'run',
'--rm',
'--network',
'none',
'--entrypoint',
'timeout',
image,
'10',
'bun',
'--version',
]);
if (bun.exitCode === 0 && bun.stdout.trim() === expectedBun)
r.pass(`${svc}: Bun ${expectedBun} matches the workspace toolchain`);
else r.fail(`${svc}: Bun runtime does not match ${expectedBun}`);
}

// 1. OCI label checks
header('Checking OCI labels');
for (const svc of SERVICES) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ NODEEOF`,
)?.[1];
if (!nodeVersion) throw new Error('Missing exact Node image pin');
probes.unshift({ slug: 'node', binary: 'node', version: nodeVersion });
const bunVersion = dockerfile.match(/FROM oven\/bun:([\d.]+)@sha256:/)?.[1];
if (!bunVersion) throw new Error('Missing exact Bun image pin');
probes.unshift({ slug: 'bun', binary: 'bun', version: bunVersion });
const probeScript = String.raw`
import json, os, re, signal, subprocess, sys, time

Expand Down
21 changes: 20 additions & 1 deletion services/platform/tests/integration/static-site-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
nonRootImageUser,
sleep,
} from './lib/docker';
import { projectRoot } from './lib/exec';
import { capture, projectRoot } from './lib/exec';
import { CYAN, GREEN, header, NC, RED, Results, YELLOW } from './lib/log';

interface StaticSiteProbe {
Expand Down Expand Up @@ -146,6 +146,25 @@ export async function runStaticSiteTest(
r.fail(`${svc}: no HEALTHCHECK instruction`);
}

const { packageManager } = await Bun.file(`${root}/package.json`).json();
const expectedBun = packageManager.replace('bun@', '');
const bun = await capture([
'docker',
'run',
'--rm',
'--network',
'none',
'--entrypoint',
'timeout',
image,
'10',
'bun',
'--version',
]);
if (bun.exitCode === 0 && bun.stdout.trim() === expectedBun)
r.pass(`${svc}: Bun ${expectedBun} matches the workspace toolchain`);
else r.fail(`${svc}: Bun runtime does not match ${expectedBun}`);

const sizeMb = metadata.sizeMb;
if (sizeMb <= sizeBudgetMb) {
r.pass(`${svc}: ${sizeMb} MB ≤ ${sizeBudgetMb} MB budget`);
Expand Down
8 changes: 8 additions & 0 deletions services/platform/tests/manual/reference/automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ suite alongside the automated ones — they drive the same stack.

## Coverage map

Bun Docker builders, runtimes and the React service generator match the pinned
workspace/CI version with immutable image digests. All production client builds
share an awaited Vite helper; real subprocess fixtures prove service cwd, delayed
plugin output and nonzero build/close failures (`tools/cli/scripts/bun-toolchain.test.ts`,
`tools/cli/scripts/build-client.test.ts`). Native container smoke/conformance and
static-site builds cover the runtime upgrade; the intermittent hosted ARM build
stall still requires hosted observation.

Model access immediate saves roll back on failure (including after the
affected-defaults confirmation), show one failure toast, remain retryable,
and reconcile mounted controls with a fresh policy readback. Replaced readbacks
Expand Down
2 changes: 1 addition & 1 deletion services/platform/tests/manual/suites/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ magnitude:
`prod` on a local stack, add `TALE_E2E_SERVE_BUILD=1` to the environment of
mode A's or B's `bun scripts/dev.ts`: it serves `dist/` through
`vite preview`, which proxies the backend like the dev server, and runs
`bun --bun vite build` first when `dist/` is missing. Delete `dist/` to
`bun --bun ../../packages/ui/bin/build-client.ts` first when `dist/` is missing. Delete `dist/` to
build again; the build alone needs about 3 GB of memory.

> **Agent / measurement note**:
Expand Down
4 changes: 2 additions & 2 deletions services/sandbox-runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
# here — the image conformance test walks the registry.

# --- daemon build stage: bundle runnerd to a single Node-target file --------
FROM oven/bun:1 AS daemon-build
FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS daemon-build
WORKDIR /build
COPY services/sandbox-runtime/daemon/ ./
RUN bun build --target=node src/main.ts --outfile /runnerd.mjs \
&& bun build --target=node src/lazy-docker-entry.ts --outfile /lazy-docker.mjs

# Gemini's system settings must be immutable and root-owned. Derive them
# from the platform's existing harness interpreter, without a package install.
FROM oven/bun:1 AS gemini-settings-build
FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS gemini-settings-build
WORKDIR /build
COPY services/platform/lib/harnesses/ services/platform/lib/harnesses/
COPY configs/platform/system/harnesses/gemini/harness.yml configs/platform/system/harnesses/gemini/harness.yml
Expand Down
5 changes: 2 additions & 3 deletions services/sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# docker build -f services/sandbox/Dockerfile .

ARG VERSION=dev
ARG BUN_VERSION=1.3.12
ARG DOCKER_CLI_VERSION=27

# docker CLI stage — aliased so the runner stage can `COPY --from=docker-cli`
Expand All @@ -28,7 +27,7 @@ FROM docker:${DOCKER_CLI_VERSION}-cli AS docker-cli
# =============================================================================
# Stage 1: BUILDER — install full deps (incl. devDeps) for typecheck/tests
# =============================================================================
FROM oven/bun:${BUN_VERSION}-debian AS builder
FROM oven/bun:1.4.2-debian@sha256:4f6e31d1a54d6a3dd312daef655fc998101b5043d52e12592ac293ef04b9bc73 AS builder

WORKDIR /app

Expand All @@ -46,7 +45,7 @@ COPY packages/shared/src/monitoring/privacy.ts /packages/shared/src/monitoring/p
# Stage 2: RUNNER — production deps only + docker CLI for spawning siblings
# =============================================================================
# trivy:ignore:AVD-DS-0002 -- runs as root by design; needs /var/run/docker.sock
FROM oven/bun:${BUN_VERSION}-debian AS runner
FROM oven/bun:1.4.2-debian@sha256:4f6e31d1a54d6a3dd312daef655fc998101b5043d52e12592ac293ef04b9bc73 AS runner

WORKDIR /app

Expand Down
6 changes: 3 additions & 3 deletions services/ui-docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tale UI Docs Dockerfile — Vite SPA + Bun server, mirrors services/docs.
ARG VERSION=dev

FROM oven/bun:1.3.12 AS bun-bin
FROM oven/bun:1.4.2@sha256:9114c058aeae42162ee16dd5084b95fe9473970bb6bcb5b232ab1630f0546895 AS bun-bin

# ============================================================================
# Stage 1: workspace deps
Expand Down Expand Up @@ -62,7 +62,7 @@ WORKDIR /app/services/ui-docs
# server.ts (and its `@tale/ui/*` source imports) into a self-contained
# server.js — the runner stage carries no node_modules, mirroring web/docs.
RUN bun --bun scripts/build-content.ts \
&& bun --bun vite build \
&& bun --bun ../../packages/ui/bin/build-client.ts \
&& bun --bun vite build --ssr app/entry-server.tsx --outDir dist-ssr \
&& bun --bun scripts/prerender.ts \
&& bun --bun /app/packages/ui/bin/seo-compile.ts ./scripts/seo.config.ts --out dist-seo \
Expand All @@ -72,7 +72,7 @@ WORKDIR /app
# ============================================================================
# Stage 3: runtime
# ============================================================================
FROM oven/bun:1.3.12-slim AS runner
FROM oven/bun:1.4.2-slim@sha256:cb3bbbb08e13a4a2ff400f24c7a2a1d5efa83f6ef8544d52d95a519631e2fc61 AS runner

ARG LOCALE_COOKIE_DOMAIN=
# Re-declare UI_DOCS_BASE_URL here so the runner stage can promote it to ENV;
Expand Down
2 changes: 1 addition & 1 deletion services/ui-docs/content/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ For marketing components, also install `github:tale-project/tale#dist/marketing-

For a reproducible release, replace the moving branch with a published `ui-v<version>` tag and, when used, its matching `marketing-ui-v<version>` tag. `<version>` is a placeholder, not a tag to install literally. Commit the resulting lockfile. To deliberately refresh a moving Git dependency, use `bun install --force` and review the lockfile changes.

The packages' export maps point at TypeScript source. Run Vite through Bun (`bun --bun vite` and `bun --bun vite build`), as the Tale service scripts do. Use TypeScript's bundler module resolution and React JSX transform. Inside Tale-project repositories, select the appropriate shared `tsconfig` family rather than adding workspace-specific compiler options.
The packages' export maps point at TypeScript source. Run Vite through Bun (`bun --bun vite` for development and `bun --bun vite build` for a client build). In the Tale monorepo, use `bun run --filter @tale/<service> build` for the complete production build; its shared client helper waits for Vite plugins to finish before exiting. Use TypeScript's bundler module resolution and React JSX transform. Inside Tale-project repositories, select the appropriate shared `tsconfig` family rather than adding workspace-specific compiler options.

## Load Tailwind and YAML

Expand Down
Loading