Skip to content

feat(appkit): add appkit db init, clean and seed - #672

Draft
ditadi wants to merge 75 commits into
stack/database-dev-flow/04-db-introspectfrom
stack/database-dev-flow/05-db-init
Draft

ditadi wants to merge 75 commits into
stack/database-dev-flow/04-db-introspectfrom
stack/database-dev-flow/05-db-init

Conversation

@ditadi

@ditadi ditadi commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🥞 Stacked PR (generated by Stack)

Use this link to review incremental changes.


Stacked on #670. The design is #677.

What did you change, and why?

Each checkout needs its own Lakebase branch for local development, set up without prompts so an agent or a script can run it. This PR adds appkit db init, appkit db clean and appkit db seed.

appkit db init uses your dev-<you>-<hash> branch, or with --session a session-<user hash>-<id> branch that expires after 7 days (--ttl changes that). It forks a new branch from the branch the default databricks.yml target binds, or from the project's default branch when that target does not resolve, and says which. It makes sure the branch has a read-write endpoint that suspends after 5 idle minutes and your Postgres role with DATABRICKS_SUPERUSER, and points .env at the branch. It hands you the app schema when the fork copied it owned by another Lakebase role, such as the app's service principal.

Then init starts the schema, which it decides from the branch (see the fix round below). --schema migrate, introspect, clean and none choose a start explicitly. init installs the pinned drizzle-kit for every start except none when the app lacks it. init refuses the project's default branch, protected branches and any branch the deploy boundary covers, before it changes anything.

clean drops the app schema, migration journal included, in one transaction. On public it drops only what your role owns. clean --delete-branch deletes this checkout's session branch. seed runs config/database/seed.sql in one transaction. clean and seed run only on your dev or session branch. .env is written with mode 0600 through a temporary file, and a symlinked .env is refused.

This revision changes these behaviors:

  • init checks its planned branch against the whole deploy boundary from feat(appkit): add appkit db migrate #666. A databricks.yml reference the checkout's files cannot resolve refuses init before any API call or .env write.
  • init holds one history lock for its whole run, across the clean, migrate or introspect it starts. clean holds the lock too. clean, and init with --schema migrate or --schema clean, refuse a missing schema.ts before taking the lock, so a refused run leaves no empty config/database.
  • init --schema none reads no schema.ts, takes no lock, and hands off nothing. The schema and its owner stay as the fork copied them.
  • Schema public is never handed off. It belongs to the database, so AppKit never deletes its owner or reassigns its objects.
  • bundle-size-baseline.json is regenerated. The packed tarball grows from 1,364,290 to 1,448,119 bytes (+6.14%), over the 5% budget, because ./beta/database-tooling grows from 28 KB to 45 KB gzipped.

Session branch names carry a hash of your user name (#666). init treats .env as this checkout's session branch only when the name matches your hash, so a .env copied from another developer never leads init to their branch. appkit db stays hidden from appkit --help.

Review round, 2026-11-09:

  • A branch init forks starts without the rows the fork copied: clean with schema.ts, or introspect and then a rebuild from the baseline. --schema migrate or --schema introspect keeps them; a reused branch is migrated as before. In public, the report lists what other roles own and keep.
  • init refuses a database databricks.yml binds that the fork lacks, reads the deploy target through variable-overrides.json, resumes an interrupted session rotation, reconciles with a concurrent run that created the endpoint or role first, writes PGSSLMODE=require over weaker values, and hands off and introspects the schema schema.ts declares.
  • The schema hand-off refuses when the copied owner also owns objects outside the app schema; clean previews the full CASCADE closure; drizzle-kit's installer uses shared's package-manager detection; .env rewrites recognise KEY: value and go through tooling/files.ts; the .env temp file is git-ignored in the template.

Fix round for fjakobs's review of #677, 2026-11-15:

  • The APPKIT_DB_NEW_BRANCH marker is gone (L236, L690). init reads the branch. An app schema still owned by another role is an untouched copy, and init rebuilds it. Before the hand-off, init tags the copied journal with one row, only in a journal the migrator trusts, so a rerun from any checkout finishes an interrupted rebuild. A branch this run created is rebuilt even when you already owned the source schema. When the copy cannot be tagged, init warns first.
  • --schema none touches nothing, so the next plain init still rebuilds a copy. Explicit --schema migrate or introspect keep the rows and say that --schema clean removes them. migrate, introspect and seed refuse an untouched or tagged copy.
  • init installs drizzle-kit for every start except none (L541), and forks the branch the default databricks.yml target binds when it resolves (L633). The hand-off error stops suggesting ALTER ... OWNER TO.
  • A declined clean is an init outcome instead of a named error, and the report says why init rebuilt.

How do you know it works?

  • init.test.ts runs runInit against an in-memory Lakebase. It covers branch creation and reuse, session TTLs, a 403, a 409, the branch limit, and deploy-target and unresolved refusals before any API call. It also covers the hand-off and its failures, --schema none, public, and one lock across init's clean and migrate.
  • env-file.test.ts, clean-seed.test.ts and the CLI's init-clean-seed.test.ts cover the .env writer, the clean and seed refusals, the confirmations and the exit codes.
  • clean.pg.test.ts and hand-off.pg.test.ts run against Postgres. They check what CASCADE takes outside the app schema, a public clean, and the objects and grants that block a role delete.
  • At this PR's head, the database, plugin and CLI db tests passed against a local PostgreSQL 14, typecheck passed, and a clean build matched the new size baseline. The full vitest suite passed at an earlier revision of this PR and at the top of the stack (feat(appkit): add appkit db check #678). The packed tarballs export the same root and ./beta names as main, and ./beta/database-tooling adds only init, clean, seed and session-branch deletion. CI runs the full suite on this PR.
  • This revision was not run against a real Lakebase workspace, so who owns public on a real Lakebase branch was not observed.

Review round, 2026-11-09: each fix has a failing-then-passing test in its PR, and every layer's appkit and shared tests ran against Postgres 14 after the sync. At the top of the stack, pnpm build, pnpm test (6502 passed, 1 skipped), pnpm -r typecheck, pnpm check, pnpm knip and pnpm docs:build pass.

Fix round for fjakobs's review, 2026-11-15: each fix has a failing-then-passing test in its PR, and every layer's database, plugin and CLI tests ran against Postgres 17 after the sync. A throwaway Lakebase fork confirmed that the developer role can write the service principal's rows but cannot alter its tables. At the top of the stack, pnpm test (6602 passed, 1 skipped), pnpm -r typecheck, pnpm build and pnpm docs:build pass, and oxlint and oxfmt are clean on every changed file.

`appkit db init` gives a checkout its own Lakebase branch, forked from the
project's default branch: your dev branch, or with --session a branch for
this checkout that expires after 7 days (or --ttl). It asks nothing. It
refuses the default branch, protected branches and branches databricks.yml
deploys to before any change, and when the project is at its branch limit it
lists your branches to delete.

It makes sure the branch has a read-write endpoint that suspends after 5 idle
minutes and a Postgres role for you, points .env at it with an atomic 0600
write, hands you the app schema when the fork copied it owned by another
Lakebase role, installs drizzle-kit when the app lacks it, then starts the
schema by migrating, introspecting or cleaning.

`appkit db clean` drops the app schema (only your objects in public) and
lists what outside it went along; --delete-branch deletes this checkout's
session branch instead. `appkit db seed` runs config/database/seed.sql in one
transaction with the app schema on the search_path. Both run only on a branch
created for you or this checkout.

Signed-off-by: ditadi <victordperd@gmail.com>
@ditadi
ditadi force-pushed the stack/database-dev-flow/05-db-init branch from c56de21 to 98ef27b Compare October 20, 2026 12:22
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 41109404809 -R databricks/appkit -n appkit-template-0.89.0-pr.aa5285d-stack-database-dev-flow-05-db-init-672 -D appkit-pr-672 \
  && unzip -o "appkit-pr-672/appkit-template-0.89.0-pr.aa5285d-stack-database-dev-flow-05-db-init-672.zip" -d "appkit-pr-672" \
  && databricks apps init --template "appkit-pr-672"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle size report

Compared against bundle-size-baseline.json (main).

@databricks/appkit

npm tarball (packed): 1.4 MB (+89 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 1.4 MB (+78 B) 515 KB (+4 B)
Type declarations 478 KB 175 KB (+2 B)
Source maps 2.8 MB (+317 B) 958 KB (+88 B)
Other 11 KB 3.7 KB
Total 4.7 MB (+395 B) 1.6 MB (+94 B)
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 106 KB 2.5 KB 108 KB external 343 KB
./beta 108 KB 485 B 108 KB external 323 KB
./beta/database-tooling 45 KB (+16 B) 0 B 45 KB (+16 B) external 134 KB (+50 B)
./testing 45 KB 32 KB 77 KB external 223 KB
./tsdown 520 B 0 B 520 B external 813 B
./type-generator 26 KB 0 B 26 KB external 74 KB

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 101 KB
. utils.js initial 4.6 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 88 KB
./beta modular.js initial 6.0 KB
./beta stream-manager.js initial 5.9 KB
./beta service-context.js initial 4.2 KB
./beta databricks.js initial 3.3 KB
./beta client.js initial 647 B
./beta index.js initial 20 B
./beta supervisor-api.js lazy 192 B
./beta databricks.js lazy 178 B
./beta index.js lazy 115 B
./beta/database-tooling index.js initial 45 KB
./testing manifest.js initial 32 KB
./testing index.js initial 10 KB
./testing wide-event-emitter.js initial 2.9 KB
./testing index.js lazy 28 KB
./testing remote-tunnel-manager.js lazy 2.5 KB
./testing utils.js lazy 1.8 KB
./tsdown index.js initial 520 B
./type-generator index.js initial 26 KB

@databricks/appkit-ui

npm tarball (packed): 397 KB (+4 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 429 KB 147 KB
Type declarations 267 KB 98 KB (+1 B)
Source maps 853 KB 286 KB
CSS 16 KB 3.2 KB
Total 1.5 MB 534 KB (+1 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 2.1 KB 0 B 2.1 KB 0 B 5.0 KB
./react 433 KB 49 KB 481 KB 1.3 MB 177 KB
./react/beta 4.9 KB 0 B 4.9 KB 0 B 12 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 2.1 KB
./react index.js initial 431 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 4.9 KB

ditadi and others added 14 commits October 30, 2026 16:31
Signed-off-by: ditadi <victordperd@gmail.com>

# Conflicts:
#	packages/appkit/src/database/tooling/migrate.ts
#	packages/appkit/src/database/tooling/naming.ts
#	packages/appkit/src/database/tooling/tests/guard.test.ts
#	packages/appkit/src/database/tooling/tests/naming.test.ts
#	packages/appkit/src/database/tooling/tests/targets.test.ts
init still checked its planned branch against the readDeployBranches list that
the deploy boundary replaced. It now asks deployRefusal, like every other
guard, so a binding the checkout's files cannot resolve refuses init before any
API call or .env write. readDeployTarget reads the default target from the same
bundle model: its first resolved app binding, else its postgres_branch and
postgres_database variables. The shared CLI test mocks the beta tooling path.

Signed-off-by: ditadi <victordperd@gmail.com>
Signed-off-by: ditadi <victordperd@gmail.com>
clean drops the branch's migration journal, and init runs clean, migrate or
introspect after its own checks, so another appkit db command could run in
between. runClean now holds the checkout's history lock, and init holds one lock
for its whole run and hands it to cleanHolding, migrateHolding and
introspectHolding. init --schema none changes no history, so it takes no lock
and creates no config/database.

Signed-off-by: ditadi <victordperd@gmail.com>
init --schema none still handed the app schema to the developer, which deletes
the branch copy of the role that owns it, in apps that may have no database
schema contract at all. It now leaves the schema and its owner as the fork
copied them. Schema public is never handed off either: it belongs to the
database (pg_database_owner on PostgreSQL 15 and later, the bootstrap superuser
before), so AppKit never deletes its owner or reassigns its objects.

Signed-off-by: ditadi <victordperd@gmail.com>
Regenerated with pnpm clean && pnpm build && pnpm size:baseline. Against the
previous baseline the @databricks/appkit packed tarball grows from 1364290 to
1448119 bytes (+83829, +6.14%), over the 5% budget. The growth is the CLI-only
@databricks/appkit/beta/database-tooling entry (45 KB gzipped, from 28 KB) with
the introspect fixes and init, clean and history lock code it ships.
@databricks/appkit-ui is unchanged at 406741 bytes.

Signed-off-by: ditadi <victordperd@gmail.com>
The re-run test ran with --schema none, which skips the hand-off, so no test
reached the check that keeps init from deleting your own role. It now runs the
default migrate start and asserts that the owner query ran for schema app and
no role was deleted.

Signed-off-by: ditadi <victordperd@gmail.com>
init --schema none hands off no schema and starts none, but it still loaded
schema.ts for the schema name, so a half-edited file stopped a branch-only
init. It now loads schema.ts only when the hand-off and the start use it.

Signed-off-by: ditadi <victordperd@gmail.com>
…e lock

withHistoryLock creates config/database for its lock file, and init and clean
checked for schema.ts only after taking it, so a refused init or clean left an
empty config/database behind. Both now check first, as runMigrate does.

Signed-off-by: ditadi <victordperd@gmail.com>
dotenv 16.6.1 reads `KEY: value` (a colon followed by whitespace) as an
entry, and a later entry wins. updateEnvFile's parser only knows `KEY=`, so
a later `PGHOST: old` outlives the rewrite and dotenv reads the old host.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
updateEnvFile only recognized `KEY=`. dotenv 16.6.1 also reads `KEY: value`
when whitespace follows the colon, and its last entry wins, so a later
`PGHOST: old` outlived the rewrite. The parser now treats that form as an
entry too and writes it back as `KEY=`.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…nv through

updateEnvFile writes `..env.<pid>.<hex>.tmp` and renames it over .env. A run
killed between the two leaves the file, which holds the .env contents, and
nothing ignored it.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
init kept any existing PGSSLMODE. The Lakebase pool maps prefer to
rejectUnauthorized: false, disable to no TLS, and rejects every other value,
so only require gives a checked TLS connection. init now writes require over
anything else and says what it replaced.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
ditadi and others added 30 commits November 9, 2026 14:06
Co-authored-by: Isaac <no-reply@databricks.com>
The fork's parent is the branch the default target binds when the project
has it, else the project's default branch, and the step names which.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…s branch

init forked the project's default branch, but the branch databricks.yml
deploys to is the one that holds the deployed migrations. When the default
target binds a live branch of the same project, init forks that one and falls
back to the project's default branch otherwise. The step and the report name
the parent and which rule picked it.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…t none

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
init installed drizzle-kit only for the migrate and introspect starts. A new
fork's default start is the rebuild, so it skipped the install, and the next
`appkit db migrate` or `appkit db check` failed to load drizzle-kit. Every
start except none leaves the branch for those commands, so every start except
none installs it.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
… .env marker

APPKIT_DB_NEW_BRANCH recorded in one checkout's .env that init forked a branch
and had not finished its first start. It was checkout-local while the dev
branch is per user, a stale one could drop a developer's work without a
prompt, and --schema none, migrate or introspect cleared it while keeping
every copied row. It is gone.

init now reads the branch: the app schema is absent, the fork's untouched copy
(the service principal owns it), a copy handed to you whose rebuild stopped
(you own it and its journal carries the appkit:fork-copy row), or your working
branch. One function maps that state and the --schema request to the start.
A copy is tagged, handed off and rebuilt without a prompt. A tagged copy is
rebuilt on any rerun, from any checkout, without another hand-off. Your
working branch is migrated, and an explicit clean of it asks first through a
confirmation the caller supplies. --schema migrate or introspect on a copy
hands it off, removes the tag, keeps the rows and reports where they came
from. --schema none touches nothing. public is never handed off or tagged: a
new fork is migrated and the service principal's tables that kept their rows
are reported.

Without schema.ts, introspect writes the files before the tag and the
hand-off, so a refusal leaves the copy as the fork made it, and records nothing
on a branch the rebuild drops right after. appkit db migrate, introspect and
seed refuse a branch whose journal carries the tag.

Covered end to end against Postgres 17 with the Lakebase roles modelled.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…, and report kept copied rows

The confirmation for --schema clean moves from before the run into a callback
init calls once it has read the branch, so a fork's copy is rebuilt without a
question and a non-interactive shell is refused only when there is one to ask.
A no prints what init left and exits 1. init's report of rows the fork copied
that stayed, on request or because other roles own them in public, is printed
as a warning. The option and help text describe the rule the branch decides.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…ng branch

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…e schema

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
# Conflicts:
#	packages/appkit/src/database/migrations/ownership.ts
#	packages/appkit/src/database/migrations/tests/ownership.test.ts
#	packages/appkit/src/database/tooling/migrate.ts
…'s copy

Four Postgres regressions from the review of design 001, failing before
their fixes. The fork-copy tag must not be written into a journal owned
by a role the migrator does not trust. A fork this run created is a copy
even when you already owned the source schema, so init rebuilds it.
migrate, introspect and seed refuse an untouched copy as well as a
tagged one. After keeping the copied rows, a plain init keeps them and
only --schema clean removes them, which the CLI warning now says.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…rk copy

They checked only the fork-copy tag, so a copy the service principal
still owned, with no tag yet, took writes. appkit db seed could add rows
on top of the copy through DATABRICKS_SUPERUSER, and the next init
dropped them. The three commands now read the schema's state and refuse
a copy as well as a handed-off copy. The refusal names the owner for an
untouched copy and the stopped rebuild for a tagged one, and gives the
same advice for both. init's rebuild still reads a copy with record:
false, since that writes nothing on the branch.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
tagForkCopy, untagForkCopy and isForkCopy checked only that an ordinary
table stood at the journal's name. The migrator refuses to record into a
journal owned by a role it does not trust, and to read one under
row-level security, because a trigger, rule, default or policy there
would run that role's code as the caller. The tag helpers now reuse that
rule through readJournalRelation and journalRefusal, exported from
migrations/apply with its behavior unchanged. A fork's untouched copy
keeps the schema owner's journal, which the rule trusts, so the tag
still works there. Where it does not, init rebuilds without a tag.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…d it on the source

readSchemaState returned yours for an untagged schema you own, and
planStart migrated it, so a new fork of a source whose app schema you
already owned kept the copied rows silently. init knows it forked the
branch in this run and now passes that to planStart. A schema on a fresh
fork is the fork's copy whoever owns it: the default start tags it,
rebuilds it from the committed migrations, and makes no hand-off, since
the schema is yours already. Without schema.ts it introspects first, as
for any copy. --schema migrate and --schema introspect keep the rows, as
they do on a copy. A stop after the tag leaves a handed-off copy the
next init finishes; a stop before it leaves a schema that looks like
your working branch, the same window as a copy without a journal.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…lds it

The tag is what lets the next init finish a rebuild that stopped. When
the copy has no journal table, or one owned by a role the migrator does
not trust, init could not write it and said nothing, while the CLI help
promised that the next init always finishes the rebuild. init now warns
before the hand-off, through a new onWarning option that the CLI prints
as a warning, and tells you to run appkit db init --schema clean if the
run stops. The help text says when that promise holds.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…removes it

After --schema migrate or --schema introspect on a copy, the warning said
a plain appkit db init would rebuild the schema without the copied rows.
It does not. The tag is gone and the schema is yours, so a plain init
migrates it and keeps the rows. The warning now says so and names
appkit db init --schema clean, which drops the app schema with
everything in it after a confirmation, or with --yes.

Signed-off-by: ditadi <victordperd@gmail.com>
Co-authored-by: Isaac <no-reply@databricks.com>
The database plugin page and the init help now say that a branch init
forked in this run is rebuilt even when you already owned its schema on
the source, that the fork-copy row is written only into a journal the
migrator trusts and that init warns and tells you to run --schema clean
after a stop when it cannot write it, that migrate, introspect and seed
refuse an untouched copy as well as a tagged one, and that after keeping
the copied rows only --schema clean removes them.

Signed-off-by: ditadi <victordperd@gmail.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…d the CLI

The comment audit of the design 001 fixes flagged narration, type and
field docs, and rationale for our own code in this layer's files. This
deletes the 64 of them that remain and were written by this fix round,
and 11 more the R2-05 unit added since the audit that narrate the same
way: the onWarning docs, the record option's caller, test variable docs
and comments that restate the assertion below them. The kept comments
are the Lakebase why on tagForkCopy and the two Postgres test headers.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
… of untagging around introspect

readMigrationDrift takes ignoreHashes, journal rows that are not
migrations, and introspect passes the fork-copy tag. A copy an earlier
init tagged before it stopped is then read for init's rebuild as it is,
so init no longer deletes the tag before introspect and writes it back
after. The behavior stays: introspect on a copy writes files only, and
the tag is on the branch before the hand-off.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…before the fork

The write of APPKIT_DB_SESSION ahead of createBranch is now
persistSessionIdBeforeFork, so the order reads from the call instead of
a comment: a run that stops during or after the fork leaves its rerun
the session id to reuse.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…pe instead of a null sentinel

initHolding took LockedStart | null, where null meant --schema none. It
now takes a StartRequest: { kind: "none" } for a run that takes no lock
and starts nothing, or { kind: "locked", lock, requested }. The reads of
schema.ts and of the branch narrow on the kind.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
The option says what false means: schema.ts and the migration are
written, and the migration is not recorded on the branch as applied.
init's rebuild passes false, since it drops the schema right after.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…e confirm through a predicate

The schema state "handed-off-copy" meant a rebuild that stopped after
the tag and before its clean, so it is now "interrupted-rebuild".
planStart no longer gets confirm: false from a spread default: every
start sets it, and an explicit clean asks only where
mayHoldYourWork(state, forkedThisRun) holds, which holdsForkCopy
defines as neither a copy, an interrupted rebuild, a schema on a branch
this run forked, nor an absent one. The created parameter is named
forkedThisRun, which is what it says.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…med error

A no to the confirmation an explicit --schema clean asks for is a normal
result, not a failure, so runInit now returns start: { kind: "cancelled",
schemaName } with the branch, endpoint, role and .env the run did set
up. InitCancelledError and the CLI's match on its name go. The CLI
prints the same line and exits with code 1 as before.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
A Rebuild carries reason: "fork-copy" when the branch still held the
rows the fork copied and nothing was requested, or "requested" for an
explicit --schema clean. The CLI prints its hint about keeping the
copied rows from that field instead of inferring it from the start kind
and the absence of --schema.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>
…rops its database

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: ditadi <victordperd@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant