fix: make warehouseId optional in ServiceContext when no plugin requires it#91
Open
pffigueiredo wants to merge 10 commits intomainfrom
Open
fix: make warehouseId optional in ServiceContext when no plugin requires it#91pffigueiredo wants to merge 10 commits intomainfrom
pffigueiredo wants to merge 10 commits intomainfrom
Conversation
Adds a `static requires` mechanism to the Plugin class so plugins can declare which shared resources they need (e.g. warehouseId). At startup, createApp() collects requirements from all plugins and passes them to ServiceContext.initialize(), which only resolves warehouseId when a plugin declared it. Apps using only server() no longer need DATABRICKS_WAREHOUSE_ID set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Pedro Figueiredo <klisarkk@gmail.com>
7f4191c to
f5e252d
Compare
Author
|
This is in Draft due to clash with other features that are being worked on right now. |
pkosiec
reviewed
Feb 25, 2026
packages/appkit/src/core/appkit.ts
Outdated
|
|
||
| // Collect required resources from all plugins before initializing context | ||
| const rawPlugins = config.plugins as T; | ||
| const requiredResources = AppKit.collectRequiredResources(rawPlugins); |
Member
There was a problem hiding this comment.
Could you please rebase your PR? There's resource registry now, where all Plugins have their manifests with required resources. Maybe we could use it to mark plugin as the one which needs the warehouse ID? 🤔
Resolve conflicts keeping the branch's simplified requiredResources approach over main's manifest/ResourceRegistry system. Co-authored-by: Cursor <cursoragent@cursor.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.
Description
Makes
warehouseIdoptional inServiceContextwhen no registered plugin declares a SQL Warehouse in its manifest. Previously,ServiceContext.createContext()always calledgetWarehouseId(client), which in production throws ifDATABRICKS_WAREHOUSE_IDis unset, and in dev triggers an unnecessary API call.The need for a warehouse is now derived from the existing plugin manifest / ResourceRegistry: if any plugin declares a required
sql_warehouseresource in its manifest,ServiceContextresolves the warehouse; otherwise it is skipped. No new plugin API (e.g.requiredResources) was added — the manifest is the single source of truth.FEATURES
ServiceContext.initialize(options?, client?)acceptsoptions?.warehouseIdto gate warehouse resolution.AppKit._createApp()usesResourceRegistry: collect resources from manifests, deriveneedsWarehousefromregistry.getRequired()(anyResourceType.SQL_WAREHOUSE), then callServiceContext.initialize({ warehouseId: needsWarehouse })beforeregistry.enforceValidation().FIXES
createApp({ plugins: [server()] })no longer fails whenDATABRICKS_WAREHOUSE_IDis missing.BREAKING CHANGES
sql_warehousein their manifest (e.g. Analytics) keep current behavior; apps using onlyserver()no longer need the env var.