Skip to content

fix(cli): classify doctor field origin via shared computeOriginFromField - #537

Merged
MarioCadenas merged 1 commit into
mainfrom
fix/doctor-field-origin
Aug 17, 2026
Merged

fix(cli): classify doctor field origin via shared computeOriginFromField#537
MarioCadenas merged 1 commit into
mainfrom
fix/doctor-field-origin

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

Stacked on #462 (feat/registry-cli) — please review/merge that first; this PR targets feat/registry-cli, not main.

Problem

doctor's resolve-targets.isUserSuppliedEnv hand-rolled the field-origin cascade and never handled the cli origin. In a synced appkit.plugins.json (where plugin sync stamps origin), a cli-origin field — one resolved by the CLI via resolve — was classified as user-supplied, so appkit doctor wrongly reported it as a MISSING user env var.

Fix

Reuse the canonical classifier instead of re-implementing the cascade:

  • Import computeOriginFromField from schemas/manifest (the single source plugin sync uses).

  • Add resolve?: string to the local ManifestField so cli-origin fields in authored manifests (no stamped origin) classify correctly.

  • A field is user-supplied iff its effective origin is "user" — trust a stamped field.origin first, else derive it from the field shape:

    const origin = field.origin ?? computeOriginFromField(field);
    return origin === "user";

This mirrors the fieldOrigin helper in registry/requirements.ts, importing the shared classifier directly.

Tests

  • New case proves a cli-origin field is excluded from envVars, covering both a stamped origin: "cli" field and an unstamped field with resolve set.
  • Corrected the existing "excludes value-default and platform-injected fields" case: it previously asserted the cli-origin LAKEBASE_ENDPOINT was included (that assertion encoded the bug). It now includes a genuine user field and asserts only that survives, so it discriminates cli/platform/static (excluded) from user (kept).

Verify

  • pnpm --filter=shared typecheck — clean
  • npx vitest run packages/shared/src/cli/commands/doctor — 129 passed
  • npx biome check on both changed files — clean

@MarioCadenas
MarioCadenas requested a review from a team as a code owner August 14, 2026 13:13
@MarioCadenas
MarioCadenas requested review from atilafassina and removed request for a team August 14, 2026 13:13
Base automatically changed from feat/registry-cli to main August 17, 2026 08:48
doctor's resolve-targets.isUserSuppliedEnv hand-rolled the field-origin
cascade and never handled the cli origin, so a resolve-based (cli-origin)
field — whether stamped or derived from the field shape — was misreported
as a missing user-supplied env var.

Derive the effective origin via the shared computeOriginFromField (trusting
a stamped `origin`, else the field shape) and treat a field as user-supplied
only when that origin is "user".

Stacked on feat/registry-cli, which introduces computeOriginFromField.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas force-pushed the fix/doctor-field-origin branch from d87ac48 to 82a9e60 Compare August 17, 2026 08:53
@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle size report

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

@databricks/appkit

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

dist raw gzip
JS (runtime) 869 KB (-553 B) 303 KB (-89 B)
Type declarations 315 KB (+379 B) 109 KB (+221 B)
Source maps 1.7 MB (+326 B) 566 KB (+137 B)
Other 11 KB 3.7 KB
Total 2.9 MB (+152 B) 982 KB (+269 B)
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 88 KB (+18 B) 2.5 KB 91 KB (+18 B) external 288 KB (+48 B)
./beta 49 KB (+7 B) 456 B (-2 B) 49 KB (+5 B) external 143 KB (+48 B)
./type-generator 21 KB (+41 B) 0 B 21 KB (+41 B) external 61 KB (+48 B)

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 84 KB
. utils.js initial 4.0 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 33 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 219 B
./beta supervisor-api.js lazy 192 B
./beta databricks.js lazy 141 B
./beta index.js lazy 123 B
./type-generator index.js initial 21 KB

@databricks/appkit-ui

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

dist raw gzip
JS (runtime) 390 KB 130 KB
Type declarations 228 KB (+412 B) 83 KB (+360 B)
Source maps 753 KB 248 KB
CSS 16 KB 3.3 KB
Total 1.4 MB (+412 B) 465 KB (+360 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 480 KB 1.3 MB 175 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

@github-actions

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 32012545528 -R databricks/appkit -n appkit-template-0.60.0-pr.401adae-fix-doctor-field-origin-537 -D appkit-pr-537 \
  && unzip -o "appkit-pr-537/appkit-template-0.60.0-pr.401adae-fix-doctor-field-origin-537.zip" -d "appkit-pr-537" \
  && databricks apps init --template "appkit-pr-537"

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.

@MarioCadenas
MarioCadenas merged commit 42a43d8 into main Aug 17, 2026
10 checks passed
@MarioCadenas
MarioCadenas deleted the fix/doctor-field-origin branch August 17, 2026 09:19
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.

2 participants