fix: gate typegen fallback per surface, not across surfaces - #511
Conversation
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>
📦 Bundle size reportCompared against
|
| 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 |
There was a problem hiding this comment.
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.
🤖 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 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 |
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>
The
--waitcommitted-types fallback tracked a singlehadEnvironmentalFailureflag 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 committedanalytics.d.tsstill exited 0 as long as ametric-views.d.tshappened 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.