feat(appkit): add the database runtime and harden its schema builder - #525
Merged
Conversation
Repair schema invariants and add a bounded Drizzle execution boundary for future database APIs. Signed-off-by: ditadi <victordperd@gmail.com>
Contributor
📦 Bundle size reportCompared against
|
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 936 KB (+30 KB) | 325 KB (+8.5 KB) |
| Type declarations | 345 KB (+1.2 KB) | 120 KB (+499 B) |
| Source maps | 1.8 MB (+58 KB) | 610 KB (+14 KB) |
| Other | 11 KB | 3.7 KB |
| Total | 3.1 MB (+89 KB) | 1.0 MB (+23 KB) |
Per-entry composition (own code — deps external (as shipped))
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
. |
93 KB (+4.9 KB) | 2.5 KB | 96 KB (+4.9 KB) | external | 306 KB (+17 KB) |
./beta |
55 KB (+5.0 KB) | 457 B | 56 KB (+5.0 KB) | external | 166 KB (+18 KB) |
./testing |
17 KB | 0 B | 17 KB | external | 50 KB |
./tsdown |
520 B | 0 B | 520 B | external | 813 B |
./type-generator |
21 KB | 0 B | 21 KB | external | 61 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
. |
index.js |
initial | 89 KB |
. |
utils.js |
initial | 4.0 KB |
. |
remote-tunnel-manager.js |
lazy | 2.5 KB |
./beta |
beta.js |
initial | 39 KB |
./beta |
stream-manager.js |
initial | 5.8 KB |
./beta |
wide-event-emitter.js |
initial | 3.2 KB |
./beta |
databricks.js |
initial | 3.0 KB |
./beta |
configuration.js |
initial | 2.1 KB |
./beta |
service-context.js |
initial | 1.3 KB |
./beta |
client.js |
initial | 434 B |
./beta |
client-options.js |
initial | 220 B |
./beta |
supervisor-api.js |
lazy | 192 B |
./beta |
databricks.js |
lazy | 142 B |
./beta |
index.js |
lazy | 123 B |
./testing |
index.js |
initial | 17 KB |
./tsdown |
index.js |
initial | 520 B |
./type-generator |
index.js |
initial | 21 KB |
@databricks/appkit-ui
npm tarball (packed): 348 KB (+5 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 394 KB | 132 KB |
| Type declarations | 228 KB (+32 B) | 83 KB (+8 B) |
| Source maps | 764 KB | 252 KB |
| CSS | 16 KB | 3.2 KB |
| Total | 1.4 MB (+32 B) | 471 KB (+8 B) |
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
./js |
5.3 KB | 49 KB | 55 KB | 208 KB | 14 KB |
./js/beta |
20 B | 0 B | 20 B | 0 B | 0 B |
./react |
432 KB | 49 KB | 481 KB | 1.3 MB | 177 KB |
./react/beta |
1.0 KB | 0 B | 1.0 KB | 0 B | 1.9 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
./js |
index.js |
initial | 5.2 KB |
./js |
chunk |
initial | 120 B |
./js |
apache-arrow |
lazy | 49 KB |
./js/beta |
beta.js |
initial | 20 B |
./react |
index.js |
initial | 430 KB |
./react |
tslib |
initial | 2.1 KB |
./react |
apache-arrow |
lazy | 49 KB |
./react/beta |
beta.js |
initial | 1.0 KB |
ditadi
requested review from
MarioCadenas and
atilafassina
and
a balanced review from Copilot
and removed request for
pkosiec
August 10, 2026 22:16
Contributor
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh run download 32745542461 -R databricks/appkit -n appkit-template-0.64.0-pr.8fee458-stack-database-mvp-01-runtime-525 -D appkit-pr-525 \
&& unzip -o "appkit-pr-525/appkit-template-0.64.0-pr.8fee458-stack-database-mvp-01-runtime-525.zip" -d "appkit-pr-525" \
&& databricks apps init --template "appkit-pr-525"The template pins |
atilafassina
left a comment
Contributor
There was a problem hiding this comment.
Awesome work. just 2 question/suggestions before approving :)
Keep this branch's schema-builder and runtime refactor over oxfmt-only edits from main, and drop tests for APIs this branch already removed. Signed-off-by: ditadi <victordperd@gmail.com>
atilafassina
approved these changes
Aug 20, 2026
Signed-off-by: ditadi <victordperd@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
Each PR targets the one above it. This one is the base of the stack, so its diff is against
main.What
Rebuilds
packages/appkit/src/database/into a foundation the upcomingDatabasePlugincan be built on: the schema builder now rejects the declarations it used to accept silently, and a new runtime layer gives every future database API a single, bounded path to PostgreSQL.Nothing here is exported. Neither
index.tsnorbeta.tsreaches intodatabase/today, so this PR changes no public API and no generated types or docs — it is groundwork, reviewable on its own, and the plugin that consumes it lands in the following PRs.Changes
A backend-neutral execution boundary (
database/runtime/)DataPathis the only interface the layers above will talk to —select,findOne,count,insert,update,upsert,delete,raw, andtransaction. Its field names are schema keys that an adapter resolves through column metadata, never caller-supplied SQL identifiers. The Drizzle adapter and thetranslatemodule behind it hold the guarantees:rawSQL interpolates values only; a structural interpolation is rejected.DEFAULT_LIMIT, explicit bounds are validated againstMAX_LIMIT, and to-many includes are bounded the same way..private()never leaves the database unless it is asked for by name.inlists are bounded, an emptyinhas deterministic semantics rather than matching everything, null matching is only everis: null, and an emptyand/orgroup is rejected instead of silently widening the query.insertandupsertmust produce exactly one row,updateanddeleteaccept zero or one and reject many.Schema-builder invariants
The builder previously accepted declarations that could not hold at runtime. It now refuses them at declaration time:
SET NULLrequires a nullable column andSET DEFAULTa compatible local default. A generated identity mirrors to non-generated integer storage on the referencing side.varcharlengths and enum declarations, record literal defaults rather than synthesizing them, and restrict thedefaultNow/defaultRandomhelpers to the timestamp and UUID kinds.defineSchemarequires each declared table exactly once, rejects aliases and duplicate handles, validates literal defaults against both storage and enum values, refuses a table that would overwrite Drizzle relation metadata, and no longer leaves handles half-finalized when validation fails partway through.Removals
.owner()and theisOwnermetadata it set are gone. They described row ownership for an RLS story this runtime does not implement, and nothing in the repository called them.contract/column-info.ts,contract/relation.ts, andschema-builder/private.tswere folded into the modules that own their data, which narrows the internal barrel accordingly.Verification
pnpm vitest run— 3966 passing, 1 skippedpnpm -r typecheck— clean across all packagespnpm run generate:types,pnpm run sync:template, andpnpm run docs:buildproduce no drift, as expected for a change with no exported surfacemainat v0.57.0