Multi provider projects#116
Conversation
- Refactored project structure to transition from a single provider to a multi-target approach, allowing for multiple named targets per project. - Introduced `get_target_config` and related functions to facilitate target-specific configurations. - Updated various components in the Python SDK and VS Code extension to accommodate the new project structure, ensuring backward compatibility with auto-migration from v4 to v5. - Enhanced error handling and logging for better user feedback during project initialization and command execution. This commit focuses on improving the flexibility and scalability of the project configuration while maintaining a smooth upgrade path for existing users.
- Bumped version number to 0.2.11 in package.json files for the main project, Python SDK, VS Code extension, and documentation site. - Updated CLI version in runtime_info.success.json to reflect the new version. - Revised databricks-asset-bundles.mdx and release-notes.mdx to include version 0.2.11 and highlight new features such as v5 multi-target architecture and the new `--scope` CLI parameter. - Ensured consistency in versioning across all related files and documentation. This commit focuses on maintaining version consistency and documenting the latest enhancements in the project.
- Added validation for legacy implicit projects before migrating from v4 to v5 in `ensure_project_file` to ensure compatibility. - Introduced new unit tests for `batch_operations_by_type` in `test_batching.py`, covering scenarios for empty operations, correct grouping, and skipping operations without targets. - Updated SQL command tests in `test_sql_command.py` to improve coverage for catalog mapping and payload extraction functions, ensuring robust error handling and correct behavior for various operation types. This commit focuses on improving migration safety and enhancing the testing framework for batch operations and SQL command functionalities.
- Deleted the `test_hierarchy.py` file, which contained tests for the `Hierarchy` and `HierarchyLevel` classes. - This removal is part of a broader effort to streamline the test suite and focus on more relevant or updated tests. This commit focuses on cleaning up the test codebase by removing outdated or redundant tests.
- Added recommendations for installing `schemaxpy` within a virtual environment to prevent conflicts with other Python projects. - Included detailed instructions for setting up virtual environments using `uv`, `conda`, and standard `venv`. - Updated the FAQ section to address common issues related to the `schemax` command not being found, emphasizing the importance of activating the virtual environment and selecting the correct Python interpreter in IDEs. This commit focuses on improving the user experience by providing clearer guidance on environment setup and troubleshooting common installation issues.
- Changed the visibility of the `migrateV4ToV5` function from private to public in `storage-v4.ts`, allowing it to be imported and utilized in other modules. - Updated unit tests in `storage-v4.test.ts` to use the newly exposed function for migrating project configurations from v4 to v5, ensuring compatibility with the new multi-target architecture. - Adjusted environment configuration tests to validate the migration process and confirm that the expected configurations are correctly applied after migration. This commit enhances the migration capabilities of the project, facilitating smoother transitions from v4 to v5 configurations.
There was a problem hiding this comment.
Pull request overview
This PR advances SchemaX “multi provider projects” by introducing a v5 multi-target project schema (with v4 → v5 auto-migration), updating the VS Code extension/webview to read target-scoped config, and aligning CLI/SDK interfaces around a scope concept while also adding end-user venv/interpreter documentation.
Changes:
- Add v5 project schema support (targets/defaultTarget) with transparent v4 → v5 migration across the Python SDK and VS Code extension storage layers.
- Introduce
Operation.scopeand add--scopeCLI options + repository/service signatures to support target scoping. - Update VS Code extension interpreter resolution to prefer the Python extension API and add target-specific settings UI + docs/version bumps.
Reviewed changes
Copilot reviewed 73 out of 75 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/vscode-extension/tests/unit/pythonBackendClient.test.ts | Updates unit tests for Python extension API interpreter resolution and PATH fallbacks. |
| packages/vscode-extension/src/webview/styles.css | Adds styling for target tabs in the settings UI. |
| packages/vscode-extension/src/webview/state/useDesignerStore.ts | Adds activeTarget and includes scope on emitted operations. |
| packages/vscode-extension/src/webview/models/unity.ts | Adds v5 target schema types and a default-target accessor helper. |
| packages/vscode-extension/src/webview/components/settings/UnityTargetSettings.tsx | New Unity-specific per-target settings panel (env mappings, managed scope, etc.). |
| packages/vscode-extension/src/webview/components/Sidebar.tsx | Switches tooltip environment source to default target config. |
| packages/vscode-extension/src/webview/components/ImportAssetsPanel.tsx | Reads environment names from default target config. |
| packages/vscode-extension/src/webview/components/EnvironmentSummary.tsx | Reads environments from default target config. |
| packages/vscode-extension/src/storage-v4.ts | Implements v5 project schema + v4→v5 migration + target helpers (still named storage-v4). |
| packages/vscode-extension/src/extension.ts | Updates extension pipeline to use v5 targets and injects a logger into PythonBackendClient. |
| packages/vscode-extension/src/contracts/workspace.ts | Adds optional scope field to operations contract. |
| packages/vscode-extension/src/backend/pythonBackendClient.ts | Uses @vscode/python-extension API to resolve interpreter; adds diagnostic logging. |
| packages/vscode-extension/package.json | Bumps extension version and adds @vscode/python-extension dependency. |
| packages/vscode-extension/TESTING-UI.md | Removes UI testing guide documentation file. |
| packages/vscode-extension/CHANGELOG.md | Adds 0.2.11 release entry for extension changes. |
| packages/python-sdk/tests/unit/test_workspace_repository.py | Updates v5 project schema assertions. |
| packages/python-sdk/tests/unit/test_storage_v5.py | Adds unit tests for v5 schema and v4→v5 migration. |
| packages/python-sdk/tests/unit/test_storage_v4.py | Updates legacy storage tests to reflect v5 outputs. |
| packages/python-sdk/tests/unit/test_sql_parser_extended.py | Adds extended unit coverage for SQL parser internals. |
| packages/python-sdk/tests/unit/test_sql_command.py | Expands SQL command unit tests and helper coverage. |
| packages/python-sdk/tests/unit/test_rollback_extended.py | Adds rollback unit coverage for internal helpers and edge cases. |
| packages/python-sdk/tests/unit/test_hierarchy_classes.py | Adds tests for hierarchy model helpers. |
| packages/python-sdk/tests/unit/test_exceptions.py | Adds tests for provider exception classes. |
| packages/python-sdk/tests/unit/test_diff_command.py | Updates diff command tests for v5 project schema. |
| packages/python-sdk/tests/unit/test_cli_commands.py | Updates CLI tests/stubs for scope and v5 schema. |
| packages/python-sdk/tests/unit/test_bundle_command.py | Updates bundle tests to use v5 targets/defaultTarget. |
| packages/python-sdk/tests/unit/test_batching.py | Adds tests for batching operations by type. |
| packages/python-sdk/tests/unit/test_base_sql_generator.py | Adds extensive unit tests for BaseSQLGenerator internals. |
| packages/python-sdk/tests/integration/test_workflows_e2e.py | Updates integration workflow to mutate v5 env config via targets. |
| packages/python-sdk/tests/integration/test_workflows.py | Updates workflow integration tests for v5 schema usage. |
| packages/python-sdk/tests/integration/test_version_utilities.py | Updates storage/version utility tests for v5 schema. |
| packages/python-sdk/tests/integration/test_validate_error_paths.py | Adds validate integration tests for error/warning paths and JSON envelopes. |
| packages/python-sdk/tests/integration/test_state_reducer_edges.py | Adds integration coverage for state reducer edge-case ops. |
| packages/python-sdk/tests/integration/test_sql_gen_objects.py | Adds integration coverage for SQL generation across many object types. |
| packages/python-sdk/tests/integration/test_sql_gen_locations.py | Adds integration coverage for managed/external location resolution. |
| packages/python-sdk/tests/integration/test_sql_gen_batched.py | Adds integration coverage for batched SQL generation paths. |
| packages/python-sdk/tests/integration/test_sql_error_paths.py | Adds SQL command integration tests for error paths and edge cases. |
| packages/python-sdk/tests/integration/test_live_e2e_command_matrix.py | Updates live test helper to v5 target env access. |
| packages/python-sdk/tests/integration/test_diff_error_paths.py | Adds diff integration tests for error paths and show-sql/details. |
| packages/python-sdk/tests/integration/test_command_error_paths.py | Updates apply error-path integration test to v5 schema env mapping. |
| packages/python-sdk/tests/integration/test_cli_coverage_gaps.py | Adds broad integration tests to close CLI coverage gaps. |
| packages/python-sdk/tests/integration/test_cli_command_paths.py | Updates CLI integration tests for v5 schema environment config. |
| packages/python-sdk/tests/integration/test_bundle_integration.py | Updates bundle integration test to mutate v5 target environments. |
| packages/python-sdk/tests/integration/live_helpers.py | Updates integration helpers to edit v5 env config under targets. |
| packages/python-sdk/tests/conftest.py | Updates fixture docstring to reference v5 initialization. |
| packages/python-sdk/src/schemax/version.py | Bumps SDK version to 0.2.11. |
| packages/python-sdk/src/schemax/providers/base/operations.py | Adds scope to Operation model and create_operation helper. |
| packages/python-sdk/src/schemax/core/workspace_repository.py | Adds scope plumbing and exposes get_target_config wrapper. |
| packages/python-sdk/src/schemax/core/storage.py | Implements v5 schema, v4→v5 migration, and target config accessors. |
| packages/python-sdk/src/schemax/core/init.py | Exports get_target_config. |
| packages/python-sdk/src/schemax/commands/validate.py | Adds scope parameter to validate command boundary (currently discarded). |
| packages/python-sdk/src/schemax/commands/sql.py | Adds scope parameter to SQL command boundary (currently discarded). |
| packages/python-sdk/src/schemax/commands/rollback.py | Updates repository protocol to accept scope for env config. |
| packages/python-sdk/src/schemax/commands/import_assets.py | Updates repository protocol to accept scope for env config. |
| packages/python-sdk/src/schemax/commands/diff.py | Resolves provider ID from v5 target config. |
| packages/python-sdk/src/schemax/commands/bundle.py | Reads environments from resolved target config. |
| packages/python-sdk/src/schemax/commands/apply.py | Adds scope parameter to apply boundary (currently discarded). |
| packages/python-sdk/src/schemax/cli.py | Adds --scope options and includes v5 project fields in workspace-state payload. |
| packages/python-sdk/src/schemax/application/services.py | Plumbs scope through service layer API. |
| packages/python-sdk/src/schemax/init.py | Resolves provider via target config for diff helpers. |
| packages/python-sdk/pyproject.toml | Bumps Python package version to 0.2.11. |
| packages/python-sdk/CHANGELOG.md | Adds 0.2.11 release notes for v5 schema + scope flag. |
| package.json | Bumps monorepo version to 0.2.11. |
| package-lock.json | Updates lockfile versions and adds new dependency entry. |
| docs/schemax/package.json | Bumps docs site version to 0.2.11. |
| docs/schemax/docs/reference/release-notes.mdx | Adds 0.2.11 coordinated release notes. |
| docs/schemax/docs/reference/faq.mdx | Adds FAQ entry for missing CLI/IDE import resolution (venv/interpreter). |
| docs/schemax/docs/guide/setup.mdx | Adds venv creation + interpreter selection tip. |
| docs/schemax/docs/guide/databricks-asset-bundles.mdx | Updates version references for 0.2.11. |
| contracts/cli-envelopes/runtime_info.success.json | Updates runtime-info fixture to CLI version 0.2.11. |
Comments suppressed due to low confidence (2)
packages/vscode-extension/src/webview/models/unity.ts:208
- The type claims “v4 compat” via optional
provider, buttargetsanddefaultTargetare required. A true v4-shaped payload (with onlyprovider) would not satisfy this interface. Either maketargets/defaultTargetoptional (and handle both shapes) or update the comment to reflect that v5 shape is required in the webview payload.
packages/vscode-extension/src/webview/components/ImportAssetsPanel.tsx:123 getDefaultTargetConfig(project)can throw (and will do so during render) ifdefaultTargetis missing or the target isn’t present, which would crash the Import Assets panel. Consider resolving the target config once with a safe fallback (e.g., empty env list) rather than calling a throwing helper directly in render-time state initialization.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
…nhancements - Revised the release notes to reflect the new `--scope` CLI parameter, clarifying its current implementation and future enhancements for target-scoped state loading. - Updated the changelog to include details about the `--scope` flag, emphasizing its integration into the CLI commands and the ongoing development for target-specific functionality. - Adjusted documentation to ensure consistency with the new multi-target project schema, which now utilizes a `targets` dictionary for provider configurations. This commit focuses on improving documentation clarity and ensuring users are informed about the latest features and their implementations in the v5 architecture.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 73 out of 75 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
schemaxpyscopeparameter mismatch across all command Protocol interfaces and repository adapters to matchWorkspaceRepository.get_environment_configMotivation / Context
schemaxpyvia pip/uv need guidance on venv setup and IDE interpreter selection. Thescopeparam was added toWorkspaceRepository.get_environment_configfor v5 multi-target support but the Protocol definitions and adapterimplementations in command files were never updated to match.
Type of Change
What Changed
docs/schemax/docs/guide/setup.mdx: Added:::tipadmonition after CLI install step covering venv creation with uv, conda/mamba, and standard venv, plus Python interpreter selection in VS Code/Cursordocs/schemax/docs/reference/faq.mdx: Added FAQ entry for "schemaxcommand not found / IDE can't resolve imports" with troubleshooting stepscommands/diff.py: Addedscope: str | None = Noneto_WorkspaceRepoPortProtocol and_DiffWorkspaceRepositoryadapter, passing it through toWorkspaceRepositorycommands/sql.py: Same fix for_WorkspaceRepoPortProtocol and_SqlWorkspaceRepositoryadaptercommands/apply.py: Same fix for_WorkspaceRepoPortProtocol and_ApplyWorkspaceRepositoryadaptercommands/rollback.py: Same fix for_WorkspaceRepoPortProtocol and_RollbackWorkspaceRepositoryadaptercommands/import_assets.py: Same fix for_WorkspaceRepoPortProtocol and_ImportWorkspaceRepositoryadapterProvider / Surface Area Impact
Affected Surfaces
Providers
Behavior Changes
Before
get_environment_configin diff, sql, apply, rollback, and import_assets commands were missing thescopeparameter, breaking type safety againstWorkspaceRepositoryAfter
scope: str | None = None, matching theWorkspaceRepositorysignatureExamples