datasecops-cli 0.7.0b11__tar.gz → 0.7.0b13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/CHANGELOG.md +29 -0
  2. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/PKG-INFO +11 -1
  3. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/README.md +10 -0
  4. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/docs/git-operations.md +2 -0
  5. datasecops_cli-0.7.0b13/docs/squash-merge-into-test-review.md +172 -0
  6. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/pyproject.toml +1 -1
  7. datasecops_cli-0.7.0b13/src/datasecops_cli/__init__.py +1 -0
  8. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/main.py +5 -1
  9. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/menus/configuration.py +2 -55
  10. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/menus/development.py +20 -24
  11. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/menus/git_operations.py +61 -34
  12. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/models/project_config.py +22 -1
  13. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/dbt_project_generator.py +29 -13
  14. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/download_service.py +89 -10
  15. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/git_service.py +58 -45
  16. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/upstream_service.py +5 -1
  17. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_mcp/server.py +14 -1
  18. datasecops_cli-0.7.0b13/tests/test_download_service.py +236 -0
  19. datasecops_cli-0.7.0b13/tests/test_git_operations_menu.py +58 -0
  20. datasecops_cli-0.7.0b13/tests/test_git_service.py +130 -0
  21. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_main.py +52 -6
  22. datasecops_cli-0.7.0b13/tests/test_mcp_branching_rules.py +74 -0
  23. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_models.py +25 -0
  24. datasecops_cli-0.7.0b13/tests/test_upstream_service.py +59 -0
  25. datasecops_cli-0.7.0b11/src/datasecops_cli/__init__.py +0 -1
  26. datasecops_cli-0.7.0b11/tests/test_download_service.py +0 -81
  27. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/.github/workflows/auto-tag.yml +0 -0
  28. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/.github/workflows/publish-cli.yml +0 -0
  29. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/.github/workflows/test.yml +0 -0
  30. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/.gitignore +0 -0
  31. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/AGENTS.md +0 -0
  32. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/DEVELOPMENT.md +0 -0
  33. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/LICENSE +0 -0
  34. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/docs/dcm.md +0 -0
  35. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/docs/getting-started.md +0 -0
  36. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/docs/legacy.md +0 -0
  37. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/docs/legacy_plan_of_action.md +0 -0
  38. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/docs/mcp-server.md +0 -0
  39. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/mcp-servers.json +0 -0
  40. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/scripts/vendor_model.py +0 -0
  41. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/setup.ps1 +0 -0
  42. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/setup.sh +0 -0
  43. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/config.py +0 -0
  44. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/menus/__init__.py +0 -0
  45. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/menus/dcm_operations.py +0 -0
  46. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/menus/downloads.py +0 -0
  47. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/models/__init__.py +0 -0
  48. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/models/git_helpers.py +0 -0
  49. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/__init__.py +0 -0
  50. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/bootstrap_service.py +0 -0
  51. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/dbt_runner.py +0 -0
  52. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/dcm_orchestrator.py +0 -0
  53. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/dcm_pipelines.py +0 -0
  54. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/dcm_registry.py +0 -0
  55. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/dcm_service.py +0 -0
  56. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/directory_scaffolder.py +0 -0
  57. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/linting_service.py +0 -0
  58. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/model_commands.py +0 -0
  59. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/pipeline_env.py +0 -0
  60. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/skill_service.py +0 -0
  61. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/services/snowflake_service.py +0 -0
  62. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/utilities/__init__.py +0 -0
  63. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/utilities/display.py +0 -0
  64. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/utilities/file_utils.py +0 -0
  65. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/utilities/mcp.py +0 -0
  66. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_cli/utilities/yaml_utils.py +0 -0
  67. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_mcp/__init__.py +0 -0
  68. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_mcp/__main__.py +0 -0
  69. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_mcp/connection.py +0 -0
  70. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/__init__.py +0 -0
  71. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/convert.py +0 -0
  72. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/diagram.py +0 -0
  73. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/expand.py +0 -0
  74. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/extract.py +0 -0
  75. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/render.py +0 -0
  76. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/schema.py +0 -0
  77. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/scope.py +0 -0
  78. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/scripts.py +0 -0
  79. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/starter.py +0 -0
  80. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/templates/macros/role.sql +0 -0
  81. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/templates/macros/role_guard.sql +0 -0
  82. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/templates/macros/warehouse.sql +0 -0
  83. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/src/datasecops_model/validate.py +0 -0
  84. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/__init__.py +0 -0
  85. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_config.py +0 -0
  86. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_dbt_project_generator_profiles.py +0 -0
  87. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_dbt_runner.py +0 -0
  88. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_dcm_model.py +0 -0
  89. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_dcm_orchestrator.py +0 -0
  90. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_dcm_service.py +0 -0
  91. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_file_utils.py +0 -0
  92. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_linting_service.py +0 -0
  93. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_mcp_lint_tools.py +0 -0
  94. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_model_commands.py +0 -0
  95. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_pipeline_env.py +0 -0
  96. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_version.py +0 -0
  97. {datasecops_cli-0.7.0b11 → datasecops_cli-0.7.0b13}/tests/test_yaml_utils.py +0 -0
@@ -2,6 +2,35 @@
2
2
 
3
3
  All notable changes to the DataSecOps CLI are documented in this file.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ## [0.7.0b13] - 2026-11-02
8
+
9
+ ### Fixed
10
+
11
+ - **`download packages` ignored a downstream project's package selection** — `download_dbt_packages()`'s filtering was nested inside `if profile.dbt_packages:`, so a downstream project with no packages selected of its own (relying entirely on an upstream project) skipped filtering altogether and got the full, unfiltered package list. The initial fix defaulted an empty selection to "everything the framework offers, minus upstream's" — still wrong, since a project that selected zero packages should get zero framework packages, not everything else. It now distinguishes three cases: an explicit selection (those packages, minus upstream's), no selection with an upstream project (none — only the upstream added as a dependency, see below), and no selection with no upstream project (everything, unchanged). Same fix applied to the unused `generate_packages_yml()`.
12
+ - **Upstream project dependencies now resolve as a real git package, not `local_packages/<name>`** — `local_packages/<name>` assumed the upstream project was checked out as a sibling directory, which isn't how these projects are actually laid out. Upstream dependencies are now added as `{git: <upstream git_url>, subdirectory: <upstream's project_dir>, revision: <latest tag>}`, with the latest tag resolved via `git ls-remote` against the upstream's `git_url` (same lookup `upstream_service.get_latest_tag()` already used for update checks). Azure DevOps URLs (exact `dev.azure.com` host, parsed rather than substring-matched) get a `DBT_ENV_SECRET_DEVOPS_PAT` `env_var()` Jinja placeholder inserted for dbt to authenticate with at parse time; the `git ls-remote` lookup itself authenticates with that env var's actual value (Jinja isn't resolved by plain git). An upstream project with no `git_url` configured is skipped with a warning rather than producing a broken package entry. `ProjectProfile` gains `project_dir` (default `"dbt"`, matching prior behavior) so a project whose dbt project isn't under `dbt/` resolves correctly. `upstream_service._urls_match()` now strips URL userinfo (the PAT/Jinja placeholder) before comparing, so the upstream-version checker still recognizes a generated entry as pinned. PR review follow-ups: an upstream profile with an empty selection and no upstream of its own now correctly contributes "every catalog package" (not just its empty explicit list) when computing what a downstream profile should exclude.
13
+ - **Configurable branch names (PR review follow-ups):**
14
+ - Legacy `main`/`test`/`prod` branches could leak through as selectable deploy/reset targets when a project configured different trunk/integration/production names but its `deployment_branches`/`environments` still carried the old literal names. `_deploy()` and `_reset_branch_from_main()` now always exclude the legacy defaults in addition to the configured names.
15
+ - A blank or `null` `trunk_branch`/`integration_branch`/`production_branch` in the native app's `SOURCE_CONTROL` config previously produced invalid branch refs (e.g. `origin/`) or aborted config loading entirely; `SourceControl` now falls back to the documented default for any blank/null value.
16
+ - `get_test_file_conflicts()`/`get_test_commits()` parsed a squash-merge commit's source branch by stripping `" into {current integration_branch}"` from its message — after renaming `integration_branch`, historical commits (which still say `" into {old name}"`) were misparsed, could be misclassified as stale, and silently force-removed from the integration branch. Parsing now splits on the last `" into "` separator, independent of the currently configured name.
17
+ - The MCP server's `get_branching_rules` omitted `trunk_branch`/`integration_branch`/`production_branch`; it now includes them (falling back to defaults for blank/null values).
18
+ - Git Operations menu labels and confirmations (`rebase`, `squash to test`, `remove from test`, `deploy to prod`, `reset branch`, and their confirmation/error text) now use the configured branch names instead of hardcoded `main`/`test`.
19
+
20
+ ## [0.7.0b12] - 2026-11-02
21
+
22
+ ### Added
23
+
24
+ - **Git deploy/trunk/integration branch names are configurable** — `SourceControl` gains `trunk_branch` (default `"main"`), `integration_branch` (default `"test"`), and `production_branch` (default `"prod"`), read from the native app's `SOURCE_CONTROL` framework config. `GitService` and the Git Operations menu (deploy, deploy to prod, squash to test, remove from test, reset branch, cleanup, delete branch) now use these settings instead of hardcoded `"main"`/`"test"`/`"prod"` literals. Existing projects keep working unchanged since the defaults match the old hardcoded values.
25
+
26
+ ### Changed
27
+
28
+ - **Lint menu merges find/fix pairs into single prompts** — the "find modified"/"fix modified" and "find all"/"fix all" option pairs are now one "modified" (or "changed" on dbt2, replacing the old separate "changed" option) and one "all" option each, asking "Also auto-fix the issues found?" instead of needing two separate menu entries.
29
+
30
+ ### Removed
31
+
32
+ - **Configuration menu's `dbt engine` and `upgrade dbt` options** — removed `[6] dbt engine` (local `.datasecops.yml` toggle between `dbt2`/`dbt_core`) and `[7] upgrade dbt` (unpinned `pip install --upgrade dbt`, dbt2 only). The engine toggle duplicated the framework's `PROJECT` config (which is already the source of truth for `dbt_engine`), and `upgrade dbt` bypassed the framework's pinned dbt version instead of going through `[1] install dbt`.
33
+
5
34
  ## [0.7.0b11] - 2026-11-01
6
35
 
7
36
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: datasecops-cli
3
- Version: 0.7.0b11
3
+ Version: 0.7.0b13
4
4
  Summary: DataSecOps Framework CLI for Snowflake Native App
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -137,6 +137,16 @@ none is marked active (matching how the app itself resolves a version to install
137
137
 
138
138
  Available items: `sqlfluff`, `pipelines`, `packages`, `macros`, `scripts`, `install-sqlfluff`, `install-dbt`, `all`
139
139
 
140
+ `datasecops download packages` resolves `packages.yml` from the native app's `DBT_PACKAGES`
141
+ catalog and the active profile:
142
+ - An explicit `dbt_packages` selection gets just those packages (minus anything an upstream
143
+ project already provides).
144
+ - No selection, but an `upstream_projects` entry: none of the framework catalog directly — only
145
+ the upstream project(s), added as `{git: <upstream git_url>, subdirectory: dbt, revision:
146
+ <latest tag>}`. Azure DevOps upstream URLs get a `DBT_ENV_SECRET_DEVOPS_PAT` `env_var()` Jinja
147
+ placeholder inserted for dbt to authenticate with.
148
+ - No selection and no upstream project: every package in the catalog.
149
+
140
150
  The pipeline platform (GitHub / Azure DevOps) is auto-detected from the native app's source control configuration.
141
151
 
142
152
  ### Pipeline Setup
@@ -117,6 +117,16 @@ none is marked active (matching how the app itself resolves a version to install
117
117
 
118
118
  Available items: `sqlfluff`, `pipelines`, `packages`, `macros`, `scripts`, `install-sqlfluff`, `install-dbt`, `all`
119
119
 
120
+ `datasecops download packages` resolves `packages.yml` from the native app's `DBT_PACKAGES`
121
+ catalog and the active profile:
122
+ - An explicit `dbt_packages` selection gets just those packages (minus anything an upstream
123
+ project already provides).
124
+ - No selection, but an `upstream_projects` entry: none of the framework catalog directly — only
125
+ the upstream project(s), added as `{git: <upstream git_url>, subdirectory: dbt, revision:
126
+ <latest tag>}`. Azure DevOps upstream URLs get a `DBT_ENV_SECRET_DEVOPS_PAT` `env_var()` Jinja
127
+ placeholder inserted for dbt to authenticate with.
128
+ - No selection and no upstream project: every package in the catalog.
129
+
120
130
  The pipeline platform (GitHub / Azure DevOps) is auto-detected from the native app's source control configuration.
121
131
 
122
132
  ### Pipeline Setup
@@ -2,6 +2,8 @@
2
2
 
3
3
  The CLI provides a structured git workflow designed around a branching strategy where feature branches are squash-merged into a `test` branch for integration testing, and only `main` is deployed to production.
4
4
 
5
+ > The `main`/`test`/`prod` branch names below are the defaults. They're configurable via the native app's `SOURCE_CONTROL` framework config (`trunk_branch`, `integration_branch`, `production_branch`) — set those if your project uses different branch names (e.g. `trunk`/`staging`/`release`).
6
+
5
7
  ## Branch Strategy
6
8
 
7
9
  ```
@@ -0,0 +1,172 @@
1
+ # Review: "Squash Merge into Test" Functionality
2
+
3
+ This is a code-level review of what `datasecops`'s "squash to test" / "remove from test" Git
4
+ Operations actually do, as implemented today in `src/datasecops_cli/services/git_service.py`
5
+ and `src/datasecops_cli/menus/git_operations.py`. It traces the exact sequence of git commands
6
+ run, not just the intended design.
7
+
8
+ Branch names used below assume the defaults (`main` trunk, `test` integration branch), which are
9
+ now configurable via `SourceControl.trunk_branch` / `SourceControl.integration_branch` — see
10
+ [`docs/git-operations.md`](git-operations.md). Everywhere `test` is written below, read it as
11
+ "the configured integration branch", and `main` as "the configured trunk branch".
12
+
13
+ ## What it's for
14
+
15
+ Feature/bugfix/hotfix branches are built from `main`. Instead of merging each one into `main`
16
+ directly, they're **squash-merged into a shared `test` branch** so multiple branches' changes can
17
+ be integration-tested together on Snowflake before anything reaches production. `test` is never
18
+ merged back into `main` — `main` only ever gets deployed to prod directly, from its own commits.
19
+ `test` is a disposable, force-pushed scratch branch whose entire history is rebuilt from `main` on
20
+ every squash merge.
21
+
22
+ ## Entry point: `GitOperationsMenu._squash_merge_test()`
23
+
24
+ (`menus/git_operations.py:246-281`)
25
+
26
+ This is menu option `[7] squash to test`. It runs three checks *before* calling
27
+ `GitService.squash_merge_into_test()`, and the checks are where most of the actual safety logic
28
+ lives — `squash_merge_into_test()` itself does no validation at all.
29
+
30
+ ### Check 1 — your branch must be up to date with `main`
31
+
32
+ `GitService.is_branch_up_to_date_with_main()` (`git_service.py:223-232`):
33
+
34
+ ```python
35
+ self.repo.remotes.origin.fetch()
36
+ merge_base = self.repo.git.merge_base("HEAD", f"origin/{self.trunk_branch}")
37
+ main_sha = self.repo.commit(f"origin/{self.trunk_branch}").hexsha
38
+ return merge_base.strip() == main_sha
39
+ ```
40
+
41
+ This checks that `origin/main`'s tip is an ancestor of `HEAD` — i.e. your branch already contains
42
+ every commit on `main`. If not, the menu rejects the merge outright ("Rebase with main first")
43
+ and nothing further happens. This is the only thing standing between your branch and a squash
44
+ merge; if you're behind main but a rebase isn't forced, nothing re-checks this later.
45
+
46
+ ### Check 2 — file-overlap detection against what's currently on `test`
47
+
48
+ `GitService.get_test_file_conflicts()` (`git_service.py:320-363`):
49
+
50
+ 1. Fetches, then diffs your branch against `origin/main` (`git diff --name-only origin/main...HEAD`)
51
+ to get the set of files *you've* touched.
52
+ 2. Walks the last 100 commits on `origin/test`, looking only at commits whose message starts with
53
+ `"squash merge:"` — i.e. commits this same tool produced.
54
+ 3. For each such commit, parses out which branch it came from by string-manipulating the commit
55
+ message (see **Known issue** below), and diffs that single commit's tree
56
+ (`git diff-tree --no-commit-id --name-only -r <sha>`) to get the files *it* touched.
57
+ 4. If your files and that commit's files intersect, it's a "conflict" — recorded with the other
58
+ branch's name, its commit SHA, the overlapping files, and whether that branch still exists on
59
+ the remote (checked against `origin`'s current branch list).
60
+
61
+ Back in the menu, conflicts split into two buckets:
62
+
63
+ - **Active conflict** (the other branch still exists remotely): the merge is **rejected**. You're
64
+ told to resolve it with the branch owner or remove their branch from `test` first. Nothing is
65
+ mutated.
66
+ - **Stale conflict** (the other branch no longer exists remotely — e.g. it was merged to main and
67
+ deleted): the menu automatically calls `revert_from_test()` to drop that old commit from `test`
68
+ before proceeding, with a warning printed. This happens silently as part of "squash to test" —
69
+ there's no separate confirmation for this specific removal.
70
+
71
+ ### Check 3 — final user confirmation, then the actual merge
72
+
73
+ Only after both checks pass does the menu ask "Continue?" and, if yes, call
74
+ `squash_merge_into_test()`.
75
+
76
+ ## The merge itself: `GitService.squash_merge_into_test()`
77
+
78
+ (`git_service.py:234-272`)
79
+
80
+ Step by step:
81
+
82
+ 1. **Stash** any uncommitted changes in the working tree (`git stash push -u`), remembering
83
+ whether anything was stashed.
84
+ 2. **Fetch** from origin.
85
+ 3. **Checkout `test`** via `_checkout_test()` (`git_service.py:213-221`), which:
86
+ - tries `git checkout test` (works if you already have a local `test` branch),
87
+ - else creates it from `origin/test` (`git checkout -b test origin/test`),
88
+ - else — if `origin/test` doesn't exist yet at all — creates it from `origin/main` instead.
89
+ 4. **Pull** `test` (best-effort — failure here is silently swallowed; a brand-new local branch
90
+ with no upstream will fail this pull and that's expected/fine).
91
+ 5. **Rebase `test` onto `origin/main`** (`git rebase origin/main`). This is the step that keeps
92
+ `test`'s base in sync with `main` — `test` always ends up looking like "main + all currently
93
+ active squash commits", never drifting from main's latest state.
94
+ 6. **Squash-merge your branch into `test`** (`git merge --squash <current-branch>`) — stages your
95
+ branch's full diff without creating a merge commit.
96
+ 7. **Commit** with message `"squash merge: {your-branch} into {test}"`. This exact string format
97
+ is load-bearing: it's how `get_test_commits()` and `get_test_file_conflicts()` later identify
98
+ which commits on `test` came from which feature branch.
99
+ 8. **Force-push `test`** (`git push test --set-upstream --force`). Force is required because step
100
+ 5 just rewrote `test`'s history via rebase.
101
+ 9. **Checkout back to your original branch** and **pop the stash** if one was made.
102
+
103
+ ### On any `GitCommandError` during the above
104
+
105
+ - Abort any in-progress rebase (`git rebase --abort`, failure ignored).
106
+ - Best-effort checkout back to your original branch.
107
+ - Best-effort stash pop.
108
+ - Return `False`; the menu's `success_line`/`error_line` reporting is based on this.
109
+
110
+ Note the ordering risk here: steps 3–8 all happen on `test` while your original branch sits
111
+ unchecked-out. If the process is killed between step 6 (squash) and step 9 (checkout back), you
112
+ are left on `test` with an uncommitted squash merge staged and your stash (if any) still stashed —
113
+ there's no re-entrant recovery for that specific failure window; it relies on the `except` block
114
+ running, which only triggers on `GitCommandError`, not on e.g. a `KeyboardInterrupt`.
115
+
116
+ ## "Remove from Test": `GitOperationsMenu._cherry_pick_test()` → `revert_from_test()`
117
+
118
+ (`menus/git_operations.py:283-299`, `git_service.py:274-318`)
119
+
120
+ 1. `get_test_commits()` (`git_service.py:365-384`) walks the last 100 commits on `origin/test`,
121
+ filters to ones starting with `"squash merge:"`, and parses out the branch name from each
122
+ message the same way `get_test_file_conflicts()` does.
123
+ 2. The menu lists them (newest-first per git log order) and lets you pick one by number.
124
+ 3. `revert_from_test(sha, branch_name)`:
125
+ - stash / fetch / checkout `test` (same pattern as the merge flow),
126
+ - pull `test` (best-effort),
127
+ - **refuses** if the target commit has more than one parent (i.e. it's not a plain squash
128
+ commit — defends against someone having manually merged something onto `test`),
129
+ - `git rebase --onto <sha>^ <sha> test` — this surgically **drops** that one commit from
130
+ history (not a revert-commit; the commit is gone, as if it never happened), replaying
131
+ everything after it on top of its parent,
132
+ - force-pushes `test`,
133
+ - checks out back to your original branch, pops stash if needed.
134
+
135
+ This is why `test`'s history is disposable: branches are added and removed from it by literally
136
+ rewriting history and force-pushing, never by merge/revert commits.
137
+
138
+ ## Known issue found during this review
139
+
140
+ **Bug: commit-message parsing breaks if `integration_branch` is renamed after commits already
141
+ exist on the old name.**
142
+
143
+ Both `get_test_file_conflicts()` (`git_service.py:346`) and `get_test_commits()`
144
+ (`git_service.py:372`) parse the branch name out of a squash-merge commit message like this:
145
+
146
+ ```python
147
+ other_branch = msg.replace("squash merge: ", "", 1).replace(f" into {self.integration_branch}", "")
148
+ ```
149
+
150
+ This only strips the `" into {integration_branch}"` suffix if it matches the **currently
151
+ configured** `integration_branch`. A commit made *before* a project renamed its integration branch
152
+ (say from `test` to `staging`) has the literal text `"squash merge: feature/orders into test"`
153
+ baked into its message forever (commit messages don't change when you rename branches). After the
154
+ rename, `self.integration_branch` is `"staging"`, so `.replace(" into staging", "")` doesn't match
155
+ `" into test"`, and `other_branch` comes out as `"feature/orders into test"` instead of
156
+ `"feature/orders"`.
157
+
158
+ Concretely, this breaks:
159
+ - The "remove from test" menu — it lists a mangled, unselectable-looking branch name.
160
+ - File-conflict detection — `other_branch == current` can never be true for that old commit (since
161
+ `current` is a real branch name without the `" into test"` suffix), so a conflict against your
162
+ *own* branch's old commit won't be recognized as "skip, that's me." More importantly,
163
+ `other_branch in remote_branches` will be `False` for the mangled name even if the real branch
164
+ still exists, so the commit is misclassified as **stale** and gets auto-removed
165
+ (`revert_from_test`) and force-pushed over on your next squash merge — silently dropping another
166
+ branch's integration-test changes without the "active conflict, rejected" warning that would
167
+ normally protect it.
168
+
169
+ This only manifests after an `integration_branch` rename with pre-existing history on the old
170
+ branch name; it does not affect projects that have never changed `integration_branch` from its
171
+ configured value. Fix direction: parse using the last `" into "` separator in the message
172
+ (independent of the currently configured name), e.g. `msg[len("squash merge: "):].rsplit(" into ", 1)[0]`.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "datasecops-cli"
7
- version = "0.7.0b11"
7
+ version = "0.7.0b13"
8
8
  description = "DataSecOps Framework CLI for Snowflake Native App"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1 @@
1
+ __version__ = "0.7.0b13"
@@ -965,7 +965,11 @@ def _run_interactive(config: Config):
965
965
  )
966
966
 
967
967
  try:
968
- git_service = GitService(config.project_dir)
968
+ git_service = GitService(
969
+ config.project_dir,
970
+ trunk_branch=config.source_control.trunk_branch,
971
+ integration_branch=config.source_control.integration_branch,
972
+ )
969
973
  except Exception:
970
974
  git_service = None
971
975
 
@@ -10,11 +10,10 @@ from datasecops_cli.services.download_service import DownloadService
10
10
  from datasecops_cli.services.linting_service import LintingService
11
11
  from datasecops_cli.utilities.display import (
12
12
  clear, section_header, display_action_header, menu_option,
13
- get_input_number, get_input_true_false, complete_action,
14
- info_line, success_line, warning_line, error_line,
13
+ get_input_number, complete_action,
14
+ info_line, success_line, error_line,
15
15
  get_input_string, select_from_list, select_multiple_from_list
16
16
  )
17
- from datasecops_cli.utilities.yaml_utils import write_datasecops_config
18
17
 
19
18
 
20
19
  class ConfigurationMenu:
@@ -49,16 +48,11 @@ class ConfigurationMenu:
49
48
  complete_action()
50
49
  elif option == 5:
51
50
  self._cortex_upgrade()
52
- elif option == 6:
53
- self._toggle_dbt_engine()
54
- elif option == 7:
55
- self._upgrade_dbt2()
56
51
  self._menu()
57
52
  option = get_input_number("Choose an option: ")
58
53
 
59
54
  def _menu(self) -> None:
60
55
  clear()
61
- engine_label = self.datasecops_config.get_engine_label()
62
56
  is_dbt2 = self.datasecops_config.dbt_engine == "dbt2"
63
57
  section_header("Configuration", self.profile_name)
64
58
  if is_dbt2:
@@ -69,9 +63,6 @@ class ConfigurationMenu:
69
63
  menu_option(3, "mcp servers - Configure MCP servers for AI tools")
70
64
  menu_option(4, "new project - Initialize a new dbt project with framework profiles")
71
65
  menu_option(5, "cortex update - Update CoCo to the latest version")
72
- menu_option(6, f"dbt engine - Switch dbt engine (current: {engine_label})")
73
- if is_dbt2:
74
- menu_option(7, "upgrade dbt - Upgrade dbt 2.0 to the latest version (pip)")
75
66
  menu_option(0, "back - Return to main menu")
76
67
 
77
68
  def _install_dbt_requirements(self) -> None:
@@ -238,47 +229,3 @@ class ConfigurationMenu:
238
229
  except FileNotFoundError:
239
230
  error_line("CoCo CLI not found.")
240
231
  complete_action()
241
-
242
- def _toggle_dbt_engine(self) -> None:
243
- """Toggle between dbt 2.0 and dbt Core (1.x)."""
244
- display_action_header("Switch dbt Engine")
245
- current = self.datasecops_config.dbt_engine or "dbt_core"
246
- info_line(f"Current engine: {self.datasecops_config.get_engine_label()} ({current})")
247
- info_line("")
248
- menu_option(1, "dbt 2.0 - dbt2 (recommended)")
249
- menu_option(2, "dbt Core 1.x - dbt_core")
250
- menu_option(0, "cancel")
251
- option = get_input_number("Choose an option: ")
252
-
253
- if option == 1:
254
- new_engine = "dbt2"
255
- elif option == 2:
256
- new_engine = "dbt_core"
257
- else:
258
- return
259
-
260
- if new_engine == current:
261
- info_line("No change.")
262
- complete_action()
263
- return
264
-
265
- self.datasecops_config.dbt_engine = new_engine
266
- config_data = self.datasecops_config.model_dump(exclude={"VALID_ENGINES"})
267
- write_datasecops_config(self.project_dir, config_data)
268
- success_line(f"dbt engine switched to {self.datasecops_config.get_engine_label()} ({new_engine})")
269
- warning_line("Restart the CLI for the change to take effect.")
270
- complete_action()
271
-
272
- def _upgrade_dbt2(self) -> None:
273
- """Upgrade dbt 2.0 to the latest version via pip."""
274
- display_action_header("Upgrade dbt 2.0")
275
- if not shutil.which("dbt"):
276
- error_line("dbt not found. Install it first.")
277
- complete_action()
278
- return
279
- try:
280
- info_line("Upgrading dbt via uv pip...")
281
- subprocess.run(["uv", "pip", "install", "--upgrade", "dbt"])
282
- except FileNotFoundError:
283
- error_line("uv not found.")
284
- complete_action()
@@ -296,33 +296,32 @@ class DevelopmentMenu:
296
296
  def _lint_menu(self) -> None:
297
297
  clear()
298
298
  is_dbt2 = self.linting.dbt_engine == "dbt2"
299
- lint_label = "dbt lint" if is_dbt2 else "SQLFluff"
300
- display_action_header(f"{lint_label} Linting Options")
301
- menu_option(1, "find modified - Lint modified SQL files")
302
- menu_option(2, "fix modified - Fix modified SQL files")
303
- menu_option(3, "find all - Lint all SQL files")
304
- menu_option(4, "fix all - Fix all SQL files")
305
- menu_option(5, "specific - Lint specific file")
306
- menu_option(6, "refresh config- Re-download .sqlfluff from framework")
299
+ display_action_header("Linting Options")
307
300
  if is_dbt2:
308
- menu_option(7, "changed - Lint only git-changed files (dbt lint --changed)")
309
- menu_option(8, "format - Auto-format SQL files (dbt format/fmt)")
301
+ menu_option(1, "changed - Lint only git-changed files (dbt lint --changed)")
302
+ else:
303
+ menu_option(1, "modified - Lint modified SQL files")
304
+ menu_option(2, "all - Lint all SQL files")
305
+ menu_option(3, "specific - Lint specific file")
306
+ menu_option(4, "refresh config- Re-download .sqlfluff from framework")
307
+ if is_dbt2:
308
+ menu_option(5, "format - Auto-format SQL files (dbt format/fmt)")
310
309
  menu_option(0, "back - Return to development menu")
311
310
  option = get_input_number("Choose an option: ")
312
- if option in (1, 2, 3, 4, 5, 7, 8) and not self._ensure_sqlfluff_config():
311
+ if option in (1, 2, 3, 5) and not self._ensure_sqlfluff_config():
313
312
  complete_action()
314
313
  return
315
314
  if option == 1:
316
- changed = self.git.get_all_modified_files() if self.git else []
317
- self.linting.lint_modified(fix=False, changed_files=changed)
315
+ fix = get_input_true_false("Also auto-fix the issues found?", "n")
316
+ if is_dbt2:
317
+ self.linting.lint_changed(fix=fix)
318
+ else:
319
+ changed = self.git.get_all_modified_files() if self.git else []
320
+ self.linting.lint_modified(fix=fix, changed_files=changed)
318
321
  elif option == 2:
319
- changed = self.git.get_all_modified_files() if self.git else []
320
- self.linting.lint_modified(fix=True, changed_files=changed)
322
+ fix = get_input_true_false("Also auto-fix the issues found?", "n")
323
+ self.linting.lint_file(fix=fix)
321
324
  elif option == 3:
322
- self.linting.lint_file(fix=False)
323
- elif option == 4:
324
- self.linting.lint_file(fix=True)
325
- elif option == 5:
326
325
  name = get_input_string("Enter model name or file path (e.g. stg_orders): ")
327
326
  if name != "0":
328
327
  path = name if name.endswith(".sql") else self.linting.resolve_model_path(name)
@@ -343,15 +342,12 @@ class DevelopmentMenu:
343
342
  jinja_render_mode=jinja_render_mode)
344
343
  else:
345
344
  error_line(f"Could not find model '{name}' in models/ directory")
346
- elif option == 6:
345
+ elif option == 4:
347
346
  if not self.downloads:
348
347
  error_line("Download service not available")
349
348
  else:
350
349
  self.downloads.download_sqlfluff_config(profiles_dir=self.profiles_dir, dbt_project_dir=self.linting.project_dir)
351
- elif option == 7 and is_dbt2:
352
- fix = get_input_true_false("Also auto-fix the issues found?", "n")
353
- self.linting.lint_changed(fix=fix)
354
- elif option == 8 and is_dbt2:
350
+ elif option == 5 and is_dbt2:
355
351
  name = get_input_string(
356
352
  "Enter model name or file path to format, or leave blank for the whole project "
357
353
  "('0' to cancel): ",