fix: make warehouseId optional in ServiceContext when no plugin requires it#91
Open
pffigueiredo wants to merge 11 commits intomainfrom
Open
fix: make warehouseId optional in ServiceContext when no plugin requires it#91pffigueiredo wants to merge 11 commits intomainfrom
pffigueiredo wants to merge 11 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
Contributor
Author
|
This is in Draft due to clash with other features that are being worked on right now. |
pkosiec
reviewed
Feb 25, 2026
Resolve conflicts keeping the branch's simplified requiredResources approach over main's manifest/ResourceRegistry system. Co-authored-by: Cursor <cursoragent@cursor.com>
pkosiec
approved these changes
Feb 26, 2026
.gitignore
Outdated
|
|
||
| # AI generated files | ||
| .serena | ||
| docs/plans/ No newline at end of file |
Member
There was a problem hiding this comment.
Same as in #89 - let's remove this line
Suggested change
| docs/plans/ |
| userName?: string; | ||
| /** Promise that resolves to the warehouse ID (inherited from service context) */ | ||
| warehouseId: Promise<string>; | ||
| /** Promise that resolves to the warehouse ID (inherited from service context, only present when a plugin requires it) */ |
Member
There was a problem hiding this comment.
Suggested change
| /** Promise that resolves to the warehouse ID (inherited from service context, only present when a plugin requires it) */ | |
| /** Promise that resolves to the warehouse ID (inherited from service context, only present when a plugin requires `SQL_WAREHOUSE` resource) */ |
| serviceUserId: string; | ||
| /** Promise that resolves to the warehouse ID */ | ||
| warehouseId: Promise<string>; | ||
| /** Promise that resolves to the warehouse ID (only present when a plugin requires it) */ |
Member
There was a problem hiding this comment.
Suggested change
| /** Promise that resolves to the warehouse ID (only present when a plugin requires it) */ | |
| /** Promise that resolves to the warehouse ID (only present when a plugin requires `SQL_WAREHOUSE` resource) */ |
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.