Skip to content

fix: gate typegen fallback per surface, not across surfaces - #511

Merged
atilafassina merged 1 commit into
mainfrom
fix/typegen-per-surface-gate
Aug 5, 2026
Merged

fix: gate typegen fallback per surface, not across surfaces#511
atilafassina merged 1 commit into
mainfrom
fix/typegen-per-surface-gate

Conversation

@atilafassina

Copy link
Copy Markdown
Contributor

The --wait committed-types fallback tracked a single hadEnvironmentalFailure flag for both analytics queries and metric views, and satisfied the gate if either committed artifact existed. When only one surface failed, an unrelated committed artifact could stand in for the missing one: queries failing environmentally with no committed analytics.d.ts still exited 0 as long as a metric-views.d.ts happened to be present, leaving CI green with types that were never generated.

Track the failure per surface and require each failing surface to have its own committed artifact. Metric-view degradation now participates in the gate the same way degraded queries already did, and the fatal error names the missing artifacts so the remedy points at the right surface.

The `--wait` committed-types fallback tracked a single
`hadEnvironmentalFailure` flag for both analytics queries and metric
views, and satisfied the gate if *either* committed artifact existed.
When only one surface failed, an unrelated committed artifact could
stand in for the missing one: queries failing environmentally with no
committed `analytics.d.ts` still exited 0 as long as a
`metric-views.d.ts` happened to be present, leaving CI green with types
that were never generated.

Track the failure per surface and require each failing surface to have
its own committed artifact. Metric-view degradation now participates in
the gate the same way degraded queries already did, and the fatal error
names the missing artifacts so the remedy points at the right surface.

Signed-off-by: Atila Fassina <atila@fassina.eu>
Copilot AI review requested due to automatic review settings August 4, 2026 15:12
@atilafassina
atilafassina requested a review from a team as a code owner August 4, 2026 15:12
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle size report

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

@databricks/appkit

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

dist raw gzip
JS (runtime) 832 KB (+7.8 KB) 290 KB (+1.8 KB)
Type declarations 306 KB 105 KB (-9 B)
Source maps 1.6 MB (+18 KB) 544 KB (+4.7 KB)
Other 11 KB 3.7 KB
Total 2.7 MB (+26 KB) 943 KB (+6.4 KB)
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 87 KB (+702 B) 2.5 KB 89 KB (+702 B) external 284 KB (+2.4 KB)
./beta 45 KB 458 B 45 KB external 129 KB
./type-generator 20 KB (+723 B) 0 B 20 KB (+723 B) external 57 KB (+2.4 KB)

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 83 KB
. utils.js initial 4.0 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 29 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 431 B
./beta client-options.js initial 220 B
./beta supervisor-api.js lazy 193 B
./beta databricks.js lazy 142 B
./beta index.js lazy 123 B
./type-generator index.js initial 20 KB

@databricks/appkit-ui

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

dist raw gzip
JS (runtime) 360 KB 119 KB
Type declarations 205 KB 74 KB
Source maps 686 KB 224 KB
CSS 16 KB 3.3 KB
Total 1.2 MB 422 KB
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
./js 4.3 KB 49 KB 54 KB 208 KB 12 KB
./js/beta 20 B 0 B 20 B 0 B 0 B
./react 429 KB 49 KB 478 KB 1.3 MB 168 KB
./react/beta 20 B 0 B 20 B 0 B 0 B

Chunks:

Entry Chunk Load Size (gz)
./js index.js initial 4.2 KB
./js chunk initial 120 B
./js apache-arrow lazy 49 KB
./js/beta beta.js initial 20 B
./react index.js initial 427 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 20 B

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the --wait (blocking) typegen committed-types fallback gate so that environmental failures are tracked per surface (analytics queries vs metric views) and each failing surface must have its own committed .d.ts artifact present—preventing a committed artifact for one surface from incorrectly satisfying the fallback for the other.

Changes:

  • Split the single environmental-failure flag into per-surface flags and enforce a per-surface committed artifact check in blocking mode.
  • Improve the blocking-mode fatal error to name exactly which committed artifact(s) are missing.
  • Add/adjust tests to cover “cross-surface artifact cannot satisfy fallback” cases and verify committed metric types are preserved byte-for-byte when degraded writes are suppressed.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/appkit/src/type-generator/index.ts Tracks environmental failures per surface and requires the corresponding committed .d.ts artifact(s) when blocking-mode fallbacks are used; improves fatal error messaging.
packages/appkit/src/type-generator/tests/unreachable-warehouse-gate.test.ts Adds end-to-end coverage ensuring committed metric types do not satisfy missing query fallback under environmental query failure.
packages/appkit/src/type-generator/tests/index.test.ts Refactors committed metric type setup and adds tests ensuring generated analytics types can’t satisfy missing metric fallback; tightens assertions that committed metric types are preserved.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Aug 4, 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 30922962109 -R databricks/appkit -n appkit-template-0.52.0-pr.6fa3c49-fix-typegen-per-surface-gate-511 -D appkit-pr-511 \
  && unzip -o "appkit-pr-511/appkit-template-0.52.0-pr.6fa3c49-fix-typegen-per-surface-gate-511.zip" -d "appkit-pr-511" \
  && databricks apps init --template "appkit-pr-511"

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.

@atilafassina
atilafassina enabled auto-merge (squash) August 4, 2026 15:23
@atilafassina
atilafassina merged commit d55de0f into main Aug 5, 2026
11 checks passed
@atilafassina
atilafassina deleted the fix/typegen-per-surface-gate branch August 5, 2026 09:34
atilafassina added a commit that referenced this pull request Aug 5, 2026
PR #511 landed the same committed-types gate this branch had reworked.
Both wanted the metric surface to participate in the gate; #511's version
is strictly more precise, tracking the failure per surface so a committed
artifact for one surface can never stand in for a missing one elsewhere.

Resolve to #511's design and drop this branch's all-artifacts variant
(hasRequiredCommittedTypes and the now-unread metricTypesRequired flag).
Keep the .ts rename on top: the gate message says "type files" rather
than ".d.ts files", the two fixtures point at metric-views.ts, and the
committed-metric-types fixture carries the runtime const so a preserved
fallback stays a loadable module.

Signed-off-by: Atila Fassina <atila@fassina.eu>
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.

3 participants