From e0835e50cf72982c0fec2088fcce693830b3b401 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?=
Date: Thu, 19 Nov 2026 12:27:53 +0100
Subject: [PATCH 1/2] feat(app)!: scaffold data apps from published SDK
examples
Use the pinned @altertable/data-app-examples 0.78.0 package as the canonical
starter at build time instead of maintaining its source, guides, and tools
in the CLI repository. Keep only the frozen registry resolution locally.
Generate the development fixture from the same payload shipped in releases.
Prepare app identity with public manifest tooling and extract directory/file
scope statically before granting lakehouse access. Keep compiler and template
packages outside the runtime bundle so scaffolding remains offline. Execute
operation checks through the public SDK client and preserve app source during
package upgrades.
Verify template fidelity, frozen installs, published-package upgrades,
registered-query boundaries, browser states, npm consumption, and native
CLI previews.
BREAKING CHANGE: Local app dev and lint require a shared literal app.ts
instead of app.json. Existing projects must adapt their own declaration,
operations, and local server to SDK 0.78; package upgrade preserves source
and does not perform that source migration.
---
.gitignore | 3 +-
AGENTS.md | 4 +-
CHANGELOG.md | 2 +-
COMMANDS.md | 4 +-
DEVELOPMENT.md | 5 +-
cli-reference.json | 2 +-
cli/AGENTS.md | 2 +-
cli/bun.lock | 8 +
cli/package.json | 3 +
cli/scripts/check-data-app.ts | 46 +-
cli/scripts/package-data-app.ts | 2 +-
cli/scripts/prepare-data-app.ts | 25 +
cli/scripts/smoke-data-app.ts | 23 +-
cli/src/commands/app/create.test.ts | 43 +-
cli/src/commands/app/create.ts | 6 +-
cli/src/commands/app/index.test.ts | 28 +-
.../commands/app/lib/distribution-source.ts | 88 +++
cli/src/commands/app/lib/distribution.test.ts | 108 ++--
cli/src/commands/app/lib/distribution.ts | 100 +---
cli/src/commands/app/lib/file-dev.test.ts | 4 +-
cli/src/commands/app/lib/file-dev.ts | 73 +--
cli/src/commands/app/lib/manifest.ts | 76 +++
cli/src/commands/app/lib/package.ts | 1 +
cli/src/commands/app/lib/payload.ts | 2 +-
cli/src/commands/app/lib/project-check.js.txt | 29 +-
cli/src/commands/app/lib/scope.ts | 9 +-
cli/src/commands/app/lint.test.ts | 385 ++++--------
cli/src/commands/app/lint.ts | 32 +-
cli/src/commands/app/upgrade.test.ts | 58 +-
data-app/AGENTS.md | 11 +-
data-app/README.md | 120 ++--
data-app/file-preview/bun.lock | 32 +-
data-app/file-preview/package.json | 12 +-
data-app/starter/.gitignore | 3 -
data-app/starter/.oxfmtrc.json | 11 -
data-app/starter/.oxlintrc.json | 24 -
data-app/starter/AGENTS.md | 5 -
data-app/starter/README.md | 31 -
data-app/starter/app.json | 14 -
data-app/starter/bun.lock | 32 +-
data-app/starter/bunfig.toml | 2 -
data-app/starter/fixtures/activity.ts | 43 --
data-app/starter/fixtures/index.html | 11 -
data-app/starter/fixtures/main.tsx | 250 --------
data-app/starter/fixtures/view.html | 11 -
data-app/starter/fixtures/view.tsx | 113 ----
data-app/starter/package.json | 33 --
data-app/starter/src/App.tsx | 9 -
data-app/starter/src/assets.d.ts | 1 -
data-app/starter/src/config.ts | 19 -
data-app/starter/src/data-context.ts | 22 -
data-app/starter/src/favicon.svg | 13 -
data-app/starter/src/index.html | 14 -
data-app/starter/src/main.tsx | 7 -
data-app/starter/src/operations.ts | 7 -
data-app/starter/src/preview.ts | 26 -
data-app/starter/src/server.ts | 7 -
data-app/starter/tsconfig.json | 15 -
data-app/tests/bun.lock | 19 +-
data-app/tests/calendar.spec.ts | 49 --
data-app/tests/harness.spec.ts | 136 -----
data-app/tests/package.json | 3 +-
data-app/tests/query-results.json | 403 +++++++++++++
data-app/tests/server.ts | 102 ++--
data-app/tests/starter.spec.ts | 552 ++++--------------
data-app/tests/tsconfig.json | 1 -
package.json | 2 +-
67 files changed, 1254 insertions(+), 2082 deletions(-)
create mode 100644 cli/scripts/prepare-data-app.ts
create mode 100644 cli/src/commands/app/lib/distribution-source.ts
create mode 100644 cli/src/commands/app/lib/manifest.ts
delete mode 100644 data-app/starter/.gitignore
delete mode 100644 data-app/starter/.oxfmtrc.json
delete mode 100644 data-app/starter/.oxlintrc.json
delete mode 100644 data-app/starter/AGENTS.md
delete mode 100644 data-app/starter/README.md
delete mode 100644 data-app/starter/app.json
delete mode 100644 data-app/starter/bunfig.toml
delete mode 100644 data-app/starter/fixtures/activity.ts
delete mode 100644 data-app/starter/fixtures/index.html
delete mode 100644 data-app/starter/fixtures/main.tsx
delete mode 100644 data-app/starter/fixtures/view.html
delete mode 100644 data-app/starter/fixtures/view.tsx
delete mode 100644 data-app/starter/package.json
delete mode 100644 data-app/starter/src/App.tsx
delete mode 100644 data-app/starter/src/assets.d.ts
delete mode 100644 data-app/starter/src/config.ts
delete mode 100644 data-app/starter/src/data-context.ts
delete mode 100644 data-app/starter/src/favicon.svg
delete mode 100644 data-app/starter/src/index.html
delete mode 100644 data-app/starter/src/main.tsx
delete mode 100644 data-app/starter/src/operations.ts
delete mode 100644 data-app/starter/src/preview.ts
delete mode 100644 data-app/starter/src/server.ts
delete mode 100644 data-app/starter/tsconfig.json
delete mode 100644 data-app/tests/calendar.spec.ts
delete mode 100644 data-app/tests/harness.spec.ts
create mode 100644 data-app/tests/query-results.json
diff --git a/.gitignore b/.gitignore
index 9ede130c..ddda7cd0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ dist/
/plans/
docs/superpowers/
.superpowers/
-/data-app/starter/.altertable/
+/data-app/starter/*
+!/data-app/starter/bun.lock
/data-app/tests/test-results/
/data-app/tests/playwright-report/
diff --git a/AGENTS.md b/AGENTS.md
index 7769be60..e7aafd7e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -12,7 +12,7 @@ Altertable CLI — a TypeScript/Bun command-line tool for querying and managing
| ---------------------- | --------------------------------------------------------- |
| `cli/src/` | CLI commands, HTTP clients, formatting, config |
| `cli/src/**/*.test.ts` | Colocated Bun unit tests for CLI logic |
-| `data-app/starter/` | Runnable getting-started app copied by `app create` |
+| `data-app/starter/` | Generated SDK fixture; only `bun.lock` is versioned |
| `data-app/tests/` | Browser tests and fixtures consuming the published package |
| `tests/` | Black-box end-user CLI tests run through `bin/altertable` |
| `specs/` | Client API specs (submodule — read-only from this repo) |
@@ -38,7 +38,7 @@ bun run --cwd data-app/starter build
bun run --cwd cli data-app:test:browser
```
-The starter build requires its published package dependencies; see [data-app/README.md](data-app/README.md)
+Setup generates the starter from `@altertable/data-app-examples` and installs its dependencies; see [data-app/README.md](data-app/README.md)
for setup and browser prerequisites. Run `bun run --cwd cli data-app:check` to check all
three data app projects together. Use `bun run check --quick` after focused checks,
then default `bun run check` before opening a PR.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4499684d..622375d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,7 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
-- Generate, preview, and upgrade data apps with data-app 0.74.0.
+- Generate, preview, and upgrade data apps with data-app 0.78.0. New projects use the editable standalone example and a shared `app.ts` declaration; directory and file previews verify its scope statically. Upgrades preserve existing source and identity; older `app.json` projects require an author-owned source migration.
- Raise the default `--connect-timeout` from 5 to 30 seconds, so queries that take a few seconds to start responding no longer time out.
- Timeout errors now name the CLI flag that fired, explain that the limit is client-side (the request may still be running on the server, and slow networks can cause it), and say how to raise it.
diff --git a/COMMANDS.md b/COMMANDS.md
index 678aa3b3..ee04187f 100644
--- a/COMMANDS.md
+++ b/COMMANDS.md
@@ -422,7 +422,7 @@ altertable app create|dev|build|lint|upgrade|validate|publish|update
**Subcommands**
-- `create` — Create a local data app project with a live connection check.
+- `create` — Create a local data app project from the editable standalone example.
- `dev` — Preview a local data app directory, or a single-file data app, with lakehouse access.
- `build` — Typecheck and build a local data app without Altertable credentials.
- `lint` — Lint a local data app project: format, lint rules, types, contracts, build, and client credential boundary.
@@ -447,7 +447,7 @@ altertable app update APP-1 --file index.tsx
#### `altertable app create`
-Create a local data app project with a live connection check.
+Create a local data app project from the editable standalone example.
**Usage**
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index a2d3d97f..d85b4930 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -27,7 +27,8 @@ bun run check:package # focused build, pack, and extracted-consumer smok
```
The root is a private command entry point, not a workspace: `cli/bun.lock` and the
-starter and browser-test lockfiles remain independent. Individual commands above
+starter and browser-test lockfiles remain independent. Setup generates the starter from the
+pinned `@altertable/data-app-examples` package; only its frozen lockfile is versioned here. Individual commands above
operate on the CLI; the canonical check also covers top-level tests and the data app
consumers. Install dependencies explicitly with `bun run setup` before checking;
verification does not install development dependencies. Artifact smoke tests still
@@ -285,4 +286,4 @@ When bumping the `specs/` submodule, extend the mapped tests before merge.
## Data apps
-The runnable starter and package-consumer browser tests live in [`data-app/`](data-app/README.md). That guide covers starter embedding, npm package pins, package upgrades, and verification. Runtime development and releases belong to [the Data App repository](https://github.com/altertable-ai/data-app).
+The generated SDK starter fixture and package-consumer browser tests live in [`data-app/`](data-app/README.md). That guide covers starter embedding, npm package pins, package upgrades, and verification. Runtime development and releases belong to [the Data App repository](https://github.com/altertable-ai/data-app).
diff --git a/cli-reference.json b/cli-reference.json
index bfd434e4..15d50c78 100644
--- a/cli-reference.json
+++ b/cli-reference.json
@@ -835,7 +835,7 @@
{
"id": "altertable-app-create",
"command": "altertable app create",
- "description": "Create a local data app project with a live connection check.",
+ "description": "Create a local data app project from the editable standalone example.",
"usage": [
"altertable app create [options] "
],
diff --git a/cli/AGENTS.md b/cli/AGENTS.md
index 2353a087..77174c08 100644
--- a/cli/AGENTS.md
+++ b/cli/AGENTS.md
@@ -53,7 +53,7 @@ bun test "$PWD"/tests/integration.e2e.ts
## Conventions
-- For generated app authoring, edit [the starter app guide](../data-app/starter/AGENTS.md). Keep it a task router into focused authoring guides and the installed package docs. Types describe props; reserve JSDoc for constraints, ownership, security boundaries, and surprising behavior.
+- The generated starter and its authoring guides come from the pinned `@altertable/data-app-examples` package. Change examples in the SDK repository; this CLI owns distribution, identity injection, the frozen lockfile, and integration tests. See [data app integration](../data-app/README.md).
- Runtime contracts and UI components are maintained in [the Data App repository](https://github.com/altertable-ai/data-app). This repository owns the starter and its integration with CLI commands.
- Declare and export each command immediately after its imports; keep supporting helpers and types below it.
diff --git a/cli/bun.lock b/cli/bun.lock
index 018658d7..fea442d6 100644
--- a/cli/bun.lock
+++ b/cli/bun.lock
@@ -10,6 +10,8 @@
"yaml": "2.9.0",
},
"devDependencies": {
+ "@altertable/data-app-examples": "0.78.0",
+ "@altertable/data-app-manifest": "0.78.0",
"@types/bun": "1.4.3",
"eslint-plugin-no-relative-import-paths": "1.6.1",
"knip": "6.32.2",
@@ -23,6 +25,10 @@
},
},
"packages": {
+ "@altertable/data-app-examples": ["@altertable/data-app-examples@0.78.0", "", {}, "sha512-6mFLF0W+N/n1i448ZCJks3iytDN2e7RgnyYk9JOxpTHPgYeT7zvY30/GxeeOdS4N5nTr5paItoc6ZWxpoL6sjQ=="],
+
+ "@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.78.0", "", { "dependencies": { "typescript": "5.9.3" } }, "sha512-uX7JmnPwbRstseMo80K98h5c5KIsnJKabCAPlueJ+P34rUvMdUFuc696hp/W1cNl81vDXd3eETNpoQnQLZ73XQ=="],
+
"@babel/code-frame": ["@babel/code-frame@7.29.7", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="],
"@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.29.7", "", {}, "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg=="],
@@ -375,6 +381,8 @@
"zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
+ "@altertable/data-app-manifest/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
+
"tinyglobby/picomatch": ["picomatch@4.0.4", "", {}, "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A=="],
}
}
diff --git a/cli/package.json b/cli/package.json
index 78715fc8..6950b56a 100644
--- a/cli/package.json
+++ b/cli/package.json
@@ -44,6 +44,7 @@
"pack:check": "bun run build && bun run scripts/check-package.ts",
"knip": "knip --no-config-hints",
"knip:production": "knip --production --no-config-hints",
+ "data-app:prepare": "bun run scripts/prepare-data-app.ts",
"data-app:check": "bun run scripts/check-data-app.ts",
"data-app:test:browser": "cd ../data-app/tests && bun run test",
"test:watch": "bun test --watch"
@@ -54,6 +55,8 @@
"yaml": "2.9.0"
},
"devDependencies": {
+ "@altertable/data-app-examples": "0.78.0",
+ "@altertable/data-app-manifest": "0.78.0",
"@types/bun": "1.4.3",
"eslint-plugin-no-relative-import-paths": "1.6.1",
"knip": "6.32.2",
diff --git a/cli/scripts/check-data-app.ts b/cli/scripts/check-data-app.ts
index 1f24152c..af96dbb9 100644
--- a/cli/scripts/check-data-app.ts
+++ b/cli/scripts/check-data-app.ts
@@ -1,19 +1,35 @@
-import { join } from 'node:path';
+import { cp, mkdtemp, rm, symlink } from 'node:fs/promises';
+import { tmpdir } from 'node:os';
+import { basename, join } from 'node:path';
-import { dataAppDirectory } from '@/commands/app/lib/distribution.ts';
+import { dataAppDirectory } from '@/commands/app/lib/distribution-source.ts';
-for (const project of ['starter', 'tests']) {
- const commands = [
- ...['typecheck', 'lint', 'format:check'].map(name => ['run', name]),
- ...(project === 'starter' ? [['run', 'build']] : []),
- ];
- for (const args of commands) {
- const child = Bun.spawn([process.execPath, ...args], {
- cwd: join(dataAppDirectory, project),
- stdout: 'inherit',
- stderr: 'inherit',
- });
- if (await child.exited)
- throw new Error(`${project}: bun ${args.join(' ')} failed`);
+// Check outside the checkout so formatters inspect the Git-ignored generated source too.
+const fixture = await mkdtemp(join(tmpdir(), 'data-app-check-'));
+try {
+ const starter = join(dataAppDirectory, 'starter');
+ await cp(starter, fixture, {
+ recursive: true,
+ filter: path =>
+ !['node_modules', 'dist', '.altertable'].includes(basename(path)) &&
+ !basename(path).startsWith('.env'),
+ });
+ await symlink(join(starter, 'node_modules'), join(fixture, 'node_modules'));
+ for (const project of [fixture, join(dataAppDirectory, 'tests')]) {
+ const commands = [
+ ...['typecheck', 'lint', 'format:check'].map(name => ['run', name]),
+ ...(project === fixture ? [['run', 'build']] : []),
+ ];
+ for (const args of commands) {
+ const child = Bun.spawn([process.execPath, ...args], {
+ cwd: project,
+ stdout: 'inherit',
+ stderr: 'inherit',
+ });
+ if (await child.exited)
+ throw new Error(`${project}: bun ${args.join(' ')} failed`);
+ }
}
+} finally {
+ await rm(fixture, { recursive: true, force: true });
}
diff --git a/cli/scripts/package-data-app.ts b/cli/scripts/package-data-app.ts
index 859aac53..85d1d9fd 100644
--- a/cli/scripts/package-data-app.ts
+++ b/cli/scripts/package-data-app.ts
@@ -1,6 +1,6 @@
import type { BunPlugin } from 'bun';
-import { readDataAppPayload } from '@/commands/app/lib/distribution.ts';
+import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
/** Both npm and native releases embed the same deterministic project templates. */
export function dataAppPlugin(): BunPlugin {
diff --git a/cli/scripts/prepare-data-app.ts b/cli/scripts/prepare-data-app.ts
new file mode 100644
index 00000000..6457bfea
--- /dev/null
+++ b/cli/scripts/prepare-data-app.ts
@@ -0,0 +1,25 @@
+import { mkdir, readdir, rm, writeFile } from 'node:fs/promises';
+import { dirname, join } from 'node:path';
+
+import {
+ dataAppDirectory,
+ readDataAppPayload,
+} from '@/commands/app/lib/distribution-source.ts';
+import { createAppFiles } from '@/commands/app/lib/distribution.ts';
+
+// This disposable project is the same scaffold shipped in the CLI, not another source template.
+const files = createAppFiles(await readDataAppPayload(), {
+ name: 'data-app-starter',
+ title: 'CLI scaffold test',
+ scope: { organization: 'Acme', environment: 'production' },
+});
+const directory = join(dataAppDirectory, 'starter');
+for (const name of await readdir(directory)) {
+ if (name === 'bun.lock' || name === 'node_modules' || name.startsWith('.env'))
+ continue;
+ await rm(join(directory, name), { recursive: true, force: true });
+}
+for (const [name, content] of Object.entries(files)) {
+ await mkdir(dirname(join(directory, name)), { recursive: true });
+ await writeFile(join(directory, name), content);
+}
diff --git a/cli/scripts/smoke-data-app.ts b/cli/scripts/smoke-data-app.ts
index 053120ae..be9994e9 100644
--- a/cli/scripts/smoke-data-app.ts
+++ b/cli/scripts/smoke-data-app.ts
@@ -2,6 +2,8 @@ import { mkdtemp, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
+import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
+
/** Exercise the shipped CLI outside the checkout, including its embedded starter and published runtime. */
export async function smokeDataApp(
command: string[],
@@ -105,13 +107,15 @@ export async function smokeDataApp(
throw new Error('File preview did not bundle the app.');
}
const query = await fetch(
- `${url}${singleFile ? '/api/sql' : '/api/data/connection'}`,
+ `${url}${singleFile ? '/api/query' : '/api/query/totalCost'}`,
{
signal: AbortSignal.timeout(5000),
method: 'POST',
headers: { origin: url, 'content-type': 'application/json' },
body: JSON.stringify(
- singleFile ? { statement: 'select 1', limit: 1, params: {} } : {}
+ singleFile
+ ? { queryId: 'connection', limit: 1, params: {} }
+ : { limit: 1, params: { month: '2026-09', customerName: '' } }
),
}
);
@@ -120,7 +124,7 @@ export async function smokeDataApp(
rows?: unknown[][];
data?: unknown;
};
- if (singleFile ? result.rows?.[0]?.[0] !== 1 : result.data !== true)
+ if (result.rows?.[0]?.[0] !== (singleFile ? 1 : 1320000))
throw new Error('Preview did not return the lakehouse query result.');
} catch (error) {
failure = error;
@@ -170,7 +174,7 @@ export async function smokeDataApp(
'@altertable/data-app-react',
'@altertable/data-app-bun',
]) {
- if (manifest.dependencies?.[name] !== '0.74.0')
+ if (manifest.dependencies?.[name] !== recommendedDataAppVersion())
throw new Error(
`Packaged starter must pin ${name} to the tested release`
);
@@ -188,14 +192,17 @@ export async function smokeDataApp(
upstream = Bun.serve({
hostname: '127.0.0.1',
port: 0,
- fetch(request) {
+ async fetch(request) {
if (
request.headers.get('authorization') !==
`Basic ${Buffer.from('preview-user:preview-smoke-secret').toString('base64')}`
)
return new Response('Unauthorized', { status: 401 });
+ const { statement } = (await request.json()) as { statement: string };
return new Response(
- '{"query_id":"smoke"}\n[{"name":"connection_check","type":"INTEGER"}]\n[1]',
+ statement === 'SELECT 1 AS connection_check'
+ ? '{"query_id":"smoke"}\n[{"name":"connection_check","type":"INTEGER"}]\n[1]'
+ : '{"query_id":"smoke"}\n[{"name":"cost_cents","type":"BIGINT"},{"name":"customer_count","type":"BIGINT"}]\n[1320000,3]',
{
headers: { 'content-type': 'application/x-ndjson' },
}
@@ -215,7 +222,7 @@ export async function smokeDataApp(
[
process.execPath,
'-e',
- 'import { createDataHandler } from "@altertable/data-app/server"; import { localLakehouse } from "@altertable/data-app-bun"; if (typeof createDataHandler !== "function" || typeof localLakehouse !== "function") process.exit(1);',
+ 'import { createDataClient } from "@altertable/data-app/client"; import { serveLocalApp } from "@altertable/data-app-bun"; if (typeof createDataClient !== "function" || typeof serveLocalApp !== "function") process.exit(1);',
],
app
);
@@ -225,7 +232,7 @@ export async function smokeDataApp(
join(app, 'index.tsx'),
`import { defineDataApp as declareApp } from "@altertable/data-app";
import { mountDataApp } from "@altertable/data-app-react";
-const app = declareApp({ title: "File preview smoke", description: "Smoke test", scope: { organization: "Test", environment: "test" }, queries: {} });
+const app = declareApp({ title: "File preview smoke", description: "Smoke test", scope: { organization: "Test", environment: "test" }, queries: { connection: { statement: "SELECT 1 AS connection_check", params: {}, projections: { connection_check: { type: "number" } } } } });
function View() { return File preview smoke
; }
mountDataApp({ app, component: View });`
);
diff --git a/cli/src/commands/app/create.test.ts b/cli/src/commands/app/create.test.ts
index bd1ca97b..ab7e2be2 100644
--- a/cli/src/commands/app/create.test.ts
+++ b/cli/src/commands/app/create.test.ts
@@ -9,7 +9,9 @@ import {
import { tmpdir } from 'node:os';
import { join, posix } from 'node:path';
-import { readDataAppPayload } from '@/commands/app/lib/distribution.ts';
+import { extractDataAppManifest } from '@altertable/data-app-manifest';
+
+import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
import {
configSet,
@@ -37,7 +39,7 @@ afterEach(() => {
else process.env.ALTERTABLE_CONFIG_HOME = previousConfigHome;
if (previousProfile === undefined) delete process.env.ALTERTABLE_PROFILE;
else process.env.ALTERTABLE_PROFILE = previousProfile;
-});
+}, 30_000);
describe('app create', () => {
test('scaffolds a pinned package project without registry access', async () => {
@@ -61,7 +63,7 @@ describe('app create', () => {
},
scopeSource: 'placeholder',
nextSteps: [
- 'Set organization and environment in app.json.',
+ 'Set organization and environment in app.ts.',
'Select a matching profile, or configure one with `altertable login --org --env `.',
'altertable app dev',
'altertable app lint --lakehouse',
@@ -74,14 +76,15 @@ describe('app create', () => {
name: 'product-pulse',
scripts: {
typecheck: 'tsc --noEmit',
- lint: 'oxlint --type-aware src',
- format: 'oxfmt src',
- 'format:check': 'oxfmt --check src',
+ lint: 'oxlint --type-aware src app.ts',
+ format: 'oxfmt src app.ts',
+ 'format:check': 'oxfmt --check src app.ts',
dev: 'bun --hot src/server.ts',
},
});
expect(
- JSON.parse(readFileSync(join(directory, 'app.json'), 'utf8'))
+ extractDataAppManifest(readFileSync(join(directory, 'app.ts'), 'utf8'))
+ .manifest!
).toMatchObject({
title: 'Product Pulse',
scope: {
@@ -102,14 +105,8 @@ describe('app create', () => {
expect(paths).toContain('src/App.tsx');
expect(paths).toContain('.oxlintrc.json');
expect(readFileSync(join(directory, 'AGENTS.md'), 'utf8')).toContain(
- 'https://github.com/altertable-ai/data-app/blob/main/examples/starter-local-data-app/AGENTS.md'
- );
- expect(readFileSync(join(directory, 'src/App.tsx'), 'utf8')).toContain(
- 'Connectivity-only screen'
+ 'https://github.com/altertable-ai/data-app/blob/v0.78.0/docs/app-authoring.md'
);
- expect(
- readFileSync(join(directory, 'src/operations.ts'), 'utf8')
- ).toContain('supplies no analytical result');
expect(
paths.some(path => /tests|fixtures|node_modules|\.txt$/.test(path))
).toBe(false);
@@ -162,7 +159,8 @@ describe('app create', () => {
],
});
expect(
- JSON.parse(readFileSync(join(directory, 'app.json'), 'utf8'))
+ extractDataAppManifest(readFileSync(join(directory, 'app.ts'), 'utf8'))
+ .manifest!
).toMatchObject({
scope: { organization: 'Altertable', environment: 'production' },
});
@@ -193,13 +191,14 @@ describe('app create', () => {
profile: 'current',
});
expect(
- JSON.parse(readFileSync(join(directory, 'app.json'), 'utf8')).scope
+ extractDataAppManifest(readFileSync(join(directory, 'app.ts'), 'utf8'))
+ .manifest!.scope
).toEqual({
organization: 'Cousteau',
environment: 'production',
});
expect(readFileSync(join(directory, 'src/main.tsx'), 'utf8')).toContain(
- 'mountDataApp({ app, component: App })'
+ 'mountDataApp({ app: dataApp, component: App })'
);
expect(readFileSync(join(directory, 'src/App.tsx'), 'utf8')).not.toContain(
'{{APP_TITLE}}'
@@ -269,9 +268,9 @@ describe('app create', () => {
expect(result.exitCode).toBe(0);
expect(
- JSON.parse(readFileSync(join(directory, 'app.json'), 'utf8')).scope
- .organization
- ).toBe('Acme "North" & Co');
+ extractDataAppManifest(readFileSync(join(directory, 'app.ts'), 'utf8'))
+ .manifest!.scope
+ ).toMatchObject({ organization: 'Acme "North" & Co' });
expect(readFileSync(join(directory, 'src/index.html'), 'utf8')).toContain(
'Altertable app'
);
@@ -412,7 +411,7 @@ describe('app create', () => {
expect(new TextDecoder().decode(relativeImportLint.stdout)).toContain(
'eslint(no-restricted-imports)'
);
- });
+ }, 60_000);
test('never overwrites an existing directory', async () => {
const directory = join(home, 'existing');
@@ -467,7 +466,7 @@ describe('app create', () => {
{ debug: false, json: false, agent: false }
);
expect(result.stdout.join('\n')).toContain(
- 'set the organization and environment in app.json'
+ 'set the organization and environment in app.ts'
);
expect(result.stdout.join('\n')).toContain('`altertable app build`');
expect(result.stdout.join('\n')).not.toContain('run altertable app dev.');
diff --git a/cli/src/commands/app/create.ts b/cli/src/commands/app/create.ts
index 15e69a3c..6f3565fa 100644
--- a/cli/src/commands/app/create.ts
+++ b/cli/src/commands/app/create.ts
@@ -12,7 +12,7 @@ export const appCreateCommand = defineCommand({
metadata: {
name: 'create',
description:
- 'Create a local data app project with a live connection check.',
+ 'Create a local data app project from the editable standalone example.',
examples: [
'altertable app create product-pulse',
'altertable app create product-pulse --dir ./apps/product-pulse',
@@ -122,7 +122,7 @@ export const appCreateCommand = defineCommand({
command => `altertable --profile ${profileName} ${command}`
)
: [
- 'Set organization and environment in app.json.',
+ 'Set organization and environment in app.ts.',
'Select a matching profile, or configure one with `altertable login --org --env `.',
'altertable app dev',
'altertable app lint --lakehouse',
@@ -144,7 +144,7 @@ export const appCreateCommand = defineCommand({
);
else
sink.writeHuman(
- `Created ${title} in ${directory} with placeholder scope.\nBefore previewing, set the organization and environment in app.json and select a matching profile (or run \`altertable login --org --env \`).\nYou can run \`altertable app build\` from that directory now.`
+ `Created ${title} in ${directory} with placeholder scope.\nBefore previewing, set the organization and environment in app.ts and select a matching profile (or run \`altertable login --org --env \`).\nYou can run \`altertable app build\` from that directory now.`
);
},
});
diff --git a/cli/src/commands/app/index.test.ts b/cli/src/commands/app/index.test.ts
index c3fdb7d3..97a9ffb9 100644
--- a/cli/src/commands/app/index.test.ts
+++ b/cli/src/commands/app/index.test.ts
@@ -11,19 +11,19 @@ import {
let workspace: LakehouseTestWorkspace;
let directory: string;
let previousEnvironment: string | undefined;
+let previousConfigHome: string | undefined;
beforeEach(() => {
workspace = createLakehouseTestWorkspace('app-command');
+ previousConfigHome = process.env.ALTERTABLE_CONFIG_HOME;
+ process.env.ALTERTABLE_CONFIG_HOME = workspace.home;
previousEnvironment = process.env.ALTERTABLE_ENV;
process.env.ALTERTABLE_ENV = 'production';
directory = workspace.createDirectory('app');
workspace.writeFile(
- 'app/app.json',
- JSON.stringify({
- schemaVersion: 1,
- title: 'Test',
- scope: { organization: 'acme', environment: 'production' },
- })
+ 'app/app.ts',
+ `import { defineDataApp } from '@altertable/data-app';
+export const dataApp = defineDataApp({ title: 'Test', scope: { organization: 'acme', environment: 'production' }, queries: {} });`
);
workspace.writeFile(
'app/package.json',
@@ -55,9 +55,12 @@ afterEach(() => {
delete process.env.ALTERTABLE_BASIC_AUTH_TOKEN;
delete process.env.ALTERTABLE_API_KEY;
workspace.cleanup();
+ if (previousConfigHome === undefined)
+ delete process.env.ALTERTABLE_CONFIG_HOME;
+ else process.env.ALTERTABLE_CONFIG_HOME = previousConfigHome;
if (previousEnvironment === undefined) delete process.env.ALTERTABLE_ENV;
else process.env.ALTERTABLE_ENV = previousEnvironment;
-});
+}, 30_000);
function captured(
script: 'typecheck' | 'dev' | 'build'
@@ -76,10 +79,9 @@ function runAppCommand(args: string[]) {
describe('app commands', () => {
test('dev rejects a mismatched scope before launching the app', async () => {
workspace.writeFile(
- 'app/app.json',
- JSON.stringify({
- scope: { organization: 'acme', environment: 'staging' },
- })
+ 'app/app.ts',
+ `import { defineDataApp } from '@altertable/data-app';
+defineDataApp({ title: 'Test', scope: { organization: 'acme', environment: 'staging' }, queries: {} });`
);
const error = await runAppCommand(['app', 'dev', '--dir', directory]).catch(
(error: unknown) => error
@@ -219,7 +221,7 @@ describe('app commands', () => {
const file = workspace.writeFile(
'index.tsx',
`import { defineDataApp } from "@altertable/data-app";
-defineDataApp({ scope: { organization: "acme", environment: "staging" } });`
+defineDataApp({ title: "Test", scope: { organization: "acme", environment: "staging" } });`
);
async function failure(args: string[]): Promise {
return runAppCommand(['app', 'dev', ...args]).catch(
@@ -245,5 +247,5 @@ defineDataApp({ scope: { organization: "acme", environment: "staging" } });`
expect(await failure(['--file', directory])).toMatchObject(
message('Could not read source')
);
- });
+ }, 30_000);
});
diff --git a/cli/src/commands/app/lib/distribution-source.ts b/cli/src/commands/app/lib/distribution-source.ts
new file mode 100644
index 00000000..86523762
--- /dev/null
+++ b/cli/src/commands/app/lib/distribution-source.ts
@@ -0,0 +1,88 @@
+import { lstat, readdir, readFile } from 'node:fs/promises';
+import { join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+import { getExampleDirectory } from '@altertable/data-app-examples';
+import {
+ extractDataAppManifest,
+ overrideDataAppManifest,
+} from '@altertable/data-app-manifest';
+
+import type { DataAppPayload } from '@/commands/app/lib/distribution.ts';
+
+export const dataAppDirectory = fileURLToPath(
+ new URL('../../../../../data-app/', import.meta.url)
+);
+function assertRelativePath(path: string): void {
+ if (
+ path.includes('\\') ||
+ path.split('/').some(part => !part || part === '.' || part === '..')
+ ) {
+ throw new Error(`Invalid distribution path: ${path}`);
+ }
+}
+
+/** Expand explicit package entries, rejecting symlinks and test/build artifacts. */
+async function readFiles(
+ directory: string,
+ entries: readonly string[]
+): Promise> {
+ const files: Record = {};
+ async function visit(name: string): Promise {
+ assertRelativePath(name);
+ if (
+ /(^|\/)(node_modules|tests?|fixtures|dist)(\/|$)|\.(test|spec)\./.test(
+ name
+ )
+ ) {
+ throw new Error(`Development artifact in distribution: ${name}`);
+ }
+ const path = join(directory, name);
+ const info = await lstat(path);
+ if (info.isSymbolicLink())
+ throw new Error(`Symlink in distribution: ${name}`);
+ if (info.isDirectory()) {
+ for (const child of (await readdir(path)).sort())
+ await visit(`${name}/${child}`);
+ } else if (info.isFile()) {
+ files[name === '_gitignore' ? '.gitignore' : name] = await readFile(
+ path,
+ 'utf8'
+ );
+ } else throw new Error(`Unsupported distribution file: ${name}`);
+ }
+ for (const entry of [...entries].sort()) await visit(entry);
+ return files;
+}
+
+/** Embed project files; runtime packages are installed from npm. */
+export async function readDataAppPayload(): Promise {
+ const example = getExampleDirectory('starter-local-data-app');
+ const starter = await readFiles(example, await readdir(example));
+ starter['bun.lock'] = await readFile(
+ join(dataAppDirectory, 'starter/bun.lock'),
+ 'utf8'
+ );
+ const { manifest } = extractDataAppManifest(starter['app.ts']!);
+ if (!manifest) throw new Error('Starter needs a literal app.ts declaration.');
+ const template = overrideDataAppManifest(starter['app.ts']!, {
+ ...manifest,
+ title: '__APP_TITLE__',
+ scope: {
+ organization: '__APP_ORGANIZATION__',
+ environment: '__APP_ENVIRONMENT__',
+ },
+ });
+ if (!template.source)
+ throw new Error('Cannot prepare the starter identity template.');
+ starter['app.ts'] = template.source;
+ return {
+ starter,
+ filePreview: await readFiles(join(dataAppDirectory, 'file-preview'), [
+ 'package.json',
+ 'bun.lock',
+ 'bunfig.toml',
+ 'extract-manifest.js',
+ ]),
+ };
+}
diff --git a/cli/src/commands/app/lib/distribution.test.ts b/cli/src/commands/app/lib/distribution.test.ts
index 0b28deb9..ef14b406 100644
--- a/cli/src/commands/app/lib/distribution.test.ts
+++ b/cli/src/commands/app/lib/distribution.test.ts
@@ -1,25 +1,13 @@
-import { afterEach, expect, test } from 'bun:test';
-import { rejects } from 'node:assert/strict';
-import { cp, mkdtemp, rm, symlink, writeFile } from 'node:fs/promises';
-import { tmpdir } from 'node:os';
+import { expect, test } from 'bun:test';
+import { readFile, readdir } from 'node:fs/promises';
import { join, posix } from 'node:path';
-import {
- createAppFiles,
- dataAppDirectory,
- readDataAppPayload,
- starterFiles,
-} from '@/commands/app/lib/distribution.ts';
-import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
+import { getExampleDirectory } from '@altertable/data-app-examples';
+import { extractDataAppManifest } from '@altertable/data-app-manifest';
-const directories: string[] = [];
-afterEach(async () => {
- await Promise.all(
- directories
- .splice(0)
- .map(path => rm(path, { recursive: true, force: true }))
- );
-});
+import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
+import { createAppFiles } from '@/commands/app/lib/distribution.ts';
+import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
test('distribution embeds a deterministic starter with an exact package pin and no runtime', async () => {
const payload = await readDataAppPayload();
@@ -44,14 +32,14 @@ test('distribution embeds a deterministic starter with an exact package pin and
}
const identity = {
name: 'example',
- title: 'A "quoted" title',
+ title: `A 'quoted' title $& __APP_ORGANIZATION__ \\n`,
scope: {
organization: ''
- );
- writeFileSync(
- join(directory, 'src/main.ts'),
- 'import { operations } from "./operations.ts"; console.log(operations);'
- );
- const boundaryError = await checkAppProject(directory).catch(
- (error: unknown) => error
- );
- expect(boundaryError).toMatchObject({
- message: 'Data app validation failed.',
- });
- writeFileSync(
- join(directory, 'src/main.ts'),
- 'import type { operations } from "./operations.ts"; const name: keyof typeof operations = "totals"; console.log(name);'
- );
+test('checks real published operations and their input parsers', async () => {
await checkAppProject(directory);
-});
-
-test('lakehouse checks execute every declared input through public package exports', async () => {
- mkdirSync(join(directory, 'src'));
- mkdirSync(join(directory, 'node_modules/@altertable/data-app/dist/core'), {
- recursive: true,
- });
- mkdirSync(join(directory, 'node_modules/@altertable/data-app/dist/server'), {
- recursive: true,
- });
- writeFileSync(
- join(directory, 'app.json'),
- JSON.stringify({ schemaVersion: 1, title: 'Live check' })
- );
- writeFileSync(
- join(
- directory,
- 'node_modules/@altertable/data-app/dist/core/appearance.js'
- ),
- 'export function parseAppearance() {}'
- );
- writeFileSync(
- join(directory, 'node_modules/@altertable/data-app-bun/dist/index.js'),
- 'export function localLakehouse() { return {}; }'
- );
- writeFileSync(
- join(directory, 'node_modules/@altertable/data-app/dist/server/index.js'),
- `
- export function createDataHandler(operations) {
- return async (request) => {
- const input = await request.json();
- await operations.totals.run({}, input);
- return new Response("ok");
- };
- }
- `
- );
- writeFileSync(
+ await writeFile(
join(directory, 'src/operations.ts'),
- `
- import { appendFileSync } from "node:fs";
- export const operations = { totals: {
- checks: [{ day: 1 }, { day: 2 }], input: (value) => value,
- policy: { maxQueryRows: 1, maxDurationMs: 1000 },
- async run(context, input) { appendFileSync("executed.txt", String(input.day)); return input; },
- } };
- `
+ 'export const operations = { totals: { checks: [{}], input: v => v, run: async () => ({}), policy: { maxQueryRows: 0, maxDurationMs: 0 } } };'
+ );
+ expect(checkAppProject(directory)).rejects.toThrow(
+ 'Data app validation failed.'
);
- await checkAppProject(directory);
- expect(Bun.file(join(directory, 'executed.txt')).size).toBe(0);
- await checkAppProject(directory, {});
- expect(readFileSync(join(directory, 'executed.txt'), 'utf8')).toBe('12');
});
test.each([
'@altertable/data-app/server',
'@altertable/data-app-bun',
'@altertable/data-app-bun/preview',
- '@altertable/data-app-bun/reload',
- '@altertable/data-app-worker',
-])(
- 'browser bundles reject the published %s entry even without credential strings',
- async entry => {
- mkdirSync(join(directory, 'src'));
- writeFileSync(
- join(directory, 'app.json'),
- JSON.stringify({ schemaVersion: 1, title: 'Boundary' })
- );
- writeFileSync(
- join(
- directory,
- 'node_modules/@altertable/data-app/dist/core/appearance.js'
- ),
- 'export function parseAppearance() {}'
- );
- writeFileSync(
- join(directory, 'node_modules/@altertable/data-app/dist/server/index.js'),
- 'export const secretFreeHandler = 1;'
+])('browser code rejects server transport %s', async entry => {
+ await writeFile(
+ join(directory, 'src/main.tsx'),
+ `import * as transport from "${entry}"; console.log(transport);`
+ );
+ expect(checkAppProject(directory)).rejects.toThrow(
+ 'Data app validation failed.'
+ );
+});
+
+test('scans nested client chunks for references and credentials, excluding the server bundle', async () => {
+ await mkdir(join(directory, 'dist/chunks'), { recursive: true });
+ await writeFile(join(directory, 'dist/index.html'), '');
+ await writeFile(join(directory, 'dist/index-test.js'), 'console.log("safe")');
+ const chunk = join(directory, 'dist/chunks/report.js');
+ await writeFile(chunk, 'console.log("ALTERTABLE_LAKEHOUSE_PASSWORD")');
+ expect(checkClientBundle(directory)).rejects.toThrow('chunks/report.js');
+ await writeFile(chunk, 'console.log("secret-fixture-value")');
+ expect(
+ checkClientBundle(directory, ['secret-fixture-value'])
+ ).rejects.toThrow('chunks/report.js');
+ await writeFile(chunk, 'console.log("safe")');
+ await writeFile(
+ join(directory, 'dist/server.js'),
+ 'console.log("ALTERTABLE_LAKEHOUSE_PASSWORD")'
+ );
+ await checkClientBundle(directory);
+});
+
+test('lakehouse checks execute each input through the published operation client', async () => {
+ const days: number[] = [];
+ const lakehouse = Bun.serve({
+ hostname: '127.0.0.1',
+ port: 0,
+ async fetch(request) {
+ const { statement, params } = (await request.json()) as {
+ statement: string;
+ params: { day: number };
+ };
+ expect(statement).toBe('SELECT $day AS day');
+ days.push(params.day);
+ return new Response(
+ `{"query_id":"check-${params.day}"}\n[{"name":"day","type":"INTEGER"}]\n[${params.day}]\n`
+ );
+ },
+ });
+ try {
+ await writeFile(
+ join(directory, 'app.ts'),
+ `import { defineDataApp } from '@altertable/data-app';
+export const dataApp = defineDataApp({ title: 'Existing app', scope: { organization: 'test', environment: 'test' }, queries: { daily: { statement: 'SELECT $day AS day', params: { day: { type: 'number' } }, projections: { day: { type: 'number' } } } } });`
);
- writeFileSync(
- join(directory, 'node_modules/@altertable/data-app-bun/dist/index.js'),
- 'export const secretFreeHandler = 1;'
+ await writeFile(
+ join(directory, 'src/main.tsx'),
+ 'console.log("Fixture client");'
);
- writeFileSync(
+ await writeFile(
join(directory, 'src/operations.ts'),
- 'export const operations = { test: { checks: [{}], input: v => v, run: async () => ({}), policy: { maxQueryRows: 1, maxDurationMs: 1000 } } };'
- );
- writeFileSync(
- join(directory, 'src/index.html'),
- ''
- );
- writeFileSync(
- join(directory, 'src/main.ts'),
- `import { secretFreeHandler } from "${entry}"; console.log(secretFreeHandler);`
- );
- expect(checkAppProject(directory)).rejects.toThrow(
- 'Data app validation failed.'
- );
- writeFileSync(
- join(directory, 'src/main.ts'),
- `import type { secretFreeHandler } from "${entry}"; console.log("browser safe");`
+ `import { dataApp } from '#config';
+export const operations = dataApp.defineOperations({ daily: dataApp.defineOperation({
+ policy: { maxQueryRows: 1, maxDurationMs: 1000 }, checks: [{ day: 1 }, { day: 2 }],
+ input(value) { if (typeof value?.day !== 'number') throw new Error('Invalid day'); return value; },
+ async run({ query }, input) { return (await query('daily', { day: input.day })).rows; },
+}) });`
);
await checkAppProject(directory);
+ expect(days).toEqual([]);
+ await checkAppProject(directory, {
+ ALTERTABLE_API_BASE: lakehouse.url.origin,
+ ALTERTABLE_LAKEHOUSE_USERNAME: 'fixture',
+ ALTERTABLE_LAKEHOUSE_PASSWORD: 'fixture',
+ });
+ expect(days).toEqual([1, 2]);
+ } finally {
+ await lakehouse.stop(true);
}
-);
+});
diff --git a/cli/src/commands/app/lint.ts b/cli/src/commands/app/lint.ts
index 0e6df8e3..5c2def14 100644
--- a/cli/src/commands/app/lint.ts
+++ b/cli/src/commands/app/lint.ts
@@ -1,6 +1,10 @@
import { readFile, readdir } from 'node:fs/promises';
import { join } from 'node:path';
+import {
+ extractAppManifest,
+ type AppManifest,
+} from '@/commands/app/lib/manifest.ts';
import { requirePublishedDataApp } from '@/commands/app/lib/package.ts';
import projectCheckScript from '@/commands/app/lib/project-check.js.txt';
import {
@@ -17,12 +21,6 @@ import { copyProcessEnv } from '@/lib/env.ts';
import { ConfigurationError, EXIT_GENERIC } from '@/lib/errors.ts';
import { configureVerify } from '@/lib/profile-status.ts';
-type AppManifest = {
- schemaVersion: 1;
- title: string;
- appearance?: unknown;
-};
-
export const appLintCommand = defineCommand({
metadata: {
name: 'lint',
@@ -87,26 +85,16 @@ export const appLintCommand = defineCommand({
});
export async function readManifest(directory: string): Promise {
- let value: unknown;
try {
- value = JSON.parse(await readFile(join(directory, 'app.json'), 'utf8'));
- } catch {
+ return await extractAppManifest(
+ await readFile(join(directory, 'app.ts'), 'utf8')
+ );
+ } catch (error) {
throw new ConfigurationError(
- `Cannot read a valid app.json in ${directory}.`
+ `Cannot read a valid app.ts in ${directory}.`,
+ { cause: error }
);
}
- if (
- typeof value !== 'object' ||
- value === null ||
- !('schemaVersion' in value) ||
- value.schemaVersion !== 1 ||
- !('title' in value) ||
- typeof value.title !== 'string' ||
- !value.title.trim()
- ) {
- throw new ConfigurationError('app.json needs schemaVersion 1 and a title.');
- }
- return value as AppManifest;
}
/** Validate app-owned modules in Bun, outside the compiled CLI's module graph. */
diff --git a/cli/src/commands/app/upgrade.test.ts b/cli/src/commands/app/upgrade.test.ts
index c48944b3..64090fcb 100644
--- a/cli/src/commands/app/upgrade.test.ts
+++ b/cli/src/commands/app/upgrade.test.ts
@@ -3,10 +3,8 @@ import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
-import {
- createAppFiles,
- readDataAppPayload,
-} from '@/commands/app/lib/distribution.ts';
+import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
+import { createAppFiles } from '@/commands/app/lib/distribution.ts';
import {
dataAppPackage,
dataAppPackages,
@@ -22,7 +20,7 @@ afterEach(async () => {
.splice(0)
.map(path => rm(path, { recursive: true, force: true }))
);
-});
+}, 30_000);
async function fixture() {
const directory = await mkdtemp(join(tmpdir(), 'package-upgrade-'));
@@ -41,7 +39,7 @@ async function fixture() {
async function snapshot(directory: string) {
return Promise.all(
- ['package.json', 'bun.lock', 'src/App.tsx'].map(name =>
+ ['package.json', 'bun.lock', 'src/App.tsx', 'app.ts'].map(name =>
readFile(join(directory, name), 'utf8')
)
);
@@ -149,7 +147,7 @@ test('missing peers use starter defaults while preserving custom scripts', async
expect(
JSON.parse(await readFile(join(directory, 'package.json'), 'utf8'))
).toMatchObject({
- dependencies: { 'react-dom': '19.3.0' },
+ dependencies: { 'react-dom': '19.3.1' },
scripts: { custom: 'echo user-owned' },
});
});
@@ -363,3 +361,49 @@ test('portable-only upgrades do not add React or local-server packages', async (
[dataAppPackage]: recommendedDataAppVersion(),
});
});
+
+test('upgrades a published 0.77 app without replacing its identity or custom UI', async () => {
+ const directory = await fixture();
+ const appSource = (await readFile(join(directory, 'app.ts'), 'utf8')).replace(
+ "title: 'Test'",
+ "title: 'Retention exploration'"
+ );
+ const customView =
+ 'export function App() { return Custom retention exploration
; }\n';
+ await writeFile(join(directory, 'app.ts'), appSource);
+ await writeFile(join(directory, 'src/App.tsx'), customView);
+ await updateManifest(directory, pkg => {
+ for (const name of dataAppPackages) {
+ if (pkg.dependencies[name]) pkg.dependencies[name] = '0.77.0';
+ }
+ });
+ async function install(frozen = false) {
+ const child = Bun.spawn(
+ [
+ process.execPath,
+ 'install',
+ ...(frozen ? ['--frozen-lockfile'] : []),
+ '--ignore-scripts',
+ ],
+ { cwd: directory, stdout: 'pipe', stderr: 'pipe' }
+ );
+ const [stdout, stderr, code] = await Promise.all([
+ new Response(child.stdout).text(),
+ new Response(child.stderr).text(),
+ child.exited,
+ ]);
+ expect({ code, failure: code ? `${stdout}\n${stderr}` : '' }).toEqual({
+ code: 0,
+ failure: '',
+ });
+ }
+ await install();
+ expect(await upgradeApp(directory)).toBe(true);
+ expect(await readFile(join(directory, 'app.ts'), 'utf8')).toBe(appSource);
+ expect(await readFile(join(directory, 'src/App.tsx'), 'utf8')).toBe(
+ customView
+ );
+ await install(true);
+ const { checkAppProject } = await import('@/commands/app/lint.ts');
+ await checkAppProject(directory);
+}, 60_000);
diff --git a/data-app/AGENTS.md b/data-app/AGENTS.md
index cd912e44..4af94e47 100644
--- a/data-app/AGENTS.md
+++ b/data-app/AGENTS.md
@@ -3,12 +3,13 @@
| Change | Source and guidance | Focused check |
| --- | --- | --- |
| Package contracts, transport, or UI | [Data App repository](https://github.com/altertable-ai/data-app) | Package repository checks |
-| Generated app defaults or author guidance | `starter/`; [app authoring router](starter/AGENTS.md) | Starter checks and CLI creation tests |
-| Scaffold distribution or package upgrades | `../cli/src/commands/app/lib/distribution.ts`, `../cli/src/commands/app/upgrade.ts` | Distribution, upgrade, and packaged-app tests |
-| Consumer integration or browser behavior | `tests/`, `starter/fixtures/` | Browser tests against the published package |
+| Generated app defaults or author guidance | Published `@altertable/data-app-examples` package; change it in the SDK repository | Starter checks and CLI creation tests |
+| Scaffold distribution or package upgrades | `../cli/src/commands/app/lib/distribution-source.ts`, `../cli/src/commands/app/lib/distribution.ts`, `../cli/src/commands/app/upgrade.ts` | Distribution, upgrade, and packaged-app tests |
+| Consumer integration or browser behavior | `tests/`, generated `starter/` fixture | Browser tests against the published package |
See [development commands](README.md#develop). Keep SQL and metric definitions in app-owned source.
-Import only public package exports; local Bun serving uses `@altertable/data-app-bun`, and each browser entry
-calls `injectDataAppStyles()` before mounting. Keep starter and browser-test package pins aligned, commit their
+Only `starter/bun.lock` is versioned under `starter/`; setup generates the other files from npm.
+Do not edit the generated fixture. Import only public package exports; local Bun serving uses `@altertable/data-app-bun`, and `mountDataApp`
+owns stylesheet injection before mounting. Keep examples, preview, and browser-test package pins aligned, commit their
lockfiles, and preserve documentation links to installed package docs. Do not copy runtime source
into this repository or generated apps.
diff --git a/data-app/README.md b/data-app/README.md
index 2f07b1f0..7ce03328 100644
--- a/data-app/README.md
+++ b/data-app/README.md
@@ -1,77 +1,99 @@
-# Data app development
+# Data app integration
-`starter/` is the application copied by `altertable app create`. It pins the published
-[core, React authoring, and Bun packages](https://github.com/altertable-ai/data-app)
-to a shared version and ships a frozen lockfile. Package source, API documentation, unit tests,
-and releases belong to that repository.
-`tests/` exercises the starter and component fixtures against the installed npm package.
+The starter comes from the exact published `@altertable/data-app-examples` version in
+`cli/package.json`. Its source, guides, scripts, and tool configuration belong to the SDK.
+This repository keeps only `starter/bun.lock`, the reviewed registry resolution used for offline
+scaffolding and frozen installs. Do not edit generated files in `starter/`.
## Develop
-From the repository root, using Fish:
+From the repository root:
```fish
-bun install --cwd cli --frozen-lockfile
-bun install --cwd data-app/starter --frozen-lockfile
-./bin/altertable app dev --dir data-app/starter
+bun run setup
+```
+
+Setup generates the disposable `starter/` project from the same payload embedded in the CLI,
+then installs its frozen dependencies. To regenerate it after changing the integration:
+
+```fish
+bun run --cwd cli data-app:prepare
+```
+
+With a matching configured profile, preview an app created outside this fixture:
+
+```fish
+./bin/altertable app create my-app
```
-Use a configured profile for live data. The starter executes a bounded connection query before
-showing Connected. App queries, data context, views, and appearance remain app-owned.
+```fish
+./bin/altertable app dev --dir my-app
+```
-## Ownership and distribution
+The canonical standalone example uses fictional inline queries and creates no lakehouse objects.
+Its installed authoring recipe describes distinct standalone, Finding, and semantic metric apps.
+Change the upstream examples package to improve the starter.
-The CLI embeds the starter and internal file-preview project allowlists in
-`cli/src/commands/app/lib/distribution.ts`.
-Both npm and native CLI builds can scaffold an app without reading this checkout or accessing
-the network. Installing the generated app needs registry access or a populated Bun cache.
-Generated projects commit their source, package manifest, and lockfile; they do not vendor runtime
-source.
+## Distribution
-Each consumer declares only the packages it uses:
+`cli/src/commands/app/lib/distribution-source.ts` reads the published local example through
+`getExampleDirectory()`, restores `.gitignore`, adds the frozen lockfile, and prepares identity
+literals with the public manifest rewriter. `distribution.ts` inserts the requested name, title,
+organization, and environment. No source override is maintained here.
-| Package | Consumers |
-| ---------------------------- | ---------------------------------------------------------------- |
-| `@altertable/data-app` | Starter definitions, contracts, and clients; browser-test server |
-| `@altertable/data-app-react` | Starter UI and browser-test fixtures |
-| `@altertable/data-app-bun` | Starter local server and single-file preview |
+Both npm and native builds embed these files with the internal `file-preview/` tooling. Creating
+an app needs neither this checkout nor registry access. Installing it needs the registry or a
+populated Bun cache. Generated apps depend on the runtime packages, not the examples package.
+The manifest compiler runs in the installed preview tooling, outside the shipped CLI bundle;
+directory and file scopes are extracted statically before receiving lakehouse access.
-Browser-test fixtures live under `starter/` and resolve React authoring from the starter's
-own dependencies. Keep the browser-test server's manifest limited to its direct dependencies.
+## Adopt an SDK release
-The starter owns React, ReactDOM, and its authoring tools. The package owns its implementation
-dependencies. The browser entry calls `injectDataAppStyles()` before mounting. The app's `AGENTS.md`
-points to the installed package guide and docs; dependency guides are not assumed to load automatically.
+Update the exact examples and manifest-tooling pins in `cli/package.json` and runtime pins in
+`file-preview/package.json` and `tests/package.json`. Regenerate the fixture from that package:
-To adopt a package release, update the exact pins for packages used in `starter/package.json`,
-`tests/package.json`, and `file-preview/package.json`, regenerate their lockfiles, and run the checks
-below. Never resolve `latest` during app creation. Develop package changes in the package
-repository; the CLI has no runtime source watcher.
+```fish
+bun install --cwd cli
+```
+
+```fish
+bun run --cwd cli data-app:prepare
+```
+
+```fish
+bun install --cwd data-app/starter --lockfile-only
+```
+
+Update the other lockfiles, then run setup and the verification below. Review and commit the
+lockfiles; never resolve `latest` during app creation.
## Upgrades
-`app upgrade` updates declared data-app dependencies and dev dependencies in the app manifest
-and lockfile to the CLI's tested shared version. It preserves dependency placement, unrelated
-dependencies, and app code, and does not downgrade newer installations. Peer incompatibilities
-stop with an actionable error; missing required peers use starter defaults.
+`app upgrade` updates declared data-app dependencies and lockfiles to the CLI's tested version,
+preserving source, identity, dependency placement, and unrelated packages. It does not downgrade
+newer installations and restores the manifest and lockfile if resolution fails.
-Upgrades resolve only the lockfile and restore the original manifest and lockfile if resolution
-fails. Apps must use published packages. The command does not add data-app packages or rewrite
-app imports; authors update their source as needed, run `app lint`, and restart running previews.
+SDK 0.78 uses a shared literal `app.ts` declaration, browser-run operations, and
+`serveLocalApp({ app, page })`. Older `app.json` projects require an author-owned source migration
+using their existing identity, queries, and UI. Upgrade never replaces their source with a demo.
+Adapt the source using the installed SDK authoring recipe, run `app lint`, and restart previews.
## Verify
```fish
-bun run setup
bun run --cwd cli data-app:check
+```
+
+```fish
bun run --cwd cli data-app:test:browser
-bun run check --quick
+```
+
+```fish
bun run check
```
-Install Playwright Chromium with `bunx playwright install chromium` from `data-app/tests/`
-if needed. Browser checks cover connection and request states, theme, context, and presentation
-at phone and desktop widths. CLI tests cover offline scaffolding, npm consumption, package upgrades,
-peer checks, and failed resolution. Release smoke checks create an app outside the checkout, install its
-frozen lockfile, and run `app lint` with the packaged CLI. The minimum Bun compatibility job
-checks scaffolding only; app builds use the repository's current toolchain.
+The checks build and lint the generated fixture against the real published packages. Browser
+tests exercise that fixture through the published Bun server and a mocked external lakehouse:
+filters, evidence inspection, request states, themes, and registered-query boundaries on desktop
+and phone. Component-level SDK tests belong to the SDK repository. npm and native smoke tests
+exercise create, frozen install, lint/build, directory dev, and file preview outside the checkout.
diff --git a/data-app/file-preview/bun.lock b/data-app/file-preview/bun.lock
index 1a47cf58..73bba625 100644
--- a/data-app/file-preview/bun.lock
+++ b/data-app/file-preview/bun.lock
@@ -5,23 +5,23 @@
"": {
"name": "data-app-file-preview",
"dependencies": {
- "@altertable/data-app": "0.74.0",
- "@altertable/data-app-bun": "0.74.0",
- "@altertable/data-app-manifest": "0.74.0",
- "@altertable/data-app-react": "0.74.0",
- "react": "19.3.0",
- "react-dom": "19.3.0",
+ "@altertable/data-app": "0.78.0",
+ "@altertable/data-app-bun": "0.78.0",
+ "@altertable/data-app-manifest": "0.78.0",
+ "@altertable/data-app-react": "0.78.0",
+ "react": "19.3.1",
+ "react-dom": "19.3.1",
},
},
},
"packages": {
- "@altertable/data-app": ["@altertable/data-app@0.74.0", "", { "dependencies": { "@internationalized/date": "3.12.4" } }, "sha512-19Y72gkpid1tKXtesofrwe4oyBUp5FknQ0smgOa1Ilx+8Y/2Xu9F4lHlhAuJU3r0zlEj2Rb/AYZcWXTfUXKZhQ=="],
+ "@altertable/data-app": ["@altertable/data-app@0.78.0", "", { "dependencies": { "@internationalized/date": "3.12.4", "chrono-node": "2.10.3" } }, "sha512-oj+glu3jNiEwiTJu0Jd8pYe233ZOjK/xBMefxnahYJGBmaiDi0KostgOwZhFy7yuVfzftXlf5eWoLgeemYNHyA=="],
- "@altertable/data-app-bun": ["@altertable/data-app-bun@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-zxGaxeG4hzCNcPv20a0ZgrUpFONL5fllzThSlzbYnFM2Tkva3WFP0/N70KF02SddzaboskN5ouqrdUAErq/4Dw=="],
+ "@altertable/data-app-bun": ["@altertable/data-app-bun@0.78.0", "", { "dependencies": { "@altertable/data-app": "0.78.0", "@altertable/data-app-manifest": "0.78.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-blDoWq7CudLrtiEP7o8KxFoujyBM7ePZVmXocA6bpZ//YQ07CVyP2wLxSaRsdSgC+b4Lp29jzZT4BqvEiuUk7A=="],
- "@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.74.0", "", { "dependencies": { "typescript": "5.9.3" } }, "sha512-PQEsKR1VpRkbXVn6LlmwlDBmPode0wlCJ9ivYlk4KKc9vgZcdHpjPuy+G+gaTKiIrYPJpxsLS0hcYxMENNoP2g=="],
+ "@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.78.0", "", { "dependencies": { "typescript": "5.9.3" } }, "sha512-uX7JmnPwbRstseMo80K98h5c5KIsnJKabCAPlueJ+P34rUvMdUFuc696hp/W1cNl81vDXd3eETNpoQnQLZ73XQ=="],
- "@altertable/data-app-react": ["@altertable/data-app-react@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.104.3", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.59.0", "react-aria-components": "1.22.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-E85+w7D1NpiJaIqLaVkHUzMU/TQxdM32NuMEvBAiPO/mclmpjSnvroU5ml/ZkMwX00b1MiKowSgKyyu6q2ckSw=="],
+ "@altertable/data-app-react": ["@altertable/data-app-react@0.78.0", "", { "dependencies": { "@altertable/data-app": "0.78.0", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.107.1", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.73.0", "react-aria-components": "1.22.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-x6nugclGlg09trgJPz83WO1bPqx5mfR5rNR+pEJ1iFaEN+EU9bYpnqcQflkV+u1ImXXgpFmSN1O7a8ncasGM5g=="],
"@altertable/lakehouse": ["@altertable/lakehouse@0.4.1", "", {}, "sha512-m7d15cWt+WUGW7lVw2KYGD+Se8MzO25G7SWSuFd+OasBxWmOJNa2IrgvOHGVEbnZ+kexTUy9NjAGQ69sG4V91w=="],
@@ -51,9 +51,9 @@
"@swc/helpers": ["@swc/helpers@0.5.23", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="],
- "@tanstack/query-core": ["@tanstack/query-core@5.104.3", "", {}, "sha512-DZY9TuJAOgU3UyHUhXb4CcTYEHNZszlwkPg4VViIwTxOKzLprPUU+rbaPZQd3srqkGOtpaDdKpW972UV/LKlcg=="],
+ "@tanstack/query-core": ["@tanstack/query-core@5.107.1", "", {}, "sha512-PSyAik11oQBEVOiVy5hjZWHmoUqOXqK1WYy4v55mcxozEfKaQgpUMsgnXhWjuESzSht8JfzqMS1m6M/9CpNgvg=="],
- "@tanstack/react-query": ["@tanstack/react-query@5.104.3", "", { "dependencies": { "@tanstack/query-core": "5.104.3" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-5Ts1ImwJKqoJgPkLxl9WrPQy1JEoEmti3MaaODCfBamHUGFk57IFrc+AIksPq+BAm10EsroX56qm398Z42LG7w=="],
+ "@tanstack/react-query": ["@tanstack/react-query@5.107.1", "", { "dependencies": { "@tanstack/query-core": "5.107.1" }, "peerDependencies": { "@types/react": "^18 || ^19", "react": "^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-udCOOLp3ZAheUrIHLCe+ZZge6nr2ZUrGMSWcCuXsjY1Bf2JeeE09oxst97PILiCY6N8xo/7bIo3Hvz13zh06FA=="],
"@types/d3-array": ["@types/d3-array@3.2.2", "", {}, "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw=="],
@@ -77,6 +77,8 @@
"aria-hidden": ["aria-hidden@1.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="],
+ "chrono-node": ["chrono-node@2.10.3", "", {}, "sha512-MOfrzXgSMZTH4SZ5gyRKQCVwiCrCKY+uYkSJiWoRLXS88DA6WGJm8UjgS+VVEuUQeew/UUXaxrO+SeDn/WCisg=="],
+
"client-only": ["client-only@0.0.1", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="],
"clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
@@ -121,15 +123,15 @@
"internmap": ["internmap@2.0.3", "", {}, "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg=="],
- "lucide-react": ["lucide-react@1.59.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-5qgMyyCPU6OvnKpLS2t693+ZtiqA8oaSweWoUows0BLFKFf6V75m4+CptpmohZHpD5IuOVIBXHBBiv2vpLJmtw=="],
+ "lucide-react": ["lucide-react@1.73.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-fVOzGviL9mTfHenG1PbCfIceavyGlnpYNSYr+aGZHLRymAJ7DTP6KHuqt0uBkCKAoenr1UVkwSbDIYt2xIesEQ=="],
- "react": ["react@19.3.0", "", {}, "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog=="],
+ "react": ["react@19.3.1", "", {}, "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw=="],
"react-aria": ["react-aria@3.53.1", "", { "dependencies": { "@internationalized/date": "^3.12.4", "@internationalized/number": "^3.6.9", "@internationalized/string": "^3.2.10", "@react-types/shared": "^3.37.0", "@swc/helpers": "^0.5.0", "aria-hidden": "^1.2.3", "clsx": "^2.0.0", "react-stately": "3.51.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" } }, "sha512-dikisyOjJd3D2fFrIDWmVWzqiLz5B86GzZv1zxs7xI4dVc0JIz/1Wa52I20gYvVL2WXeFXlygYsle/QcOMhtcg=="],
"react-aria-components": ["react-aria-components@1.22.1", "", { "dependencies": { "@internationalized/date": "^3.12.4", "@internationalized/string": "^3.2.10", "@react-types/shared": "^3.37.0", "@swc/helpers": "^0.5.0", "client-only": "^0.0.1", "react-aria": "3.53.1", "react-stately": "3.51.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" } }, "sha512-UTHaYHOaM71bOCjGPF50DcLywlrwAodE63IP64LB4kO+OizatQEL8TesVEOM8+TkBeSgHoflJ45388IlJfa7aw=="],
- "react-dom": ["react-dom@19.3.0", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.0" } }, "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q=="],
+ "react-dom": ["react-dom@19.3.1", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.1" } }, "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ=="],
"react-is": ["react-is@19.3.1", "", {}, "sha512-RRieF6IyxQBkcK6pP8xOHprLTPW6QjRkbGdImtqNme+/hYVwCZkLQLdlZGOhUqXwkS9IEynaGvPJtv6XB/cz0Q=="],
diff --git a/data-app/file-preview/package.json b/data-app/file-preview/package.json
index ed789555..f80e37ea 100644
--- a/data-app/file-preview/package.json
+++ b/data-app/file-preview/package.json
@@ -6,11 +6,11 @@
"dev": "data-app-preview"
},
"dependencies": {
- "@altertable/data-app": "0.74.0",
- "@altertable/data-app-bun": "0.74.0",
- "@altertable/data-app-react": "0.74.0",
- "react": "19.3.0",
- "react-dom": "19.3.0",
- "@altertable/data-app-manifest": "0.74.0"
+ "@altertable/data-app": "0.78.0",
+ "@altertable/data-app-bun": "0.78.0",
+ "@altertable/data-app-react": "0.78.0",
+ "react": "19.3.1",
+ "react-dom": "19.3.1",
+ "@altertable/data-app-manifest": "0.78.0"
}
}
diff --git a/data-app/starter/.gitignore b/data-app/starter/.gitignore
deleted file mode 100644
index 8854acb7..00000000
--- a/data-app/starter/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-node_modules/
-dist/
-.env*
diff --git a/data-app/starter/.oxfmtrc.json b/data-app/starter/.oxfmtrc.json
deleted file mode 100644
index 569314e7..00000000
--- a/data-app/starter/.oxfmtrc.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "$schema": "./node_modules/oxfmt/configuration_schema.json",
- "ignorePatterns": ["dist/**", "bun.lock"],
- "singleQuote": true,
- "trailingComma": "es5",
- "arrowParens": "avoid",
- "printWidth": 80,
- "endOfLine": "lf",
- "sortImports": true,
- "sortPackageJson": false
-}
diff --git a/data-app/starter/.oxlintrc.json b/data-app/starter/.oxlintrc.json
deleted file mode 100644
index c9c0654a..00000000
--- a/data-app/starter/.oxlintrc.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "$schema": "./node_modules/oxlint/configuration_schema.json",
- "plugins": ["eslint", "typescript", "unicorn", "oxc", "react", "jsx-a11y"],
- "categories": {
- "correctness": "error"
- },
- "options": {
- "typeAware": true
- },
- "rules": {
- "react/unsupported-syntax": "error",
- "eslint/no-restricted-imports": [
- "error",
- {
- "patterns": [
- {
- "regex": "^\\.\\.?/",
- "message": "Use #app/* or #config for app-owned files."
- }
- ]
- }
- ]
- }
-}
diff --git a/data-app/starter/AGENTS.md b/data-app/starter/AGENTS.md
deleted file mode 100644
index 820c80eb..00000000
--- a/data-app/starter/AGENTS.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Build this data app
-
-Read and follow the [data app authoring instructions](https://github.com/altertable-ai/data-app/blob/main/examples/starter-local-data-app/AGENTS.md) before changing this app.
-
-See [README.md](README.md) for CLI setup, checks, and upgrades.
diff --git a/data-app/starter/README.md b/data-app/starter/README.md
deleted file mode 100644
index c4c6aa13..00000000
--- a/data-app/starter/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Getting started
-
-This starter runs a lightweight SQL query to check the lakehouse connection. “Connected” appears only after that query succeeds; having a configured profile alone is not enough. The check does not establish access to specific datasets.
-
-The generated screen is a setup state. Its operation and data context contain no analytical example to copy. Discover the relevant data and build the exploration around the user's question; broad questions deserve more than one useful angle.
-
-## Run locally
-
-Configure a profile with lakehouse access, then run from this directory:
-
-```fish
-altertable app dev
-```
-
-The CLI prints the local URL. Use `altertable app dev --port 3022` to choose a port.
-
-## Author the app
-
-Start with the [authoring router](AGENTS.md) for data and view changes, or the [package authoring guide](node_modules/@altertable/data-app/docs/app-authoring.md) to find components, hooks, and contracts.
-
-Import definitions, contracts, and clients from `@altertable/data-app` and its public subpaths. Use `@altertable/data-app-react` for React authoring, `@altertable/data-app-react/ui` for setup and custom UI components, and `@altertable/data-app-bun` for local serving. Keep all data-app package versions aligned when adding dependencies.
-
-## Check and upgrade
-
-Run `altertable app lint` to check the app locally. Use `altertable app lint --lakehouse` to execute each operation's declared `checks` against the selected profile.
-
-`altertable app upgrade` updates declared data-app packages and the lockfile to the shared version tested with your CLI. It preserves app code and does not downgrade newer packages. Update your imports and app code if the package APIs change, then run `altertable app lint` again and restart any running preview.
-
-## Version control
-
-Commit app source, `package.json`, and `bun.lock`. On a fresh clone, run `bun install --frozen-lockfile` to restore the pinned dependencies; installation needs registry access or a populated Bun cache. Keep custom code in `src/`.
diff --git a/data-app/starter/app.json b/data-app/starter/app.json
deleted file mode 100644
index 68e19974..00000000
--- a/data-app/starter/app.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "schemaVersion": 1,
- "title": "Getting started",
- "scope": { "organization": "Your organization", "environment": "your environment" },
- "appearance": {
- "theme": "light",
- "baseColor": "neutral",
- "accentColor": "#405d47",
- "density": "comfortable",
- "cornerRadius": "medium",
- "elevation": "subtle",
- "typography": { "body": "system", "heading": "system" }
- }
-}
diff --git a/data-app/starter/bun.lock b/data-app/starter/bun.lock
index 33731cf8..5a5375e3 100644
--- a/data-app/starter/bun.lock
+++ b/data-app/starter/bun.lock
@@ -5,11 +5,11 @@
"": {
"name": "data-app-starter",
"dependencies": {
- "@altertable/data-app": "0.74.0",
- "@altertable/data-app-bun": "0.74.0",
- "@altertable/data-app-react": "0.74.0",
- "react": "19.3.0",
- "react-dom": "19.3.0",
+ "@altertable/data-app": "0.78.0",
+ "@altertable/data-app-bun": "0.78.0",
+ "@altertable/data-app-react": "0.78.0",
+ "react": "19.3.1",
+ "react-dom": "19.3.1",
},
"devDependencies": {
"@types/bun": "1.4.3",
@@ -23,11 +23,13 @@
},
},
"packages": {
- "@altertable/data-app": ["@altertable/data-app@0.74.0", "", { "dependencies": { "@internationalized/date": "3.12.4" } }, "sha512-19Y72gkpid1tKXtesofrwe4oyBUp5FknQ0smgOa1Ilx+8Y/2Xu9F4lHlhAuJU3r0zlEj2Rb/AYZcWXTfUXKZhQ=="],
+ "@altertable/data-app": ["@altertable/data-app@0.78.0", "", { "dependencies": { "@internationalized/date": "3.12.4", "chrono-node": "2.10.3" } }, "sha512-oj+glu3jNiEwiTJu0Jd8pYe233ZOjK/xBMefxnahYJGBmaiDi0KostgOwZhFy7yuVfzftXlf5eWoLgeemYNHyA=="],
- "@altertable/data-app-bun": ["@altertable/data-app-bun@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-zxGaxeG4hzCNcPv20a0ZgrUpFONL5fllzThSlzbYnFM2Tkva3WFP0/N70KF02SddzaboskN5ouqrdUAErq/4Dw=="],
+ "@altertable/data-app-bun": ["@altertable/data-app-bun@0.78.0", "", { "dependencies": { "@altertable/data-app": "0.78.0", "@altertable/data-app-manifest": "0.78.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-blDoWq7CudLrtiEP7o8KxFoujyBM7ePZVmXocA6bpZ//YQ07CVyP2wLxSaRsdSgC+b4Lp29jzZT4BqvEiuUk7A=="],
- "@altertable/data-app-react": ["@altertable/data-app-react@0.74.0", "", { "dependencies": { "@altertable/data-app": "0.74.0", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.104.3", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.59.0", "react-aria-components": "1.22.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-E85+w7D1NpiJaIqLaVkHUzMU/TQxdM32NuMEvBAiPO/mclmpjSnvroU5ml/ZkMwX00b1MiKowSgKyyu6q2ckSw=="],
+ "@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.78.0", "", { "dependencies": { "typescript": "5.9.3" } }, "sha512-uX7JmnPwbRstseMo80K98h5c5KIsnJKabCAPlueJ+P34rUvMdUFuc696hp/W1cNl81vDXd3eETNpoQnQLZ73XQ=="],
+
+ "@altertable/data-app-react": ["@altertable/data-app-react@0.78.0", "", { "dependencies": { "@altertable/data-app": "0.78.0", "@floating-ui/react": "0.27.20", "@internationalized/date": "3.12.4", "@tanstack/react-query": "5.107.1", "fflate": "0.8.3", "fuzzysort": "4.0.2", "html-to-image": "1.11.13", "lucide-react": "1.73.0", "react-aria-components": "1.22.1", "recharts": "3.10.1" }, "peerDependencies": { "react": ">=19.2.0", "react-dom": ">=19.2.0" } }, "sha512-x6nugclGlg09trgJPz83WO1bPqx5mfR5rNR+pEJ1iFaEN+EU9bYpnqcQflkV+u1ImXXgpFmSN1O7a8ncasGM5g=="],
"@altertable/lakehouse": ["@altertable/lakehouse@0.4.1", "", {}, "sha512-m7d15cWt+WUGW7lVw2KYGD+Se8MzO25G7SWSuFd+OasBxWmOJNa2IrgvOHGVEbnZ+kexTUy9NjAGQ69sG4V91w=="],
@@ -145,9 +147,9 @@
"@swc/helpers": ["@swc/helpers@0.5.23", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="],
- "@tanstack/query-core": ["@tanstack/query-core@5.104.3", "", {}, "sha512-DZY9TuJAOgU3UyHUhXb4CcTYEHNZszlwkPg4VViIwTxOKzLprPUU+rbaPZQd3srqkGOtpaDdKpW972UV/LKlcg=="],
+ "@tanstack/query-core": ["@tanstack/query-core@5.107.1", "", {}, "sha512-PSyAik11oQBEVOiVy5hjZWHmoUqOXqK1WYy4v55mcxozEfKaQgpUMsgnXhWjuESzSht8JfzqMS1m6M/9CpNgvg=="],
- "@tanstack/react-query": ["@tanstack/react-query@5.104.3", "", { "dependencies": { "@tanstack/query-core": "5.104.3" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-5Ts1ImwJKqoJgPkLxl9WrPQy1JEoEmti3MaaODCfBamHUGFk57IFrc+AIksPq+BAm10EsroX56qm398Z42LG7w=="],
+ "@tanstack/react-query": ["@tanstack/react-query@5.107.1", "", { "dependencies": { "@tanstack/query-core": "5.107.1" }, "peerDependencies": { "@types/react": "^18 || ^19", "react": "^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-udCOOLp3ZAheUrIHLCe+ZZge6nr2ZUrGMSWcCuXsjY1Bf2JeeE09oxst97PILiCY6N8xo/7bIo3Hvz13zh06FA=="],
"@types/bun": ["@types/bun@1.4.3", "", { "dependencies": { "bun-types": "1.4.3" } }, "sha512-N67Pqy8JXbAY/j0tNraS3V5mubGvc6rrrNDmDCtZLlFzccbUJPDb0tvgUBC5q4m8ybkP93Jcn1QB+RYQ6PvBhw=="],
@@ -221,6 +223,8 @@
"bun-types": ["bun-types@1.4.3", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-tinRJNGOmUN+tEAsn2y2e942n9JHRHR42iUYzDH75NmhJqVBokGSQkkfSFdNWwsANIdrK6ACH9t01M452YyTwg=="],
+ "chrono-node": ["chrono-node@2.10.3", "", {}, "sha512-MOfrzXgSMZTH4SZ5gyRKQCVwiCrCKY+uYkSJiWoRLXS88DA6WGJm8UjgS+VVEuUQeew/UUXaxrO+SeDn/WCisg=="],
+
"client-only": ["client-only@0.0.1", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="],
"clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
@@ -267,7 +271,7 @@
"internmap": ["internmap@2.0.3", "", {}, "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg=="],
- "lucide-react": ["lucide-react@1.59.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-5qgMyyCPU6OvnKpLS2t693+ZtiqA8oaSweWoUows0BLFKFf6V75m4+CptpmohZHpD5IuOVIBXHBBiv2vpLJmtw=="],
+ "lucide-react": ["lucide-react@1.73.0", "", { "peerDependencies": { "@types/react": "*", "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-fVOzGviL9mTfHenG1PbCfIceavyGlnpYNSYr+aGZHLRymAJ7DTP6KHuqt0uBkCKAoenr1UVkwSbDIYt2xIesEQ=="],
"oxfmt": ["oxfmt@0.71.0", "", { "dependencies": { "tinypool": "2.2.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.71.0", "@oxfmt/binding-android-arm64": "0.71.0", "@oxfmt/binding-darwin-arm64": "0.71.0", "@oxfmt/binding-darwin-x64": "0.71.0", "@oxfmt/binding-freebsd-x64": "0.71.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.71.0", "@oxfmt/binding-linux-arm-musleabihf": "0.71.0", "@oxfmt/binding-linux-arm64-gnu": "0.71.0", "@oxfmt/binding-linux-arm64-musl": "0.71.0", "@oxfmt/binding-linux-ppc64-gnu": "0.71.0", "@oxfmt/binding-linux-riscv64-gnu": "0.71.0", "@oxfmt/binding-linux-riscv64-musl": "0.71.0", "@oxfmt/binding-linux-s390x-gnu": "0.71.0", "@oxfmt/binding-linux-x64-gnu": "0.71.0", "@oxfmt/binding-linux-x64-musl": "0.71.0", "@oxfmt/binding-openharmony-arm64": "0.71.0", "@oxfmt/binding-win32-arm64-msvc": "0.71.0", "@oxfmt/binding-win32-ia32-msvc": "0.71.0", "@oxfmt/binding-win32-x64-msvc": "0.71.0" }, "peerDependencies": { "svelte": "^5.0.0", "vite-plus": "*" }, "optionalPeers": ["svelte", "vite-plus"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-lUPUl0d/+Io5pDrsPXWs6rB4N/bpB78oj9CTDpnbulfDz+0r3XXcHPlQ7kRPJ2GjIT4nX+/mcqunOeP9BvsEtg=="],
@@ -275,13 +279,13 @@
"oxlint-tsgolint": ["oxlint-tsgolint@7.0.2003", "", { "optionalDependencies": { "@oxlint-tsgolint/darwin-arm64": "7.0.2003", "@oxlint-tsgolint/darwin-x64": "7.0.2003", "@oxlint-tsgolint/linux-arm64": "7.0.2003", "@oxlint-tsgolint/linux-x64": "7.0.2003", "@oxlint-tsgolint/win32-arm64": "7.0.2003", "@oxlint-tsgolint/win32-x64": "7.0.2003" }, "bin": { "tsgolint": "./bin/tsgolint.js" } }, "sha512-VnK4zlqgmgq/7ZcjzCk/WpN8kKFsYGcB85Io9qT3wL4K8Un3RKmJkp793crNETieMusPMKOA4a+Mw2wbteI6TQ=="],
- "react": ["react@19.3.0", "", {}, "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog=="],
+ "react": ["react@19.3.1", "", {}, "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw=="],
"react-aria": ["react-aria@3.53.1", "", { "dependencies": { "@internationalized/date": "^3.12.4", "@internationalized/number": "^3.6.9", "@internationalized/string": "^3.2.10", "@react-types/shared": "^3.37.0", "@swc/helpers": "^0.5.0", "aria-hidden": "^1.2.3", "clsx": "^2.0.0", "react-stately": "3.51.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" } }, "sha512-dikisyOjJd3D2fFrIDWmVWzqiLz5B86GzZv1zxs7xI4dVc0JIz/1Wa52I20gYvVL2WXeFXlygYsle/QcOMhtcg=="],
"react-aria-components": ["react-aria-components@1.22.1", "", { "dependencies": { "@internationalized/date": "^3.12.4", "@internationalized/string": "^3.2.10", "@react-types/shared": "^3.37.0", "@swc/helpers": "^0.5.0", "client-only": "^0.0.1", "react-aria": "3.53.1", "react-stately": "3.51.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" } }, "sha512-UTHaYHOaM71bOCjGPF50DcLywlrwAodE63IP64LB4kO+OizatQEL8TesVEOM8+TkBeSgHoflJ45388IlJfa7aw=="],
- "react-dom": ["react-dom@19.3.0", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.0" } }, "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q=="],
+ "react-dom": ["react-dom@19.3.1", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.1" } }, "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ=="],
"react-is": ["react-is@19.3.0", "", {}, "sha512-UpMYezM4v5/18F28aC66AEsjXIgE02kyEMH6yLdgLXu/UTfa1Ntwck/nNLrbqJsEXW7gPb0coNO9FQse9WTovA=="],
@@ -316,5 +320,7 @@
"use-sync-external-store": ["use-sync-external-store@1.7.0", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A=="],
"victory-vendor": ["victory-vendor@37.3.6", "", { "dependencies": { "@types/d3-array": "^3.0.3", "@types/d3-ease": "^3.0.0", "@types/d3-interpolate": "^3.0.1", "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/d3-time": "^3.0.0", "@types/d3-timer": "^3.0.0", "d3-array": "^3.1.6", "d3-ease": "^3.0.1", "d3-interpolate": "^3.0.1", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", "d3-time": "^3.0.0", "d3-timer": "^3.0.1" } }, "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ=="],
+
+ "@altertable/data-app-manifest/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
}
}
diff --git a/data-app/starter/bunfig.toml b/data-app/starter/bunfig.toml
deleted file mode 100644
index b6874be1..00000000
--- a/data-app/starter/bunfig.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-[install]
-exact = true
diff --git a/data-app/starter/fixtures/activity.ts b/data-app/starter/fixtures/activity.ts
deleted file mode 100644
index e6fe8e40..00000000
--- a/data-app/starter/fixtures/activity.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { defineDataApp } from "@altertable/data-app";
-import { defineDateRangeContract } from "@altertable/data-app/contract";
-
-type Activity = { count: number; features: string[] };
-export const app = defineDataApp({
- title: "Usage exploration",
- description: "Explore product activity in the selected reporting period.",
- scope: { organization: "Acme", environment: "production" },
- appearance: { theme: "light" },
- queries: {
- activity: {
- statement: "SELECT 120 AS count, 'Queries' AS feature WHERE $start <= $end",
- params: { start: { type: "string" }, end: { type: "string" } },
- projections: { count: { type: "number" }, feature: { type: "string" } },
- },
- },
-});
-export const calendar = defineDateRangeContract({
- minDate: "2026-01-01",
- maxDate: "2026-03-31",
- maxRangeDays: 31,
- timeZone: "UTC",
-});
-export const operations = {
- activity: app.defineOperation({
- policy: { maxQueryRows: 10, maxDurationMs: 30_000, maxResponseBytes: 1_000_000 },
- checks: [{ range: { start: "2026-03-10", end: "2026-03-12" }, comparison: null }],
- input: calendar.parseRequest,
- async run({ query }, input): Promise {
- const result = await query(
- "activity",
- { start: input.range.start, end: input.range.end },
- { limit: 10 },
- );
- const firstRow = result.rows[0];
- if (!firstRow) throw new Error("Activity query returned no rows.");
- return {
- count: firstRow.count,
- features: result.rows.map((row) => row.feature),
- };
- },
- }),
-};
diff --git a/data-app/starter/fixtures/index.html b/data-app/starter/fixtures/index.html
deleted file mode 100644
index f621cbd5..00000000
--- a/data-app/starter/fixtures/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- Runtime fixtures
-
-
-
-
-
-
diff --git a/data-app/starter/fixtures/main.tsx b/data-app/starter/fixtures/main.tsx
deleted file mode 100644
index 81b76807..00000000
--- a/data-app/starter/fixtures/main.tsx
+++ /dev/null
@@ -1,250 +0,0 @@
-import { defineDataApp } from "@altertable/data-app";
-import { createDataClient } from "@altertable/data-app/client";
-import { connectionCheck, defineDateRangeContract } from "@altertable/data-app/contract";
-import {
- createDataContext,
- createDataHooks,
- DataApp,
- DataSection,
- dateRangeVariable,
- defineDataIdentifiers,
- Grid,
- GridItem,
- injectDataAppStyles,
- MetricWidget,
- mountDataApp,
- Skeleton,
- Stack,
- TableWidget,
- VisualizationWidget,
-} from "@altertable/data-app-react";
-import {
- DataWidget,
- GlossaryDefinition,
- MetricWidget as StaticMetricWidget,
- VisualizationWidget as StaticVisualizationWidget,
-} from "@altertable/data-app-react/ui";
-import type { DataReading } from "@altertable/data-app-react/ui";
-import { useState } from "react";
-
-const app = defineDataApp({
- title: "Orders exploration",
- description: "Completed orders in production.",
- scope: { organization: "Acme", environment: "production" },
- appearance: { theme: "light" },
- queries: {
- connection: {
- statement: "SELECT 1 AS connection_check",
- params: {},
- projections: { connection_check: { type: "number" } },
- },
- },
-});
-const operations = { connection: connectionCheck(app.queries) };
-const connectionQueryNames = operations.connection.queryNames;
-const { defineDataView } = createDataHooks(createDataClient());
-const identifiers = defineDataIdentifiers({
- tables: {
- orders: { catalog: "commerce", schema: "sales", name: "orders" },
- },
- columns: {
- customerId: { table: "orders", name: "customer_id" },
- },
-});
-const { DataIdentifier } = identifiers;
-const dataContext = createDataContext(connectionQueryNames)({
- identifiers: identifiers.definitions,
- description: (
- <>
- A fixture exploring completed orders in .
- >
- ),
- glossary: {
- orders: {
- term: "Orders",
- definition: (
- <>
- Completed orders grouped by .
- >
- ),
- queryNames: [connectionQueryNames.connection],
- },
- },
-});
-const periodVariable = dateRangeVariable({
- key: "period",
- comparison: true,
- contract: defineDateRangeContract({
- minDate: "2026-08-01",
- maxDate: "2026-09-30",
- maxRangeDays: 60,
- timeZone: "UTC",
- }),
- defaultValue: { kind: "dates", start: "2026-09-10", end: "2026-09-12" },
-});
-const connectionView = defineDataView({
- dataContext,
- operation: "connection",
- variables: { period: periodVariable },
- input: () => ({}),
- isEmpty: () => false,
- describeInput: () => "connection check",
- emptyFallback: { title: "No orders in this period" },
-});
-const orders = Array.from({ length: 11 }, (_, index) => ({
- id: index + 1,
- name: `Order ${index + 1}`,
-}));
-const orderDataset = connectionView.dataset({
- name: "Orders",
- select: () => orders,
- rowKey: (order) => order.id,
- columns: { order: { label: "Order", value: (order) => order.name } },
- evidence: { id: "orders", glossaryIds: ["orders"] },
-});
-const completedOrders = connectionView.metric(
- {
- id: "completed-orders",
- glossaryId: "orders",
- label: "Completed orders",
- format: { kind: "count" },
- },
- () => ({ current: 120 }),
-);
-type ConnectionSource = {
- loading: false;
- data: true;
- input: Record;
- scope: DataReading;
-};
-const content = connectionView.content((source) => {
- if (source.loading)
- return (
-
- );
- return ;
-});
-
-function FixtureContent({ source }: { source: ConnectionSource }) {
- const [orderSearch, setOrderSearch] = useState("");
- return (
-
-
- Review{" "}
-
- completed orders
-
- .
-
-
-
-
-
-
-
-
- Product activity
} />
-
- Feature reach}
- />
-
-
-
-
-
-
-
-
-
- {(rows) => {rows.length} daily orders
}
-
-
- 80 customers}
- />
-
-
-
-
- Short panel
-
-
-
- First narrow widget
- Second narrow widget
-
- order.name }],
- }}
- pagination={{ pageSize: 4 }}
- />
- Connection view ready
-
- );
-}
-
-function Fixture() {
- return (
- [
- {
- id: "orders",
- headline: "Orders increased",
- visual: ,
- evidence: completedOrders,
- },
- {
- id: "customers",
- headline: "More returning customers",
- visual: (
-
- {(rows) => {rows.length} orders
}
-
- ),
- evidence: orderDataset,
- },
- ]}
- >
-
-
- );
-}
-
-injectDataAppStyles();
-mountDataApp({ app, component: Fixture });
diff --git a/data-app/starter/fixtures/view.html b/data-app/starter/fixtures/view.html
deleted file mode 100644
index 0a205bbd..00000000
--- a/data-app/starter/fixtures/view.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- Runtime fixtures
-
-
-
-
-
-
diff --git a/data-app/starter/fixtures/view.tsx b/data-app/starter/fixtures/view.tsx
deleted file mode 100644
index 30a0690e..00000000
--- a/data-app/starter/fixtures/view.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import { app, calendar, operations } from "./activity.ts";
-import { createDataClient } from "@altertable/data-app/client";
-import {
- createDataHooks,
- DataApp,
- DataSection,
- Grid,
- GridItem,
- injectDataAppStyles,
- MetricWidget,
- mountDataApp,
- Stack,
- VisualizationWidget,
-} from "@altertable/data-app-react";
-import { defineQueryNames } from "@altertable/data-app/contract";
-import {
- createDataContext,
- dateRangeVariable,
- defineDataIdentifiers,
-} from "@altertable/data-app-react";
-
-const period = dateRangeVariable({
- key: "period",
- contract: calendar,
- comparison: true,
- defaultValue: { kind: "dates", start: "2026-03-10", end: "2026-03-12" },
-});
-const { defineDataView } = createDataHooks(createDataClient());
-const identifiers = defineDataIdentifiers({
- tables: { events: { catalog: "product", schema: "analytics", name: "events" } },
- columns: {},
-});
-const context = createDataContext(defineQueryNames({ activity: "activity" }))({
- identifiers: identifiers.definitions,
- description: (
- <>
- Activity in .
- >
- ),
- glossary: {
- actions: { term: "Actions", definition: "Recorded product actions.", queryNames: ["activity"] },
- },
-});
-const activityView = defineDataView({
- dataContext: context,
- operation: "activity",
- variables: { period },
- input: ({ period }) => period,
- date: { variable: "period", input: (input) => input },
- describeInput: (input) => period.describeInput(input),
- isEmpty: (data) => data.features.length === 0,
- emptyFallback: { title: "No activity in this range", description: "Choose another range." },
-});
-const features = activityView.dataset({
- name: "Features",
- select: (data) => data.features,
- rowKey: (feature) => feature,
- columns: { feature: { value: (feature) => feature } },
- evidence: { id: "activity", queryNames: ["activity"] },
- emptyFallback: { title: "No features" },
-});
-const actions = activityView.metric(
- { id: "actions", glossaryId: "actions", format: { kind: "count" } },
- (data) => ({ current: data.count }),
-);
-const content = activityView.content((source) => (
-
- {source.loading ? "Loading activity…" : `Results for ${source.scope.value}`}
-
-
-
- {(rows) => (
-
- {rows.map((feature) => (
- - {feature}
- ))}
-
- )}
-
-
-
-
-
-
-
-));
-function Fixture() {
- return (
- {
- const reading = actions.read(source);
- return [
- {
- id: "activity",
- headline: `${reading.value.current} recorded actions`,
- visual: ,
- evidence: actions,
- },
- ];
- }}
- >
-
-
- );
-}
-injectDataAppStyles();
-mountDataApp({ app, component: Fixture });
diff --git a/data-app/starter/package.json b/data-app/starter/package.json
deleted file mode 100644
index ca2c4df1..00000000
--- a/data-app/starter/package.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "name": "data-app-starter",
- "private": true,
- "type": "module",
- "imports": {
- "#app/*": "./src/*",
- "#config": "./app.json"
- },
- "scripts": {
- "typecheck": "tsc --noEmit",
- "lint": "oxlint --type-aware src",
- "format": "oxfmt src",
- "format:check": "oxfmt --check src",
- "dev": "bun --hot src/server.ts",
- "build": "bun build src/index.html --outdir=dist --production"
- },
- "dependencies": {
- "@altertable/data-app": "0.74.0",
- "@altertable/data-app-bun": "0.74.0",
- "@altertable/data-app-react": "0.74.0",
- "react": "19.3.0",
- "react-dom": "19.3.0"
- },
- "devDependencies": {
- "@types/bun": "1.4.3",
- "@types/react": "19.3.0",
- "@types/react-dom": "19.3.0",
- "oxfmt": "0.71.0",
- "oxlint": "1.86.0",
- "oxlint-tsgolint": "7.0.2003",
- "typescript": "7.0.2"
- }
-}
diff --git a/data-app/starter/src/App.tsx b/data-app/starter/src/App.tsx
deleted file mode 100644
index f52c1a74..00000000
--- a/data-app/starter/src/App.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { GettingStarted } from '@altertable/data-app-react/ui';
-
-import { dataContext } from '#app/data-context.ts';
-
-/** Connectivity-only screen. Investigate the requested question, then replace this with a view
- * that leads with a supported finding and explores the useful angles behind it. */
-export function App() {
- return ;
-}
diff --git a/data-app/starter/src/assets.d.ts b/data-app/starter/src/assets.d.ts
deleted file mode 100644
index 35306c6f..00000000
--- a/data-app/starter/src/assets.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-declare module '*.css';
diff --git a/data-app/starter/src/config.ts b/data-app/starter/src/config.ts
deleted file mode 100644
index 3f9f57b2..00000000
--- a/data-app/starter/src/config.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { defineDataApp } from '@altertable/data-app';
-import { parseAppearance } from '@altertable/data-app/appearance';
-
-import app from '#config';
-
-export default defineDataApp({
- title: app.title,
- description:
- 'Verify the configured lakehouse connection before authoring an exploration.',
- scope: app.scope,
- appearance: parseAppearance(app.appearance),
- queries: {
- connection: {
- statement: 'SELECT 1 AS connection_check',
- params: {},
- projections: { connection_check: { type: 'number' } },
- },
- },
-});
diff --git a/data-app/starter/src/data-context.ts b/data-app/starter/src/data-context.ts
deleted file mode 100644
index 5dbb0d18..00000000
--- a/data-app/starter/src/data-context.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { createDataContext } from '@altertable/data-app-react';
-import { defineQueryNames } from '@altertable/data-app/contract';
-
-import type app from '#app/config.ts';
-
-/** Setup context only. Replace it with the exploration's scope, exact definitions, limitations,
- * and query evidence after inspecting the source data. */
-const queryNames = defineQueryNames({
- connection: 'connection' satisfies keyof typeof app.queries,
-});
-
-export const dataContext = createDataContext(queryNames)({
- description:
- 'This starter runs a lightweight query to verify that the selected lakehouse profile can execute SQL. It does not check access to individual datasets. Replace the check with a query that answers a real question before sharing the app.',
- glossary: {
- connectionVerified: {
- term: 'Connected',
- definition: 'The latest connection-check query completed successfully.',
- queryNames: [queryNames.connection],
- },
- },
-});
diff --git a/data-app/starter/src/favicon.svg b/data-app/starter/src/favicon.svg
deleted file mode 100644
index 11ce6117..00000000
--- a/data-app/starter/src/favicon.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
diff --git a/data-app/starter/src/index.html b/data-app/starter/src/index.html
deleted file mode 100644
index 1edaa873..00000000
--- a/data-app/starter/src/index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- Altertable app
-
-
-
-
-
-
-
diff --git a/data-app/starter/src/main.tsx b/data-app/starter/src/main.tsx
deleted file mode 100644
index 47c2f1ee..00000000
--- a/data-app/starter/src/main.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import { injectDataAppStyles, mountDataApp } from '@altertable/data-app-react';
-
-import { App } from '#app/App.tsx';
-import app from '#app/config.ts';
-
-injectDataAppStyles();
-mountDataApp({ app, component: App });
diff --git a/data-app/starter/src/operations.ts b/data-app/starter/src/operations.ts
deleted file mode 100644
index 6eb959a0..00000000
--- a/data-app/starter/src/operations.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { connectionCheck } from '@altertable/data-app/contract';
-
-import app from '#app/config.ts';
-
-/** Connectivity probe only: its successful query supplies no analytical result. Replace it with
- * bounded, validated operations that cover the questions the finished app will answer. */
-export const operations = { connection: connectionCheck(app.queries) };
diff --git a/data-app/starter/src/preview.ts b/data-app/starter/src/preview.ts
deleted file mode 100644
index 1c14ea64..00000000
--- a/data-app/starter/src/preview.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { resolve } from 'node:path';
-
-import { localLakehouse } from '@altertable/data-app-bun';
-import { serveAppFile } from '@altertable/data-app-bun/preview';
-
-const preview = await serveAppFile({
- file: resolve(import.meta.dir, '../index.tsx'),
- port: Number(process.env.PORT ?? 25837),
- lakehouse: localLakehouse(),
-});
-
-let stopping = false;
-async function shutdown() {
- if (stopping) return;
- stopping = true;
- try {
- await preview.stop();
- process.exit(0);
- } catch (error) {
- console.error(error);
- process.exit(1);
- }
-}
-process.on('SIGINT', shutdown);
-process.on('SIGTERM', shutdown);
-console.log(`Data app running at ${preview.url}`);
diff --git a/data-app/starter/src/server.ts b/data-app/starter/src/server.ts
deleted file mode 100644
index 7cfdb49e..00000000
--- a/data-app/starter/src/server.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { serveLocalApp } from '@altertable/data-app-bun';
-
-import app from '#app/config.ts';
-import page from '#app/index.html';
-import { operations } from '#app/operations.ts';
-
-serveLocalApp({ page, operations, title: app.title });
diff --git a/data-app/starter/tsconfig.json b/data-app/starter/tsconfig.json
deleted file mode 100644
index 4786e2b9..00000000
--- a/data-app/starter/tsconfig.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "compilerOptions": {
- "target": "ESNext",
- "module": "Preserve",
- "moduleResolution": "bundler",
- "allowImportingTsExtensions": true,
- "resolveJsonModule": true,
- "jsx": "react-jsx",
- "strict": true,
- "noEmit": true,
- "skipLibCheck": true,
- "types": ["bun"]
- },
- "include": ["src"]
-}
diff --git a/data-app/tests/bun.lock b/data-app/tests/bun.lock
index 18ec5918..6c93eb68 100644
--- a/data-app/tests/bun.lock
+++ b/data-app/tests/bun.lock
@@ -5,7 +5,8 @@
"": {
"name": "data-app-browser-tests",
"dependencies": {
- "@altertable/data-app": "0.74.0",
+ "@altertable/data-app": "0.78.0",
+ "@altertable/data-app-bun": "0.78.0",
},
"devDependencies": {
"@playwright/test": "1.63.0",
@@ -16,7 +17,13 @@
},
},
"packages": {
- "@altertable/data-app": ["@altertable/data-app@0.74.0", "", { "dependencies": { "@internationalized/date": "3.12.4" } }, "sha512-19Y72gkpid1tKXtesofrwe4oyBUp5FknQ0smgOa1Ilx+8Y/2Xu9F4lHlhAuJU3r0zlEj2Rb/AYZcWXTfUXKZhQ=="],
+ "@altertable/data-app": ["@altertable/data-app@0.78.0", "", { "dependencies": { "@internationalized/date": "3.12.4", "chrono-node": "2.10.3" } }, "sha512-oj+glu3jNiEwiTJu0Jd8pYe233ZOjK/xBMefxnahYJGBmaiDi0KostgOwZhFy7yuVfzftXlf5eWoLgeemYNHyA=="],
+
+ "@altertable/data-app-bun": ["@altertable/data-app-bun@0.78.0", "", { "dependencies": { "@altertable/data-app": "0.78.0", "@altertable/data-app-manifest": "0.78.0", "@altertable/lakehouse": "0.4.1", "get-tsconfig": "4.14.3" }, "bin": { "data-app-preview": "bin/preview.js" } }, "sha512-blDoWq7CudLrtiEP7o8KxFoujyBM7ePZVmXocA6bpZ//YQ07CVyP2wLxSaRsdSgC+b4Lp29jzZT4BqvEiuUk7A=="],
+
+ "@altertable/data-app-manifest": ["@altertable/data-app-manifest@0.78.0", "", { "dependencies": { "typescript": "5.9.3" } }, "sha512-uX7JmnPwbRstseMo80K98h5c5KIsnJKabCAPlueJ+P34rUvMdUFuc696hp/W1cNl81vDXd3eETNpoQnQLZ73XQ=="],
+
+ "@altertable/lakehouse": ["@altertable/lakehouse@0.4.1", "", {}, "sha512-m7d15cWt+WUGW7lVw2KYGD+Se8MzO25G7SWSuFd+OasBxWmOJNa2IrgvOHGVEbnZ+kexTUy9NjAGQ69sG4V91w=="],
"@internationalized/date": ["@internationalized/date@3.12.4", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-M1dEn4c1U1HsSlaVR8upZtSqvXrTkHDfv18H01uCSJyjVLDxnBR38v/fMxecmlwXKR4i9HeZcmgQAPE6A+aGJQ=="],
@@ -82,16 +89,24 @@
"bun-types": ["bun-types@1.4.3", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-tinRJNGOmUN+tEAsn2y2e942n9JHRHR42iUYzDH75NmhJqVBokGSQkkfSFdNWwsANIdrK6ACH9t01M452YyTwg=="],
+ "chrono-node": ["chrono-node@2.10.3", "", {}, "sha512-MOfrzXgSMZTH4SZ5gyRKQCVwiCrCKY+uYkSJiWoRLXS88DA6WGJm8UjgS+VVEuUQeew/UUXaxrO+SeDn/WCisg=="],
+
+ "get-tsconfig": ["get-tsconfig@4.14.3", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA=="],
+
"oxlint-tsgolint": ["oxlint-tsgolint@7.0.2003", "", { "optionalDependencies": { "@oxlint-tsgolint/darwin-arm64": "7.0.2003", "@oxlint-tsgolint/darwin-x64": "7.0.2003", "@oxlint-tsgolint/linux-arm64": "7.0.2003", "@oxlint-tsgolint/linux-x64": "7.0.2003", "@oxlint-tsgolint/win32-arm64": "7.0.2003", "@oxlint-tsgolint/win32-x64": "7.0.2003" }, "bin": { "tsgolint": "./bin/tsgolint.js" } }, "sha512-VnK4zlqgmgq/7ZcjzCk/WpN8kKFsYGcB85Io9qT3wL4K8Un3RKmJkp793crNETieMusPMKOA4a+Mw2wbteI6TQ=="],
"playwright": ["playwright@1.63.0", "", { "dependencies": { "playwright-core": "1.63.0" }, "bin": { "playwright": "cli.js" } }, "sha512-+7ziBLidS4NaNCdt57SUDT+wYmmd5fmiQejUic/kb+YsYSCPyOOE9sebzMjNmQrsnNpDJqd4WHvV/8lfKfUDUg=="],
"playwright-core": ["playwright-core@1.63.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-rYCsBF/M5HjUch52bbtVONEFjv6Xu8sm8h72dNlR5bzIE1fvC/bxgspzkjSfU+MweEMmPM8KJebG6nnyxo5mCg=="],
+ "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
+
"tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"typescript": ["typescript@7.0.2", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
"undici-types": ["undici-types@8.9.0", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="],
+
+ "@altertable/data-app-manifest/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
}
}
diff --git a/data-app/tests/calendar.spec.ts b/data-app/tests/calendar.spec.ts
deleted file mode 100644
index 079803a3..00000000
--- a/data-app/tests/calendar.spec.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { expect, test } from '@playwright/test';
-
-test('the small-screen calendar fills its panel and keeps the selected range legible', async ({
- page,
-}) => {
- for (const width of [320, 390, 550]) {
- await page.setViewportSize({ width, height: 800 });
- await page.goto('/components');
- await page.getByRole('button', { name: 'Choose dates' }).click();
- const popover = page.locator('.altertable-date-range-popover');
- await expect(
- popover.getByRole('group', { name: 'Quick ranges' })
- ).toBeVisible();
- const grid = popover.locator('.react-aria-CalendarGrid');
- const sizes = await page.evaluate(() => {
- const popup = document
- .querySelector('.altertable-date-range-popover')!
- .getBoundingClientRect();
- const calendar = document
- .querySelector('.react-aria-CalendarGrid')!
- .getBoundingClientRect();
- return {
- popup: popup.width,
- calendar: calendar.width,
- overflow: document.documentElement.scrollWidth > innerWidth,
- };
- });
- expect(sizes.calendar).toBeGreaterThanOrEqual(sizes.popup - 28);
- expect(sizes.overflow).toBe(false);
- await expect(grid).toBeVisible();
- await expect(popover.getByText('Selected dates')).toBeVisible();
- await expect(popover.getByText('Sep 10–12, 2026')).toBeVisible();
- await expect(popover.getByText('3 days · UTC')).toBeVisible();
- await expect(
- popover.locator(
- '.altertable-date-range-custom .altertable-date-range-compare'
- )
- ).toContainText('Sep 7–9, 2026');
- await page.keyboard.press('Escape');
- }
- await page.setViewportSize({ width: 320, height: 568 });
- await page.goto('/components');
- await page.getByRole('button', { name: 'Choose dates' }).click();
- const compare = page.getByRole('checkbox', {
- name: /Compare with previous period/,
- });
- await compare.scrollIntoViewIfNeeded();
- await expect(compare).toBeVisible();
-});
diff --git a/data-app/tests/harness.spec.ts b/data-app/tests/harness.spec.ts
deleted file mode 100644
index 8f87e753..00000000
--- a/data-app/tests/harness.spec.ts
+++ /dev/null
@@ -1,136 +0,0 @@
-import { expect, test } from '@playwright/test';
-
-test('view binding preserves displayed inputs through comparison, navigation, and failures', async ({
- page,
-}) => {
- let mode: 'ready' | 'empty' | 'error' = 'ready';
- const inputs: {
- range: { start: string; end: string };
- comparison: unknown;
- }[] = [];
- let release: (() => void) | undefined;
- let hold = true;
- await page.route('**/api/data/activity', async route => {
- inputs.push(route.request().postDataJSON());
- if (hold)
- await new Promise(resolve => {
- release = resolve;
- });
- if (mode === 'error')
- return route.fulfill({
- status: 503,
- json: { error: { code: 'source_unavailable', message: 'Unavailable' } },
- });
- return route.fulfill({
- json: {
- data: {
- count: 120,
- features: mode === 'empty' ? [] : ['Queries', 'Insights'],
- },
- queriedAt: '2026-03-12T00:00:00Z',
- requestId: 'fixture',
- queryIds: [],
- },
- });
- });
- await page.goto('/view');
- await expect(page.getByText('Loading activity…')).toBeVisible();
- await expect(page.getByTestId('shared-grid')).toBeVisible();
- expect(inputs[0]).toEqual({
- range: { start: '2026-03-10', end: '2026-03-12' },
- comparison: null,
- });
- hold = false;
- release?.();
- await expect(page.getByText('Results for Mar 10–12, 2026 UTC')).toBeVisible();
- await page
- .getByRole('button', {
- name: 'Explore Activity across product features and organizations',
- })
- .click();
- await expect(page.getByRole('dialog')).toContainText(
- 'Recorded product actions.'
- );
- await page.keyboard.press('Escape');
- await page.getByRole('button', { name: 'Choose dates' }).click();
- await page
- .getByRole('checkbox', { name: /Compare with previous period/ })
- .check();
- await expect
- .poll(() => inputs.at(-1)?.comparison)
- .toEqual({ start: '2026-03-07', end: '2026-03-09' });
- await page.keyboard.press('Escape');
- await expect(page).toHaveURL(/compare=previous/);
- await page.goBack();
- await expect(page).not.toHaveURL(/compare=previous/);
- // A different requested period fails while the visible result keeps its original label.
- mode = 'error';
- await page.evaluate(() => {
- history.pushState(null, '', '?start=2026-03-13&end=2026-03-15');
- dispatchEvent(new PopStateEvent('popstate'));
- });
- await expect(page.getByText('Results for Mar 10–12, 2026 UTC')).toBeVisible();
- await expect(page.getByRole('alert')).toContainText('Mar 10–12, 2026 UTC');
- mode = 'empty';
- await page.getByRole('button', { name: 'Try again' }).click();
- await expect(page.getByText('No activity in this range')).toBeVisible();
- await expect(page.getByTestId('shared-grid')).toHaveCount(0);
- await page.reload();
- mode = 'error';
- await page.reload();
- await expect(page.getByText('Couldn’t load results')).toBeVisible();
-});
-
-test('shared loading and ready layouts fit narrow containers in both themes', async ({
- page,
-}, testInfo) => {
- let release: (() => void) | undefined;
- await page.route('**/api/data/activity', async route => {
- await new Promise(resolve => {
- release = resolve;
- });
- await route.fulfill({
- json: {
- data: {
- count: 120,
- features: ['Long feature names remain readable within their widget'],
- },
- queriedAt: '2026-03-12T00:00:00Z',
- requestId: 'fixture',
- queryIds: [],
- },
- });
- });
- await page.goto('/view');
- await expect(page.getByText('Loading activity…')).toBeVisible();
- for (const width of [320, 550, 900]) {
- await page.setViewportSize({ width, height: 800 });
- const grid = await page.getByTestId('shared-grid').boundingBox();
- const support = await page.getByTestId('shared-support').boundingBox();
- if (width < 640)
- expect(Math.abs(support!.width - grid!.width)).toBeLessThan(2);
- expect(
- await page.evaluate(
- () => document.documentElement.scrollWidth <= innerWidth
- )
- ).toBe(true);
- }
- release?.();
- await expect(page.getByText('Results for Mar 10–12, 2026 UTC')).toBeVisible();
- for (const theme of ['light', 'dark']) {
- if (theme === 'dark')
- await page.getByRole('button', { name: 'Switch to dark theme' }).click();
- for (const width of [320, 550, 900]) {
- await page.setViewportSize({ width, height: 800 });
- expect(
- await page.evaluate(
- () => document.documentElement.scrollWidth <= innerWidth
- )
- ).toBe(true);
- await page.screenshot({
- path: testInfo.outputPath(`view-${theme}-${width}.png`),
- fullPage: true,
- });
- }
- }
-});
diff --git a/data-app/tests/package.json b/data-app/tests/package.json
index d728c3c0..c30f1441 100644
--- a/data-app/tests/package.json
+++ b/data-app/tests/package.json
@@ -16,6 +16,7 @@
"typescript": "7.0.2"
},
"dependencies": {
- "@altertable/data-app": "0.74.0"
+ "@altertable/data-app": "0.78.0",
+ "@altertable/data-app-bun": "0.78.0"
}
}
diff --git a/data-app/tests/query-results.json b/data-app/tests/query-results.json
new file mode 100644
index 00000000..017b7977
--- /dev/null
+++ b/data-app/tests/query-results.json
@@ -0,0 +1,403 @@
+{
+ "2026-09/all": {
+ "costBreakdown/service": {
+ "columns": [
+ "member_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Compute",
+ 720000
+ ],
+ [
+ "Storage",
+ 480000
+ ],
+ [
+ "Networking",
+ 120000
+ ],
+ [
+ "Logging",
+ 0
+ ]
+ ]
+ },
+ "totalCost": {
+ "columns": [
+ "cost_cents",
+ "customer_count"
+ ],
+ "rows": [
+ [
+ 1320000,
+ 3
+ ]
+ ]
+ },
+ "costsByCustomer": {
+ "columns": [
+ "customer_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ 420000
+ ],
+ [
+ "Beacon",
+ 210000
+ ],
+ [
+ "Cedar",
+ 90000
+ ]
+ ]
+ },
+ "costTrend": {
+ "columns": [
+ "period_start",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "2026-09-01",
+ 300000
+ ],
+ [
+ "2026-09-08",
+ 336000
+ ],
+ [
+ "2026-09-15",
+ 324000
+ ],
+ [
+ "2026-09-22",
+ 360000
+ ]
+ ]
+ },
+ "customerServiceMix": {
+ "columns": [
+ "customer_name",
+ "service_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ "Compute",
+ 420000
+ ],
+ [
+ "Atlas",
+ "Logging",
+ 0
+ ],
+ [
+ "Atlas",
+ "Networking",
+ 30000
+ ],
+ [
+ "Atlas",
+ "Storage",
+ 80000
+ ],
+ [
+ "Beacon",
+ "Compute",
+ 210000
+ ],
+ [
+ "Beacon",
+ "Logging",
+ 0
+ ],
+ [
+ "Beacon",
+ "Networking",
+ 60000
+ ],
+ [
+ "Beacon",
+ "Storage",
+ 280000
+ ],
+ [
+ "Cedar",
+ "Compute",
+ 90000
+ ],
+ [
+ "Cedar",
+ "Logging",
+ 0
+ ],
+ [
+ "Cedar",
+ "Networking",
+ 30000
+ ],
+ [
+ "Cedar",
+ "Storage",
+ 120000
+ ]
+ ]
+ },
+ "costBreakdown/customer": {
+ "columns": [
+ "member_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Beacon",
+ 550000
+ ],
+ [
+ "Atlas",
+ 530000
+ ],
+ [
+ "Cedar",
+ 240000
+ ]
+ ]
+ }
+ },
+ "2026-09/Atlas": {
+ "costBreakdown/service": {
+ "columns": [
+ "member_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Compute",
+ 420000
+ ],
+ [
+ "Storage",
+ 80000
+ ],
+ [
+ "Networking",
+ 30000
+ ],
+ [
+ "Logging",
+ 0
+ ]
+ ]
+ },
+ "totalCost": {
+ "columns": [
+ "cost_cents",
+ "customer_count"
+ ],
+ "rows": [
+ [
+ 530000,
+ 1
+ ]
+ ]
+ },
+ "costsByCustomer": {
+ "columns": [
+ "customer_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ 420000
+ ]
+ ]
+ },
+ "costTrend": {
+ "columns": [
+ "period_start",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "2026-09-01",
+ 111000
+ ],
+ [
+ "2026-09-08",
+ 148000
+ ],
+ [
+ "2026-09-15",
+ 117000
+ ],
+ [
+ "2026-09-22",
+ 154000
+ ]
+ ]
+ },
+ "customerServiceMix": {
+ "columns": [
+ "customer_name",
+ "service_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ "Compute",
+ 420000
+ ],
+ [
+ "Atlas",
+ "Logging",
+ 0
+ ],
+ [
+ "Atlas",
+ "Networking",
+ 30000
+ ],
+ [
+ "Atlas",
+ "Storage",
+ 80000
+ ]
+ ]
+ },
+ "costBreakdown/customer": {
+ "columns": [
+ "member_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ 530000
+ ]
+ ]
+ }
+ },
+ "2026-08/Atlas": {
+ "costBreakdown/service": {
+ "columns": [
+ "member_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Compute",
+ 380000
+ ],
+ [
+ "Storage",
+ 80000
+ ],
+ [
+ "Networking",
+ 20000
+ ],
+ [
+ "Logging",
+ 0
+ ]
+ ]
+ },
+ "totalCost": {
+ "columns": [
+ "cost_cents",
+ "customer_count"
+ ],
+ "rows": [
+ [
+ 480000,
+ 1
+ ]
+ ]
+ },
+ "costsByCustomer": {
+ "columns": [
+ "customer_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ 380000
+ ]
+ ]
+ },
+ "costTrend": {
+ "columns": [
+ "period_start",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "2026-08-01",
+ 102000
+ ],
+ [
+ "2026-08-08",
+ 134000
+ ],
+ [
+ "2026-08-15",
+ 106000
+ ],
+ [
+ "2026-08-22",
+ 138000
+ ]
+ ]
+ },
+ "customerServiceMix": {
+ "columns": [
+ "customer_name",
+ "service_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ "Compute",
+ 380000
+ ],
+ [
+ "Atlas",
+ "Logging",
+ 0
+ ],
+ [
+ "Atlas",
+ "Networking",
+ 20000
+ ],
+ [
+ "Atlas",
+ "Storage",
+ 80000
+ ]
+ ]
+ },
+ "costBreakdown/customer": {
+ "columns": [
+ "member_name",
+ "cost_cents"
+ ],
+ "rows": [
+ [
+ "Atlas",
+ 480000
+ ]
+ ]
+ }
+ }
+}
diff --git a/data-app/tests/server.ts b/data-app/tests/server.ts
index 2def910c..3af02258 100644
--- a/data-app/tests/server.ts
+++ b/data-app/tests/server.ts
@@ -1,52 +1,68 @@
-import { DataSourceError } from '@altertable/data-app/contract';
-import { createDataHandler } from '@altertable/data-app/server';
+import { serveLocalApp } from '@altertable/data-app-bun';
-import { operations as activityOperations } from '../starter/fixtures/activity.ts';
-import components from '../starter/fixtures/index.html';
-import view from '../starter/fixtures/view.html';
+import { dataApp } from '../starter/app.ts';
import starter from '../starter/src/index.html';
-import { operations } from '../starter/src/operations.ts';
-let fail = false;
-const handler = createDataHandler(
- { ...operations, ...activityOperations },
- async () => ({
- canDiscloseSql: true,
- lakehouse: {
- async queryAll(statement, options) {
- if (statement.startsWith('SELECT 120 AS count')) {
- if (!options.params?.start || !options.params.end)
- throw new Error('Missing activity params');
- if (fail) throw new DataSourceError('unavailable');
- return {
- columns: [{ name: 'count' }, { name: 'feature' }],
- rows: [
- [120, 'Queries'],
- [120, 'Insights'],
- ],
- };
- }
- if (statement !== 'SELECT 1 AS connection_check' || options.limit !== 1)
- throw new Error('Unexpected connection query');
- if (fail) throw new DataSourceError('unavailable');
- return {
- columns: [{ name: 'connection_check' }],
- rows: [[1]],
- queryId: 'test-query',
- };
- },
- },
- })
-);
-Bun.serve({
- development: false,
+import queryResults from './query-results.json';
+
+let mode = 'success';
+// Mock only the external lakehouse. The app, operations, query transport and SDK are real.
+const lakehouse = Bun.serve({
hostname: '127.0.0.1',
- port: Number(process.env.DATA_APP_TEST_PORT ?? 26418),
- routes: { '/': starter, '/components': components, '/view': view },
+ port: Number(process.env.DATA_APP_TEST_PORT ?? 26418) + 1,
async fetch(request) {
if (new URL(request.url).pathname === '/__test/state') {
- fail = (await request.text()) === 'failure';
+ mode = await request.text();
return new Response('ok');
}
- return handler(request);
+ if (request.headers.get('authorization') !== 'Bearer fixture-token')
+ return new Response('Unauthorized', { status: 401 });
+ if (mode === 'failure') return new Response('Unavailable', { status: 503 });
+ const { statement, params } = (await request.json()) as {
+ statement: string;
+ params: Record;
+ };
+ const query = Object.entries(dataApp.queries).find(
+ ([, definition]) => definition.statement === statement
+ )?.[0];
+ if (!query) return new Response('Unregistered SQL', { status: 400 });
+ // Recorded DuckDB results of the starter's inline VALUES, with no external tables.
+ const scenarios = queryResults as Record<
+ string,
+ Record
+ >;
+ const scenario =
+ scenarios[`${params.month}/${params.customerName || 'all'}`];
+ const result =
+ scenario?.[
+ query === 'costBreakdown' ? `${query}/${params.breakdown}` : query
+ ];
+ if (!result)
+ return new Response('Missing lakehouse fixture', { status: 400 });
+ return new Response(
+ [
+ JSON.stringify({ query_id: `fixture-${query}` }),
+ JSON.stringify(
+ result.columns.map(name => ({
+ name,
+ type:
+ name.endsWith('cents') || name.endsWith('count')
+ ? 'BIGINT'
+ : 'VARCHAR',
+ }))
+ ),
+ ...(mode === 'empty'
+ ? []
+ : result.rows.map(row => JSON.stringify(row))),
+ '',
+ ].join('\n'),
+ { headers: { 'content-type': 'application/x-ndjson' } }
+ );
},
});
+process.env.ALTERTABLE_DATA_PROXY_URL = lakehouse.url.origin;
+process.env.ALTERTABLE_DATA_PROXY_TOKEN = 'fixture-token';
+serveLocalApp({
+ page: starter,
+ app: dataApp,
+ port: Number(process.env.DATA_APP_TEST_PORT ?? 26418),
+});
diff --git a/data-app/tests/starter.spec.ts b/data-app/tests/starter.spec.ts
index 100d64a6..a04f4292 100644
--- a/data-app/tests/starter.spec.ts
+++ b/data-app/tests/starter.spec.ts
@@ -1,51 +1,38 @@
-import { readFile } from 'node:fs/promises';
-
import { expect, test } from '@playwright/test';
+const control = `http://127.0.0.1:${Number(process.env.DATA_APP_TEST_PORT ?? 26418) + 1}/__test/state`;
test.beforeEach(async ({ request }) => {
- await request.post('/__test/state', { data: 'success' });
-});
-
-test('exports the displayed dataset as CSV', async ({ page }) => {
- await page.goto('/components');
- await expect(page.getByText('Connection view ready')).toBeVisible();
- const completed = page.waitForEvent('download');
- await page.getByRole('button', { name: 'Export CSV', exact: true }).click();
- const download = await completed;
- const path = await download.path();
- expect(path).not.toBeNull();
- const csv = await readFile(path!, 'utf8');
- expect(csv).toContain('Order');
- expect(csv).toContain('Order 1');
- expect(csv).toContain('Order 11');
+ await request.post(control, { data: 'success' });
});
-test('connection succeeds only after a query, then offers next steps and a theme button', async ({
+test('distributed example filters registered queries and supports inspection across themes', async ({
page,
}, testInfo) => {
- let release!: () => void;
- const held = new Promise(resolve => {
- release = resolve;
- });
- await page.route('**/api/data/connection', async route => {
- await held;
- await route.continue();
- });
+ const errors: string[] = [];
+ page.on('pageerror', error => errors.push(error.message));
await page.goto('/');
await expect(
- page.getByRole('heading', { name: 'Checking connection…' })
- ).toBeVisible();
- await expect(
- page.getByRole('heading', { name: 'Connected', exact: true })
- ).toHaveCount(0);
- release();
- await expect(
- page.getByRole('heading', { name: 'Connected', exact: true })
+ page.getByRole('heading', { name: 'CLI scaffold test', exact: true })
).toBeVisible();
+ const total = page.getByRole('region', { name: 'Total cost', exact: true });
+ await expect(total.getByText('$13,200.00', { exact: true })).toBeVisible();
+ await page
+ .getByRole('button', { name: 'All customers Customer', exact: true })
+ .click();
+ await page.getByRole('option', { name: 'Atlas', exact: true }).click();
+ await expect(total.getByText('$5,300.00', { exact: true })).toBeVisible();
+ await page
+ .getByRole('button', { name: 'September 2026 Month', exact: true })
+ .click();
+ await page.getByRole('option', { name: 'August 2026', exact: true }).click();
+ await expect(total.getByText('$4,800.00', { exact: true })).toBeVisible();
+ await page
+ .getByRole('button', { name: 'Service Breakdown', exact: true })
+ .click();
+ await page.getByRole('option', { name: 'Customer', exact: true }).click();
await expect(
- page.getByText('Choose a question', { exact: true })
+ page.getByLabel('Costs by customer', { exact: true })
).toBeVisible();
- await expect(page.getByRole('table')).toHaveCount(0);
await page.screenshot({
path: testInfo.outputPath('starter-light.png'),
fullPage: true,
@@ -54,447 +41,108 @@ test('connection succeeds only after a query, then offers next steps and a theme
await expect(
page.getByRole('button', { name: 'Switch to light theme' })
).toBeVisible();
+ await expect(
+ page.getByRole('button', { name: 'August 2026 Month', exact: true })
+ ).toBeEnabled();
await page.screenshot({
+ animations: 'disabled',
path: testInfo.outputPath('starter-dark.png'),
fullPage: true,
});
- await page.reload();
- await expect(
- page.getByRole('button', { name: 'Switch to light theme' })
- ).toBeVisible();
- expect(
- await page.evaluate(
- () => document.documentElement.scrollWidth <= window.innerWidth
- )
- ).toBe(true);
-});
-
-test('failed checks offer retry and invalidate an earlier successful connection', async ({
- page,
- request,
-}) => {
- await request.post('/__test/state', { data: 'failure' });
- await page.goto('/');
- await expect(
- page.getByRole('heading', { name: 'Connection not verified' })
- ).toBeVisible();
- await request.post('/__test/state', { data: 'success' });
- await page.getByRole('button', { name: 'Try again' }).click();
- await expect(
- page.getByRole('heading', { name: 'Connected', exact: true })
- ).toBeVisible();
- await request.post('/__test/state', { data: 'failure' });
await page
- .getByRole('button', { name: 'Check connection', exact: true })
+ .getByRole('button', { name: 'Explore Total cost', exact: true })
.click();
- await expect(
- page.getByRole('heading', { name: 'Connection not verified' })
- ).toBeVisible();
- await expect(page.getByText(/An earlier query succeeded/)).toBeVisible();
-});
-
-test('About the data keeps exploration context and Glossary without Overview', async ({
- page,
-}) => {
- await page.goto('/');
- await page.getByRole('button', { name: 'Explore data' }).click();
- await expect(page.getByRole('tab', { name: 'Glossary' })).toBeVisible();
- await expect(page.getByRole('tab', { name: 'Overview' })).toHaveCount(0);
- await expect(page.getByText(/runs a lightweight query/)).toBeVisible();
-});
-
-test('source identifiers retain exact table and column identity in About the data', async ({
- page,
-}) => {
- await page.goto('/components');
- await page.getByRole('button', { name: 'Explore data' }).click();
- const about = page.getByRole('dialog', { name: 'About the data' });
- await expect(
- about.locator('[data-identifier-id="tables.orders"]')
- ).toHaveText('commerce.sales.orders');
- await expect(
- about.locator('[data-identifier-id="columns.orders.customerId"]')
- ).toHaveText('customer_id');
- await expect(
- about.locator('[data-identifier-id="columns.orders.customerId"]')
- ).toHaveAttribute('title', 'commerce.sales.orders.customer_id');
+ await expect(page.getByRole('dialog')).toContainText('Allocated cost');
+ await page.getByRole('tab', { name: 'Queries', exact: true }).click();
+ await expect(page.getByRole('dialog')).toContainText('totalCost');
expect(
- await about.evaluate(
- element => element.scrollWidth <= element.clientWidth + 1
+ await page.evaluate(
+ () => document.documentElement.scrollWidth <= innerWidth
)
).toBe(true);
+ expect(errors).toEqual([]);
});
-test('glossary definitions open in place on hover and keyboard activation', async ({
- page,
-}) => {
- await page.goto('/components');
- const term = page.getByRole('button', { name: 'Explain Orders' });
- expect(await term.evaluate(element => getComputedStyle(element).cursor)).toBe(
- 'help'
- );
- const restingUnderline = await term.evaluate(
- element => getComputedStyle(element).textDecorationColor
- );
- await term.hover();
- expect(
- await term.evaluate(
- element => getComputedStyle(element).textDecorationColor
- )
- ).not.toBe(restingUnderline);
- const definition = page.getByRole('dialog', { name: 'Orders' });
- await expect(definition).toContainText(
- 'Completed orders grouped by customer_id.'
- );
- await page.mouse.move(0, 0);
- await expect(definition).toHaveCount(0);
- await term.focus();
- await term.press('Enter');
- await expect(definition).toBeVisible();
- await page.keyboard.press('Escape');
- await expect(definition).toHaveCount(0);
-});
-
-test('date comparison offers the preceding range only when available', async ({
- page,
-}) => {
- await page.goto('/components');
- await page.getByRole('button', { name: 'Choose dates' }).click();
- const compare = page.getByRole('checkbox', {
- name: /Compare with previous period/,
- });
- await expect(compare).toBeEnabled();
- await expect(page.getByText('Sep 7–9, 2026')).toBeVisible();
- await compare.check();
- await expect(
- page
- .getByRole('group', { name: 'View controls' })
- .locator('.altertable-date-range-comparison')
- ).toHaveText('vs prior');
- await expect(compare).toBeChecked();
-});
-
-test('Present mode retains navigation, deep links, inspection, and theme switching', async ({
- page,
-}) => {
- await page.goto('/components');
- await page
- .getByRole('button', { name: 'Present story', exact: true })
- .click();
- await expect(
- page.getByRole('heading', { name: 'Orders increased' })
- ).toBeVisible();
- await expect(page).toHaveURL(/present=1.*step=orders/);
- await page.keyboard.press('ArrowRight');
- await expect(
- page.getByRole('heading', { name: 'More returning customers' })
- ).toBeVisible();
- await page.reload();
- await expect(
- page.getByRole('heading', { name: 'More returning customers' })
- ).toBeVisible();
- const dialog = page.getByRole('dialog');
- await dialog.getByRole('button', { name: 'Switch to dark theme' }).click();
- await expect(
- dialog.getByRole('button', { name: 'Switch to light theme' })
- ).toBeVisible();
- await dialog
- .getByRole('button', { name: 'Explore sources', exact: true })
- .click();
- await expect(page.getByRole('tab', { name: 'Glossary' })).toBeVisible();
- await page.getByRole('tab', { name: 'Glossary' }).click();
- await expect(page.getByRole('tabpanel', { name: 'Glossary' })).toContainText(
- 'Completed orders grouped by customer_id.'
- );
- await page.getByRole('tab', { name: 'Queries' }).click();
- await expect(page.getByText('SELECT 1 AS connection_check')).toBeVisible();
- await page.keyboard.press('Escape');
- await expect(page.getByRole('button', { name: 'Close panel' })).toHaveCount(
- 0
- );
- await page.keyboard.press('Escape');
- await expect(page.getByRole('dialog')).toHaveCount(0);
-});
-
-test('data view keeps the last result visible when refresh fails', async ({
+test('loading, empty, failure and recovery keep the example usable', async ({
page,
request,
}, testInfo) => {
- await request.post('/__test/state', { data: 'failure' });
- await page.goto('/components');
- const error = page.getByRole('alert');
- await expect(error).toContainText('Couldn’t load results');
- await expect(error).toContainText('The lakehouse isn’t responding.');
- await expect(error.getByRole('button', { name: 'Retry' })).toBeVisible();
- expect(
- await error.evaluate(element => element.getBoundingClientRect().width)
- ).toBeLessThanOrEqual(520);
- await page.screenshot({
- path: testInfo.outputPath('initial-data-error.png'),
- fullPage: true,
- });
- await request.post('/__test/state', { data: 'success' });
- await error.getByRole('button', { name: 'Retry' }).click();
- await expect(page.getByText('Connection view ready')).toBeVisible();
- await expect(
- page.getByRole('group', { name: 'Reporting period' })
- ).toHaveCount(0);
- await expect(page).toHaveTitle(
- 'Orders exploration • Acme/production • Altertable app'
- );
- await request.post('/__test/state', { data: 'failure' });
- await page.getByRole('button', { name: 'Refresh data' }).click();
- await expect(page.getByText('Connection view ready')).toBeVisible();
- await expect(page.getByRole('alert')).toContainText(
- /Couldn’t refresh. Showing the last result/
- );
-});
-
-test('widget inspection inherits the page glossary and empty states', async ({
- page,
-}) => {
- await page.goto('/components');
- await expect(page.getByText('Connection view ready')).toBeVisible();
- await page.getByRole('button', { name: 'Explore Completed orders' }).click();
- await expect(page.getByRole('dialog')).toContainText(
- 'Completed orders grouped by customer_id.'
- );
- await page.getByRole('tab', { name: 'Queries' }).click();
- await expect(page.getByRole('dialog')).toContainText('connection.sql');
- await expect(
- page.getByRole('region', { name: 'Query notebook' })
- ).toBeVisible();
- await page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
- await page.getByRole('button', { name: 'Copy all', exact: true }).click();
- await expect(
- page.getByRole('button', { name: 'Copied all', exact: true })
- ).toBeVisible();
- expect(await page.evaluate(() => navigator.clipboard.readText())).toContain(
- '-- connection.sql'
- );
-});
-
-test('table pages show bounded rows and reset when filtering changes', async ({
- page,
-}) => {
- await page.goto('/components');
- await expect(page.getByText('Connection view ready')).toBeVisible();
- const table = page.getByRole('table');
- const pagination = page.getByRole('navigation', { name: 'Table pages' });
- await expect(pagination).toContainText('1–4 of 11 results');
- await expect(table.getByText('Order 4')).toBeVisible();
- await expect(table.getByText('Order 5')).toHaveCount(0);
- await pagination.getByRole('button', { name: 'Next page' }).click();
- await expect(pagination).toContainText('5–8 of 11 results');
- await expect(table.getByText('Order 5')).toBeVisible();
- await pagination.getByRole('button', { name: 'Next page' }).click();
- await expect(pagination).toContainText('9–11 of 11 results');
- await expect(
- pagination.getByRole('button', { name: 'Next page' })
- ).toBeDisabled();
- await page.getByRole('searchbox', { name: 'Search orders' }).fill('Order');
- await expect(pagination).toContainText('1–4 of 11 results');
- await page.getByRole('searchbox', { name: 'Search orders' }).fill('Order 5');
- await expect(pagination).toHaveCount(0);
- await expect(table.getByText('Order 5')).toBeVisible();
- await expect(table.locator('tbody tr')).toHaveCount(1);
- await page.getByRole('searchbox', { name: 'Search orders' }).fill('');
- await expect(pagination).toContainText('1–4 of 11 results');
- await expect(
- pagination.getByRole('button', { name: 'Previous page' })
- ).toBeDisabled();
-});
-
-test('request progress appears before Refresh', async ({ page }) => {
- await page.goto('/components');
- await expect(page.getByText('Connection view ready')).toBeVisible();
let release!: () => void;
const held = new Promise(resolve => {
release = resolve;
});
- await page.route('**/api/data/connection', async route => {
+ await page.route('**/api/query/*', async route => {
await held;
await route.continue();
});
- await page.getByRole('button', { name: 'Refresh data' }).click();
- const status = page.locator('.altertable-refresh-status');
- await expect(status).toHaveText('Updating data');
- await expect(status).toBeVisible();
- const label = await status.boundingBox();
- const action = await page
- .getByRole('button', { name: 'Cancel refresh' })
- .boundingBox();
- expect(label!.x + label!.width).toBeLessThan(action!.x);
+ await page.goto('/');
+ await expect(page.getByText('$13,200.00', { exact: true })).toHaveCount(0);
+ await page.screenshot({
+ path: testInfo.outputPath('starter-loading.png'),
+ fullPage: true,
+ });
release();
- await expect(status.getByText('Updating data')).toBeHidden();
-});
-
-test('variables sit below the header divider while actions stay in the header', async ({
- page,
-}) => {
- await page.goto('/components');
- const header = page.locator('.altertable-app-header');
- const bar = page.getByRole('group', { name: 'View controls' });
- const actions = header.getByRole('group', { name: 'Page actions' });
- await expect(bar.getByRole('button', { name: 'Choose dates' })).toBeVisible();
- await expect(
- actions.getByRole('button', { name: 'Refresh data' })
- ).toBeVisible();
- const headerBox = await header.boundingBox();
- const barBox = await bar.boundingBox();
- expect(barBox!.y).toBeGreaterThanOrEqual(headerBox!.y + headerBox!.height);
- expect(
- await page.evaluate(
- () => document.documentElement.scrollWidth <= window.innerWidth
- )
- ).toBe(true);
-});
-
-test('mobile header wraps actions below scope and keeps the description below', async ({
- page,
-}, testInfo) => {
- await page.setViewportSize({ width: 390, height: 844 });
- await page.goto('/components');
- const header = page.locator('.altertable-app-header');
- const title = header.getByRole('heading', { name: 'Orders exploration' });
- const scope = header.locator('.altertable-app-header-context');
- const actions = header.getByRole('group', { name: 'Page actions' });
- const description = header.locator(
- ':scope > .altertable-app-header-heading > p'
- );
- const titleBox = await title.boundingBox();
- const scopeBox = await scope.boundingBox();
- const actionsBox = await actions.boundingBox();
- const descriptionBox = await description.boundingBox();
- expect(scopeBox!.y).toBeGreaterThanOrEqual(titleBox!.y + titleBox!.height);
- expect(actionsBox!.y).toBeGreaterThanOrEqual(scopeBox!.y + scopeBox!.height);
- expect(descriptionBox!.y).toBeGreaterThanOrEqual(
- actionsBox!.y + actionsBox!.height
- );
- await page.screenshot({ path: testInfo.outputPath('mobile-header.png') });
-
- await page.setViewportSize({ width: 280, height: 844 });
- const narrowScope = await scope.boundingBox();
- const narrowActions = await actions.boundingBox();
- expect(narrowActions!.y).toBeGreaterThanOrEqual(
- narrowScope!.y + narrowScope!.height
- );
-});
-
-test('grid uses one gap and keeps shorter panels at content height', async ({
- page,
-}, testInfo) => {
- await page.goto('/components');
- const grid = page.getByTestId('layout-grid');
- const stackGap = await page
- .getByTestId('layout-stack')
- .evaluate(element => getComputedStyle(element).gap);
- const expectedGap = testInfo.project.name === 'desktop' ? 24 : 16;
- expect(stackGap).toBe(`${expectedGap}px`);
- const items = grid.locator(':scope > div');
- const short = await items.nth(0).boundingBox();
- const tall = await items.nth(1).boundingBox();
- expect(short).not.toBeNull();
- expect(tall).not.toBeNull();
- expect(short!.height).toBeLessThan(tall!.height);
- if (testInfo.project.name === 'desktop') {
- expect(Math.round(tall!.x - short!.x - short!.width)).toBe(expectedGap);
- } else {
- expect(Math.round(tall!.y - short!.y - short!.height)).toBe(expectedGap);
- }
- const constrained = page
- .getByTestId('constrained-grid')
- .locator(':scope > div');
- const firstNarrow = await constrained.nth(0).boundingBox();
- const secondNarrow = await constrained.nth(1).boundingBox();
- expect(Math.round(secondNarrow!.x)).toBe(Math.round(firstNarrow!.x));
- expect(
- Math.round(secondNarrow!.y - firstNarrow!.y - firstNarrow!.height)
- ).toBe(expectedGap);
- const border = await page
- .locator('.altertable-app-header')
- .evaluate(element => getComputedStyle(element).borderBottomWidth);
- expect(border).toBe('1px');
-});
-
-test('grid spans respond to their container at phone, tablet, and desktop widths', async ({
- page,
-}) => {
- for (const width of [390, 550, 800, 1280]) {
- await page.setViewportSize({ width, height: 900 });
- await page.goto('/components');
- const primary = await page.getByTestId('primary-grid-item').boundingBox();
- const support = await page.getByTestId('support-grid-item').boundingBox();
- const gap = await page
- .getByTestId('spanned-grid')
- .evaluate(element => getComputedStyle(element).gap);
- expect(gap).toBe(`${Math.max(16, Math.min(24, width * 0.025))}px`);
- const peers = await page.getByTestId('peer-grid').getByRole('region').all();
- const firstPeer = await peers[0]!.boundingBox();
- const lastPeer = await peers[2]!.boundingBox();
- expect(primary).not.toBeNull();
- expect(support).not.toBeNull();
- expect(firstPeer).not.toBeNull();
- expect(lastPeer).not.toBeNull();
- if (width <= 550) {
- expect(support!.y).toBeGreaterThanOrEqual(primary!.y + primary!.height);
- expect(Math.round(support!.x)).toBe(Math.round(primary!.x));
- expect(Math.round(support!.width)).toBe(Math.round(primary!.width));
- expect(lastPeer!.y).toBeGreaterThanOrEqual(
- firstPeer!.y + firstPeer!.height
- );
- expect(Math.round(lastPeer!.width)).toBe(Math.round(primary!.width));
- } else {
- expect(Math.round(primary!.y)).toBe(Math.round(support!.y));
- expect(primary!.width).toBeGreaterThan(support!.width * 1.8);
- expect(Math.round(firstPeer!.y)).toBe(Math.round(lastPeer!.y));
- }
- expect(
- await page.evaluate(
- () => document.documentElement.scrollWidth <= window.innerWidth
- )
- ).toBe(true);
+ await expect(page.getByText('$13,200.00', { exact: true })).toBeVisible();
+ await request.post(control, { data: 'failure' });
+ await page.reload();
+ await expect(page.getByRole('alert').first()).toBeVisible();
+ await page.screenshot({
+ path: testInfo.outputPath('starter-error.png'),
+ fullPage: true,
+ });
+ await request.post(control, { data: 'success' });
+ await page
+ .getByRole('button', { name: 'Retry', exact: true })
+ .first()
+ .click();
+ await expect(page.getByRole('alert')).toHaveCount(3);
+ for (let remaining = 3; remaining > 0; remaining--) {
+ await page
+ .getByRole('button', { name: 'Retry', exact: true })
+ .first()
+ .click();
+ await expect(page.getByRole('alert')).toHaveCount(remaining - 1);
}
+ await request.post(control, { data: 'empty' });
+ await page.reload();
+ await expect(page.getByText('No allocations').first()).toBeVisible();
+ await page.screenshot({
+ path: testInfo.outputPath('starter-empty.png'),
+ fullPage: true,
+ });
});
-test('initial loading keeps the grid shape without displaying snapshot values', async ({
- page,
+test('local transport only accepts registered queries and declared parameters', async ({
+ request,
}) => {
- let release!: () => void;
- const held = new Promise(resolve => {
- release = resolve;
+ const valid = await request.post('/api/query/totalCost', {
+ data: { limit: 1, params: { month: '2026-09', customerName: '' } },
});
- await page.route('**/api/data/connection', async route => {
- await held;
- await route.continue();
- });
- await page.goto('/components');
- const loading = page.getByTestId('loading-skeleton-grid');
- await expect(
- page.getByRole('status', { name: 'Loading orders' })
- ).toBeVisible();
- await expect(page.getByText('Connection view ready')).toHaveCount(0);
- release();
- await expect(page.getByText('Connection view ready')).toBeVisible();
- await expect(loading).toHaveCount(0);
-});
-
-test('authored widget layout gives its main visual more room and stacks on phones', async ({
- page,
-}, testInfo) => {
- await page.goto('/components');
- const story = page.getByTestId('layout-story');
- const lead = await story.getByTestId('story-lead').boundingBox();
- const visual = await story.getByTestId('story-visual').boundingBox();
- const support = await story.getByTestId('story-support').boundingBox();
- expect(lead).not.toBeNull();
- expect(visual).not.toBeNull();
- expect(support).not.toBeNull();
- expect(visual!.y).toBeGreaterThan(lead!.y);
- if (testInfo.project.name === 'desktop') {
- expect(visual!.width).toBeGreaterThan(support!.width);
- expect(Math.round(visual!.y)).toBe(Math.round(support!.y));
- } else {
- expect(support!.y).toBeGreaterThanOrEqual(visual!.y + visual!.height);
- }
+ expect(valid.status()).toBe(200);
+ expect(await valid.json()).toMatchObject({ rows: [[1320000, 3]] });
+ expect(
+ (await request.post('/api/query/missing', { data: { limit: 1 } })).status()
+ ).toBe(404);
+ expect(
+ (
+ await request.post('/api/query/totalCost', {
+ data: { statement: 'SELECT 1', limit: 1 },
+ })
+ ).status()
+ ).toBe(400);
+ expect(
+ (
+ await request.post('/api/query/totalCost', {
+ data: { limit: 1, params: { arbitrarySql: 'DROP TABLE x' } },
+ })
+ ).status()
+ ).toBe(400);
+ expect(
+ (
+ await request.post('/api/query/totalCost', {
+ headers: { origin: 'https://other.example' },
+ data: { limit: 1 },
+ })
+ ).status()
+ ).toBe(403);
});
diff --git a/data-app/tests/tsconfig.json b/data-app/tests/tsconfig.json
index a66a7d72..4e1b78a7 100644
--- a/data-app/tests/tsconfig.json
+++ b/data-app/tests/tsconfig.json
@@ -15,7 +15,6 @@
},
"include": [
"*.ts",
- "../starter/fixtures",
"../starter/src/assets.d.ts"
]
}
diff --git a/package.json b/package.json
index f799e4dd..1c95b773 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"format:check": "bun run --cwd cli format:check",
"test": "bun run --cwd cli test",
"test:watch": "bun run --cwd cli test:watch",
- "setup": "bun install --cwd cli --frozen-lockfile && bun install --cwd data-app/starter --frozen-lockfile && bun install --cwd data-app/tests --frozen-lockfile",
+ "setup": "bun install --cwd cli --frozen-lockfile && bun run --cwd cli data-app:prepare && bun install --cwd data-app/starter --frozen-lockfile && bun install --cwd data-app/tests --frozen-lockfile && bun install --cwd data-app/file-preview --frozen-lockfile",
"check": "./scripts/verify.sh",
"check:package": "bun run --cwd cli pack:check",
"knip": "bun run --cwd cli knip",
From 4550f41994ebb930417a7ba93185b971ca259f1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?=
Date: Thu, 19 Nov 2026 12:58:18 +0100
Subject: [PATCH 2/2] fix(app): load scaffold tools only during app execution
Avoid importing the SDK manifest compiler and reading starter templates for every source CLI invocation. Load and memoize the payload on demand, and pass it explicitly to the pure version and peer helpers.
This removes the startup overhead that caused the five-second lakehouse integration test to time out in CI. Keep the original test deadline and the embedded npm/native payload contract.
---
cli/scripts/package-data-app.ts | 2 +-
cli/scripts/smoke-data-app.ts | 4 ++-
cli/src/commands/app/create.test.ts | 11 +++++---
cli/src/commands/app/create.ts | 3 ++-
cli/src/commands/app/lib/distribution.test.ts | 7 +++--
cli/src/commands/app/lib/file-dev.test.ts | 4 ++-
cli/src/commands/app/lib/file-dev.ts | 5 +++-
cli/src/commands/app/lib/manifest.ts | 11 +++++---
cli/src/commands/app/lib/package.test.ts | 9 +++++--
cli/src/commands/app/lib/package.ts | 9 ++++---
cli/src/commands/app/lib/payload.ts | 14 +++++++---
cli/src/commands/app/upgrade.test.ts | 27 ++++++++++++-------
cli/src/commands/app/upgrade.ts | 7 ++---
13 files changed, 77 insertions(+), 36 deletions(-)
diff --git a/cli/scripts/package-data-app.ts b/cli/scripts/package-data-app.ts
index 85d1d9fd..70175151 100644
--- a/cli/scripts/package-data-app.ts
+++ b/cli/scripts/package-data-app.ts
@@ -10,7 +10,7 @@ export function dataAppPlugin(): BunPlugin {
build.onLoad(
{ filter: /[/\\]commands[/\\]app[/\\]lib[/\\]payload\.ts$/ },
async () => ({
- contents: `export const dataAppPayload = ${JSON.stringify(await readDataAppPayload())};`,
+ contents: `const dataAppPayload = ${JSON.stringify(await readDataAppPayload())}; export function loadDataAppPayload() { return Promise.resolve(dataAppPayload); }`,
loader: 'js',
})
);
diff --git a/cli/scripts/smoke-data-app.ts b/cli/scripts/smoke-data-app.ts
index be9994e9..94bb216a 100644
--- a/cli/scripts/smoke-data-app.ts
+++ b/cli/scripts/smoke-data-app.ts
@@ -3,12 +3,14 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
/** Exercise the shipped CLI outside the checkout, including its embedded starter and published runtime. */
export async function smokeDataApp(
command: string[],
scaffoldOnly = false
): Promise {
+ const version = recommendedDataAppVersion(await loadDataAppPayload());
const directory = await mkdtemp(join(tmpdir(), 'altertable-packaged-app-'));
const app = join(directory, 'app');
let upstream: Bun.Server | undefined;
@@ -174,7 +176,7 @@ export async function smokeDataApp(
'@altertable/data-app-react',
'@altertable/data-app-bun',
]) {
- if (manifest.dependencies?.[name] !== recommendedDataAppVersion())
+ if (manifest.dependencies?.[name] !== version)
throw new Error(
`Packaged starter must pin ${name} to the tested release`
);
diff --git a/cli/src/commands/app/create.test.ts b/cli/src/commands/app/create.test.ts
index ab7e2be2..d78d0bbb 100644
--- a/cli/src/commands/app/create.test.ts
+++ b/cli/src/commands/app/create.test.ts
@@ -13,6 +13,7 @@ import { extractDataAppManifest } from '@altertable/data-app-manifest';
import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import {
configSet,
ensureProfileExists,
@@ -20,6 +21,8 @@ import {
} from '@/lib/profile-store.ts';
import { runCommandWithTestRuntime } from '@/test-utils/cli.ts';
+const dataAppPayload = await loadDataAppPayload();
+
let home: string;
let previousConfigHome: string | undefined;
let previousProfile: string | undefined;
@@ -98,7 +101,7 @@ describe('app create', () => {
expect(
JSON.parse(readFileSync(join(directory, 'package.json'), 'utf8'))
.dependencies['@altertable/data-app']
- ).toBe(recommendedDataAppVersion());
+ ).toBe(recommendedDataAppVersion(dataAppPayload));
expect(existsSync(join(directory, '.altertable/runtime'))).toBe(false);
const paths = JSON.parse(result.stdout[0]!).files as string[];
expect(paths.some(path => path.startsWith('.altertable/'))).toBe(false);
@@ -341,7 +344,7 @@ describe('app create', () => {
'utf8'
)
).version
- ).toBe(recommendedDataAppVersion());
+ ).toBe(recommendedDataAppVersion(dataAppPayload));
for (const name of ['data-app-react', 'data-app-bun']) {
expect(
JSON.parse(
@@ -350,7 +353,7 @@ describe('app create', () => {
'utf8'
)
).version
- ).toBe(recommendedDataAppVersion());
+ ).toBe(recommendedDataAppVersion(dataAppPayload));
}
expect(
existsSync(join(directory, 'node_modules/@altertable/data-app-embed'))
@@ -510,7 +513,7 @@ describe('app create', () => {
expect(JSON.parse(result.stdout[0]!)).toEqual({
directory,
upgraded: false,
- runtimeVersion: recommendedDataAppVersion(),
+ runtimeVersion: recommendedDataAppVersion(dataAppPayload),
nextSteps: [],
});
}
diff --git a/cli/src/commands/app/create.ts b/cli/src/commands/app/create.ts
index 6f3565fa..bfb63d1d 100644
--- a/cli/src/commands/app/create.ts
+++ b/cli/src/commands/app/create.ts
@@ -2,7 +2,7 @@ import { mkdir, rm, writeFile } from 'node:fs/promises';
import { dirname, join, resolve } from 'node:path';
import { createAppFiles } from '@/commands/app/lib/distribution.ts';
-import { dataAppPayload } from '@/commands/app/lib/payload.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import { defineCommand } from '@/lib/command.ts';
import { readEnv } from '@/lib/env.ts';
import { CliError } from '@/lib/errors.ts';
@@ -85,6 +85,7 @@ export const appCreateCommand = defineCommand({
: 'Your organization',
environment: profileName ? environment : 'your environment',
};
+ const dataAppPayload = await loadDataAppPayload();
const files = Object.entries(
createAppFiles(dataAppPayload, { name, title, scope })
);
diff --git a/cli/src/commands/app/lib/distribution.test.ts b/cli/src/commands/app/lib/distribution.test.ts
index ef14b406..0b35fd5e 100644
--- a/cli/src/commands/app/lib/distribution.test.ts
+++ b/cli/src/commands/app/lib/distribution.test.ts
@@ -8,6 +8,9 @@ import { extractDataAppManifest } from '@altertable/data-app-manifest';
import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
import { createAppFiles } from '@/commands/app/lib/distribution.ts';
import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
+
+const dataAppPayload = await loadDataAppPayload();
test('distribution embeds a deterministic starter with an exact package pin and no runtime', async () => {
const payload = await readDataAppPayload();
@@ -18,7 +21,7 @@ test('distribution embeds a deterministic starter with an exact package pin and
const starterPackage = JSON.parse(payload.starter['package.json']!);
expect(previewPackage.dependencies).toEqual({
...starterPackage.dependencies,
- '@altertable/data-app-manifest': recommendedDataAppVersion(),
+ '@altertable/data-app-manifest': recommendedDataAppVersion(dataAppPayload),
});
expect(payload.filePreview['bun.lock']).toContain('typescript');
expect(payload.filePreview['extract-manifest.js']).toContain(
@@ -45,7 +48,7 @@ test('distribution embeds a deterministic starter with an exact package pin and
});
expect(
JSON.parse(files['package.json']!).dependencies['@altertable/data-app']
- ).toBe(recommendedDataAppVersion());
+ ).toBe(recommendedDataAppVersion(dataAppPayload));
expect(JSON.parse(files['package.json']!).dependencies).toMatchObject({
'@altertable/data-app': '0.78.0',
'@altertable/data-app-react': '0.78.0',
diff --git a/cli/src/commands/app/lib/file-dev.test.ts b/cli/src/commands/app/lib/file-dev.test.ts
index eb672577..4867e939 100644
--- a/cli/src/commands/app/lib/file-dev.test.ts
+++ b/cli/src/commands/app/lib/file-dev.test.ts
@@ -5,10 +5,12 @@ import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { prepareFilePreview } from '@/commands/app/lib/file-dev.ts';
-import { dataAppPayload } from '@/commands/app/lib/payload.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import { FROM_ENV_PSEUDOPROFILE_NAME } from '@/lib/profile-store.ts';
import { createLakehouseTestWorkspace } from '@/test-utils/lakehouse.ts';
+const dataAppPayload = await loadDataAppPayload();
+
let workspace: ReturnType;
let savedEnvironment: Record;
beforeEach(() => {
diff --git a/cli/src/commands/app/lib/file-dev.ts b/cli/src/commands/app/lib/file-dev.ts
index 4c829ba7..789ad041 100644
--- a/cli/src/commands/app/lib/file-dev.ts
+++ b/cli/src/commands/app/lib/file-dev.ts
@@ -2,6 +2,8 @@ import {
extractAppManifest,
filePreviewDirectory,
} from '@/commands/app/lib/manifest.ts';
+import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import { readRequiredFile } from '@/commands/app/lib/remote.ts';
import { assertAppScope, profileAppScope } from '@/commands/app/lib/scope.ts';
@@ -10,9 +12,10 @@ export async function prepareFilePreview(
file: string,
profile: string
): Promise {
+ const dataAppPayload = await loadDataAppPayload();
const manifest = await extractAppManifest(
await readRequiredFile(file, 'source')
);
assertAppScope(manifest.scope, profileAppScope(profile), 'data app file');
- return filePreviewDirectory();
+ return filePreviewDirectory(recommendedDataAppVersion(dataAppPayload));
}
diff --git a/cli/src/commands/app/lib/manifest.ts b/cli/src/commands/app/lib/manifest.ts
index 62dacc50..b6a61e2d 100644
--- a/cli/src/commands/app/lib/manifest.ts
+++ b/cli/src/commands/app/lib/manifest.ts
@@ -2,7 +2,7 @@ import { mkdir, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
import { recommendedDataAppVersion } from '@/commands/app/lib/package.ts';
-import { dataAppPayload } from '@/commands/app/lib/payload.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import { runAppCommand } from '@/commands/app/lib/run.ts';
import { configDir } from '@/lib/config-files.ts';
import { copyProcessEnv } from '@/lib/env.ts';
@@ -16,7 +16,10 @@ export type AppManifest = {
/** Parse literals in the pinned tooling process, without evaluating app code. */
export async function extractAppManifest(source: string): Promise {
- const directory = filePreviewDirectory();
+ const dataAppPayload = await loadDataAppPayload();
+ const directory = filePreviewDirectory(
+ recommendedDataAppVersion(dataAppPayload)
+ );
await mkdir(directory, { recursive: true });
await Promise.all(
Object.entries(dataAppPayload.filePreview).map(([name, content]) =>
@@ -71,6 +74,6 @@ export async function extractAppManifest(source: string): Promise {
return manifest as AppManifest;
}
-export function filePreviewDirectory(): string {
- return join(configDir(), 'data-app-dev', recommendedDataAppVersion());
+export function filePreviewDirectory(version: string): string {
+ return join(configDir(), 'data-app-dev', version);
}
diff --git a/cli/src/commands/app/lib/package.test.ts b/cli/src/commands/app/lib/package.test.ts
index ea0808d8..fdf20666 100644
--- a/cli/src/commands/app/lib/package.test.ts
+++ b/cli/src/commands/app/lib/package.test.ts
@@ -10,6 +10,9 @@ import {
recommendedDataAppPeers,
requirePublishedDataApp,
} from '@/commands/app/lib/package.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
+
+const dataAppPayload = await loadDataAppPayload();
let directory: string;
beforeEach(async () => {
@@ -116,8 +119,10 @@ for (const name of dataAppPackages.slice(1)) {
}
test('React peers belong to the authoring package while core has none', () => {
- expect(recommendedDataAppPeers([dataAppPackage])).toEqual({});
- expect(recommendedDataAppPeers(['@altertable/data-app-react'])).toEqual({
+ expect(recommendedDataAppPeers(dataAppPayload, [dataAppPackage])).toEqual({});
+ expect(
+ recommendedDataAppPeers(dataAppPayload, ['@altertable/data-app-react'])
+ ).toEqual({
react: '>=19.2.0',
'react-dom': '>=19.2.0',
});
diff --git a/cli/src/commands/app/lib/package.ts b/cli/src/commands/app/lib/package.ts
index df3ad8d1..e9981a4b 100644
--- a/cli/src/commands/app/lib/package.ts
+++ b/cli/src/commands/app/lib/package.ts
@@ -1,7 +1,7 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
-import { dataAppPayload } from '@/commands/app/lib/payload.ts';
+import type { DataAppPayload } from '@/commands/app/lib/distribution.ts';
import { ConfigurationError } from '@/lib/errors.ts';
import { isRecord } from '@/lib/object.ts';
@@ -20,7 +20,9 @@ type AppPackage = {
devDependencies?: Record;
};
-export function recommendedDataAppVersion(): string {
+export function recommendedDataAppVersion(
+ dataAppPayload: DataAppPayload
+): string {
const version = JSON.parse(dataAppPayload.starter['package.json']!)
.dependencies[dataAppPackage];
if (
@@ -148,12 +150,13 @@ export function lockedVersion(
}
export function recommendedDataAppPeers(
+ dataAppPayload: DataAppPayload,
names: readonly string[] = dataAppPackages
): Record {
const { packages } = readAppLock(
dataAppPayload.starter['bun.lock']!,
'CLI starter',
- recommendedDataAppVersion()
+ recommendedDataAppVersion(dataAppPayload)
);
const peers: Record = {};
for (const name of names) {
diff --git a/cli/src/commands/app/lib/payload.ts b/cli/src/commands/app/lib/payload.ts
index bb1566c5..56004de2 100644
--- a/cli/src/commands/app/lib/payload.ts
+++ b/cli/src/commands/app/lib/payload.ts
@@ -1,4 +1,12 @@
-import { readDataAppPayload } from '@/commands/app/lib/distribution-source.ts';
+import type { DataAppPayload } from '@/commands/app/lib/distribution.ts';
-// Source execution reads project templates. Release builds replace this module with literal data.
-export const dataAppPayload = await readDataAppPayload();
+let payloadPromise: Promise | undefined;
+
+// Load SDK build tools only when an app command needs the source templates.
+// Release builds replace this module with the already embedded payload.
+export function loadDataAppPayload(): Promise {
+ return (payloadPromise ??=
+ import('@/commands/app/lib/distribution-source.ts').then(
+ ({ readDataAppPayload }) => readDataAppPayload()
+ ));
+}
diff --git a/cli/src/commands/app/upgrade.test.ts b/cli/src/commands/app/upgrade.test.ts
index 64090fcb..9fb368ac 100644
--- a/cli/src/commands/app/upgrade.test.ts
+++ b/cli/src/commands/app/upgrade.test.ts
@@ -11,8 +11,11 @@ import {
readAppLock,
recommendedDataAppVersion,
} from '@/commands/app/lib/package.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import { upgradeApp } from '@/commands/app/upgrade.ts';
+const dataAppPayload = await loadDataAppPayload();
+
const directories: string[] = [];
afterEach(async () => {
await Promise.all(
@@ -95,7 +98,8 @@ test('an exact current pin is a no-op', async () => {
test('failed resolution restores the manifest and lockfile', async () => {
const directory = await fixture();
await updateManifest(directory, pkg => {
- pkg.dependencies[dataAppPackage] = `^${recommendedDataAppVersion()}`;
+ pkg.dependencies[dataAppPackage] =
+ `^${recommendedDataAppVersion(dataAppPayload)}`;
});
const before = await snapshot(directory);
await expectUpgradeFailure(
@@ -114,7 +118,8 @@ test('failed resolution restores the manifest and lockfile', async () => {
test('a stale resolved lockfile restores the manifest and lockfile', async () => {
const directory = await fixture();
await updateManifest(directory, pkg => {
- pkg.dependencies[dataAppPackage] = `^${recommendedDataAppVersion()}`;
+ pkg.dependencies[dataAppPackage] =
+ `^${recommendedDataAppVersion(dataAppPayload)}`;
});
const before = await snapshot(directory);
await expectUpgradeFailure(
@@ -157,7 +162,8 @@ test('registry upgrades pin a compatible range and preserve unrelated dependenci
const pkg = JSON.parse(
await readFile(join(directory, 'package.json'), 'utf8')
);
- pkg.dependencies[dataAppPackage] = `^${recommendedDataAppVersion()}`;
+ pkg.dependencies[dataAppPackage] =
+ `^${recommendedDataAppVersion(dataAppPayload)}`;
pkg.dependencies.yaml = '2.9.0';
pkg.scripts.custom = 'echo user-owned';
await writeFile(join(directory, 'package.json'), JSON.stringify(pkg));
@@ -182,7 +188,7 @@ test('registry upgrades pin a compatible range and preserve unrelated dependenci
).toMatchObject({
dependencies: {
yaml: '2.9.0',
- [dataAppPackage]: recommendedDataAppVersion(),
+ [dataAppPackage]: recommendedDataAppVersion(dataAppPayload),
},
scripts: { custom: 'echo user-owned' },
});
@@ -244,7 +250,7 @@ test('upgrade pins every declared split package and preserves dependency placeme
);
for (const name of dataAppPackages)
packages[name] = [
- `${name}@${recommendedDataAppVersion()}`,
+ `${name}@${recommendedDataAppVersion(dataAppPayload)}`,
'',
{},
'integrity',
@@ -261,11 +267,11 @@ test('upgrade pins every declared split package and preserves dependency placeme
);
for (const name of dataAppPackages)
expect(next.dependencies[name] ?? next.devDependencies[name]).toBe(
- recommendedDataAppVersion()
+ recommendedDataAppVersion(dataAppPayload)
);
expect(next.dependencies['@altertable/data-app-bun']).toBeUndefined();
expect(next.devDependencies['@altertable/data-app-bun']).toBe(
- recommendedDataAppVersion()
+ recommendedDataAppVersion(dataAppPayload)
);
expect(await readFile(join(directory, 'src/App.tsx'), 'utf8')).toBe(
appSource
@@ -276,7 +282,7 @@ test('failed split-package resolution rolls back even when core resolves correct
const directory = await fixture();
await updateManifest(directory, pkg => {
pkg.dependencies['@altertable/data-app-react'] =
- `^${recommendedDataAppVersion()}`;
+ `^${recommendedDataAppVersion(dataAppPayload)}`;
});
const before = await snapshot(directory);
await expectUpgradeFailure(
@@ -335,7 +341,8 @@ test('portable-only upgrades do not add React or local-server packages', async (
'react-dom',
])
delete pkg.dependencies[name];
- pkg.dependencies[dataAppPackage] = `^${recommendedDataAppVersion()}`;
+ pkg.dependencies[dataAppPackage] =
+ `^${recommendedDataAppVersion(dataAppPayload)}`;
});
expect(
await upgradeApp(directory, {
@@ -358,7 +365,7 @@ test('portable-only upgrades do not add React or local-server packages', async (
JSON.parse(await readFile(join(directory, 'package.json'), 'utf8'))
.dependencies
).toEqual({
- [dataAppPackage]: recommendedDataAppVersion(),
+ [dataAppPackage]: recommendedDataAppVersion(dataAppPayload),
});
});
diff --git a/cli/src/commands/app/upgrade.ts b/cli/src/commands/app/upgrade.ts
index 16660662..77bc98f9 100644
--- a/cli/src/commands/app/upgrade.ts
+++ b/cli/src/commands/app/upgrade.ts
@@ -10,7 +10,7 @@ import {
recommendedDataAppPeers,
recommendedDataAppVersion,
} from '@/commands/app/lib/package.ts';
-import { dataAppPayload } from '@/commands/app/lib/payload.ts';
+import { loadDataAppPayload } from '@/commands/app/lib/payload.ts';
import { appDirectory } from '@/commands/app/lib/run.ts';
import { defineCommand } from '@/lib/command.ts';
import { copyProcessEnv } from '@/lib/env.ts';
@@ -71,7 +71,8 @@ export async function upgradeApp(
directory: string,
options: UpgradeOptions = {}
): Promise {
- const version = recommendedDataAppVersion();
+ const dataAppPayload = await loadDataAppPayload();
+ const version = recommendedDataAppVersion(dataAppPayload);
const { source: originalPackage, manifest } = await readAppPackage(directory);
const reference = manifest.dependencies?.[dataAppPackage];
if (!reference || !/^[\d~^<>=*]/.test(reference)) {
@@ -113,7 +114,7 @@ export async function upgradeApp(
const defaults = JSON.parse(dataAppPayload.starter['package.json']!)
.dependencies as Record;
let packageChanged = names.some(name => dependencies[name] !== version);
- const peers = recommendedDataAppPeers(names);
+ const peers = recommendedDataAppPeers(dataAppPayload, names);
for (const [name, range] of Object.entries(peers)) {
const existing =
manifest.dependencies?.[name] ?? manifest.devDependencies?.[name];