Skip to content

Conversation

@pffigueiredo
Copy link

Description

This PR makes warehouseId optional in ServiceContext when no registered plugin declares it as a required resource. Previously, ServiceContext.createContext() unconditionally called getWarehouseId(client), which in production throws if DATABRICKS_WAREHOUSE_ID is unset, and in dev mode fires an unnecessary API call.

This change introduces a plugin resource declaration system where plugins can specify which shared resources they need (e.g., warehouseId). Only AnalyticsPlugin uses the warehouse ID, so apps using only server() should not require it.

FEATURES

  • Plugins can now declare required resources via static requiredResources: ServiceContextResource[]
  • ServiceContext.initialize() accepts a list of required resources and only resolves them when needed
  • AppKit._createApp() collects required resources from all registered plugins before initializing context

FIXES

  • createApp({ plugins: [server()] }) no longer fails when DATABRICKS_WAREHOUSE_ID is missing
  • Apps without warehouse-dependent plugins avoid unnecessary warehouse ID resolution/API calls

BREAKING CHANGES

  • None (backward compatible - requiredResources is optional on plugins)

Test Plan

  • Existing tests pass
  • Apps using only server() plugin work without DATABRICKS_WAREHOUSE_ID
  • Apps using analytics() plugin continue to require DATABRICKS_WAREHOUSE_ID

@pffigueiredo pffigueiredo requested review from MarioCadenas and pkosiec and removed request for MarioCadenas February 9, 2026 14:17
pffigueiredo and others added 5 commits February 9, 2026 14:23
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>
@pffigueiredo pffigueiredo force-pushed the fix-required-warehouseID branch from 7f4191c to f5e252d Compare February 9, 2026 14:25
@pffigueiredo pffigueiredo marked this pull request as draft February 9, 2026 14:32
@pffigueiredo
Copy link
Author

This is in Draft due to clash with other features that are being worked on right now.

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.

1 participant