mirror of https://github.com/buster-so/buster.git
cli deployment logic
This commit is contained in:
parent
0b51ef4edf
commit
ded67c4fc8
|
@ -139,38 +139,38 @@ fn resolve_model_configurations(
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Implementation Steps
|
#### Implementation Steps
|
||||||
1. [ ] For each discovered model file path (and its associated `Option<ProjectConfig>`):
|
1. [x] For each discovered model file path (and its associated `Option<ProjectConfig>`):
|
||||||
a. Read file content.
|
a. Read file content.
|
||||||
b. Parse YAML content into `semantic_layer::Model` (or `Vec<semantic_layer::Model>` if files can contain multiple). Handle parsing errors.
|
b. Parse YAML content into `semantic_layer::Model` (or `Vec<semantic_layer::Model>` if files can contain multiple). Handle parsing errors.
|
||||||
2. [ ] Implement the `resolve_model_configurations` function (or similar logic) to determine `data_source_name`, `schema`, and `database` for each model using the precedence: Model file -> `ProjectConfig` -> Global `BusterConfig`.
|
2. [x] Implement the `resolve_model_configurations` function (or similar logic) to determine `data_source_name`, `schema`, and `database` for each model using the precedence: Model file -> `ProjectConfig` -> Global `BusterConfig`.
|
||||||
* *(Depends on `data_source_name: Option<String>` being added to `semantic_layer::Model`)*
|
* *(Depends on `data_source_name: Option<String>` being added to `semantic_layer::Model`)*
|
||||||
3. [ ] Ensure the resolved `data_source_name`, `schema`, and `database` are populated onto the `semantic_layer::Model` instances.
|
3. [x] Ensure the resolved `data_source_name`, `schema`, and `database` are populated onto the `semantic_layer::Model` instances.
|
||||||
4. [ ] Perform CLI-side validations (e.g., model name is not empty, required configurations like `data_source_name` and `schema` are present after resolution).
|
4. [x] Perform CLI-side validations (e.g., model name is not empty, required configurations like `data_source_name` and `schema` are present after resolution).
|
||||||
5. [ ] Group the resolved and validated `semantic_layer::Model` objects into a `Vec`.
|
5. [x] Group the resolved and validated `semantic_layer::Model` objects into a `Vec`.
|
||||||
6. [ ] This `Vec<semantic_layer::Model>` will be the collection to be serialized to JSON for the API request.
|
6. [x] This `Vec<semantic_layer::Model>` will be the collection to be serialized to JSON for the API request.
|
||||||
|
|
||||||
#### Tests
|
#### Tests
|
||||||
- **Unit Tests for Parsing:**
|
- **Unit Tests for Parsing:** ✅
|
||||||
- Valid YAML model file parses correctly into `semantic_layer::Model`.
|
- Valid YAML model file parses correctly into `semantic_layer::Model`.
|
||||||
- Invalid YAML structure results in an error.
|
- Invalid YAML structure results in an error.
|
||||||
- File with multiple models (if supported) parses into `Vec<semantic_layer::Model>`.
|
- File with multiple models (if supported) parses into `Vec<semantic_layer::Model>`.
|
||||||
- **Unit Tests for Configuration Resolution:**
|
- **Unit Tests for Configuration Resolution:** ✅
|
||||||
- Model gets config from its own file.
|
- Model gets config from its own file.
|
||||||
- Model gets config from `ProjectConfig` when not in file.
|
- Model gets config from `ProjectConfig` when not in file.
|
||||||
- Model gets config from Global `BusterConfig` when not in file or `ProjectConfig`.
|
- Model gets config from Global `BusterConfig` when not in file or `ProjectConfig`.
|
||||||
- Error if required config (`data_source_name`, `schema`) is missing after all checks.
|
- Error if required config (`data_source_name`, `schema`) is missing after all checks.
|
||||||
- Correct precedence is followed.
|
- Correct precedence is followed.
|
||||||
- **Integration-like Tests (can use `deploy` command with mocked API client):**
|
- **Integration-like Tests (can use `deploy` command with mocked API client):** ✅
|
||||||
- End-to-end flow: discovery -> parsing -> config resolution -> payload for API is correctly formed.
|
- End-to-end flow: discovery -> parsing -> config resolution -> payload for API is correctly formed.
|
||||||
- Scenario with `buster.yml` and `projects` structure.
|
- Scenario with `buster.yml` and `projects` structure.
|
||||||
- Scenario with model-level overrides.
|
- Scenario with model-level overrides.
|
||||||
|
|
||||||
#### Success Criteria
|
#### Success Criteria
|
||||||
- [ ] CLI can parse valid YAML model files into `semantic_layer::Model` structs.
|
- [x] CLI can parse valid YAML model files into `semantic_layer::Model` structs.
|
||||||
- [ ] Configuration inheritance (Model > Project > Global) for `data_source_name`, `schema`, `database` is correctly implemented and validated.
|
- [x] Configuration inheritance (Model > Project > Global) for `data_source_name`, `schema`, `database` is correctly implemented and validated.
|
||||||
- [ ] The list of models to be deployed is correctly prepared with all necessary information for the API.
|
- [x] The list of models to be deployed is correctly prepared with all necessary information for the API.
|
||||||
- [ ] CLI performs basic validations before attempting to send to API.
|
- [x] CLI performs basic validations before attempting to send to API.
|
||||||
- [ ] All tests pass.
|
- [x] All tests pass.
|
||||||
|
|
||||||
## Dependencies on Other Components
|
## Dependencies on Other Components
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ graph TD
|
||||||
* Purpose: Refactor `cli/cli/src/commands/deploy.rs` to parse YAML models using the new semantic layer structs. Implement logic to resolve `database` and `schema` (model file -> project config -> global config). Construct the API request payload based on the semantic model.
|
* Purpose: Refactor `cli/cli/src/commands/deploy.rs` to parse YAML models using the new semantic layer structs. Implement logic to resolve `database` and `schema` (model file -> project config -> global config). Construct the API request payload based on the semantic model.
|
||||||
* Dependencies: Semantic Model Definition, CLI Configuration & Discovery
|
* Dependencies: Semantic Model Definition, CLI Configuration & Discovery
|
||||||
* Required for: End-to-end testing of CLI deployment
|
* Required for: End-to-end testing of CLI deployment
|
||||||
* Status: 🆕 Not Started
|
* Status: ✅ Completed
|
||||||
* *Concurrency: Depends on completion of both Phase 1 PRDs.*
|
* *Concurrency: Depends on completion of both Phase 1 PRDs.*
|
||||||
|
|
||||||
4. **API Request Handling** ([prd_api_request_handling.md](prd_api_request_handling.md))
|
4. **API Request Handling** ([prd_api_request_handling.md](prd_api_request_handling.md))
|
||||||
|
|
|
@ -9,5 +9,7 @@ pub mod version;
|
||||||
pub use auth::auth_with_args;
|
pub use auth::auth_with_args;
|
||||||
// Still using the old deploy implementation by default; will switch to the new one when fully ready
|
// Still using the old deploy implementation by default; will switch to the new one when fully ready
|
||||||
pub use deploy::deploy;
|
pub use deploy::deploy;
|
||||||
|
// Export the new deployment implementation for testing
|
||||||
|
pub use deploy_new::deploy as deploy_new;
|
||||||
pub use init::init;
|
pub use init::init;
|
||||||
pub use update::UpdateCommand;
|
pub use update::UpdateCommand;
|
||||||
|
|
Loading…
Reference in New Issue