bricksentry 0.1.13__tar.gz → 0.1.14__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 (69) hide show
  1. {bricksentry-0.1.13 → bricksentry-0.1.14}/CHANGELOG.md +9 -0
  2. {bricksentry-0.1.13 → bricksentry-0.1.14}/PKG-INFO +29 -2
  3. {bricksentry-0.1.13 → bricksentry-0.1.14}/README.md +28 -1
  4. bricksentry-0.1.14/examples/databricks/bricksentry_hr_walkthrough.ipynb +552 -0
  5. bricksentry-0.1.14/examples/databricks/bricksentry_hr_walkthrough.py +413 -0
  6. {bricksentry-0.1.13 → bricksentry-0.1.14}/pyproject.toml +1 -1
  7. {bricksentry-0.1.13 → bricksentry-0.1.14}/scripts/build_notebook.py +1 -0
  8. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/__init__.py +1 -1
  9. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/assess.py +18 -0
  10. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/backends/base.py +12 -0
  11. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/backends/databricks_backend.py +28 -0
  12. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/cli.py +61 -0
  13. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/config.py +9 -2
  14. bricksentry-0.1.14/src/bricksentry/history.py +183 -0
  15. bricksentry-0.1.14/src/bricksentry/job.py +184 -0
  16. bricksentry-0.1.14/templates/job-check/README.md +13 -0
  17. bricksentry-0.1.14/templates/job-check/template/{{.project_name}}/src/bricksentry_check.py +7 -0
  18. bricksentry-0.1.14/tests/test_0114.py +357 -0
  19. bricksentry-0.1.14/tests/test_hr_notebook.py +188 -0
  20. {bricksentry-0.1.13 → bricksentry-0.1.14}/.gitignore +0 -0
  21. {bricksentry-0.1.13 → bricksentry-0.1.14}/CONTRIBUTING.md +0 -0
  22. {bricksentry-0.1.13 → bricksentry-0.1.14}/LICENSE +0 -0
  23. {bricksentry-0.1.13 → bricksentry-0.1.14}/SECURITY.md +0 -0
  24. {bricksentry-0.1.13 → bricksentry-0.1.14}/action.yml +0 -0
  25. {bricksentry-0.1.13 → bricksentry-0.1.14}/deploy/databricks-app/README.md +0 -0
  26. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/bricksentry.yml +0 -0
  27. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/bricksentry_check_my_table.ipynb +0 -0
  28. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/bricksentry_check_my_table.py +0 -0
  29. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
  30. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/bricksentry_quickstart.py +0 -0
  31. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/github-workflow.yml +0 -0
  32. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/databricks/policy.yml +0 -0
  33. {bricksentry-0.1.13 → bricksentry-0.1.14}/examples/demo/agent_loop_demo.py +0 -0
  34. {bricksentry-0.1.13 → bricksentry-0.1.14}/packages/bricksentry-mcp/LICENSE +0 -0
  35. {bricksentry-0.1.13 → bricksentry-0.1.14}/packages/bricksentry-mcp/README.md +0 -0
  36. {bricksentry-0.1.13 → bricksentry-0.1.14}/packages/bricksentry-mcp/src/bricksentry_mcp/__init__.py +0 -0
  37. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/__main__.py +0 -0
  38. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/agent_tools.py +0 -0
  39. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/backends/__init__.py +0 -0
  40. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/backends/duckdb_backend.py +0 -0
  41. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/changes.py +0 -0
  42. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/demo.py +0 -0
  43. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/diff.py +0 -0
  44. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/explain.py +0 -0
  45. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/github.py +0 -0
  46. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/lineage.py +0 -0
  47. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/mcp_server.py +0 -0
  48. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/measures.py +0 -0
  49. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/models.py +0 -0
  50. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/notify.py +0 -0
  51. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/policy.py +0 -0
  52. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/policy_templates.py +0 -0
  53. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/preview.py +0 -0
  54. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/py.typed +0 -0
  55. {bricksentry-0.1.13 → bricksentry-0.1.14}/src/bricksentry/report.py +0 -0
  56. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/conftest.py +0 -0
  57. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_0110.py +0 -0
  58. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_0112.py +0 -0
  59. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_018.py +0 -0
  60. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_019.py +0 -0
  61. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_assess_policy.py +0 -0
  62. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_check_notebook.py +0 -0
  63. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_databricks_and_uc.py +0 -0
  64. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_demo.py +0 -0
  65. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_diff.py +0 -0
  66. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_notebook.py +0 -0
  67. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_notify_templates.py +0 -0
  68. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_preview_agents.py +0 -0
  69. {bricksentry-0.1.13 → bricksentry-0.1.14}/tests/test_sample_guard_and_store.py +0 -0
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.14 (2026-11-11)
4
+
5
+ Zero-friction adoption: check every pipeline run without changing the pipeline.
6
+
7
+ - **`bricksentry check-last-change <table>`** checks a change that already landed, from the table's Delta history. It finds the newest data change (WRITE, MERGE, UPDATE, DELETE, COPY INTO, ...; OPTIMIZE and VACUUM are skipped), compares the version before with the version after (two shallow clones in `sandbox_schema`, dropped afterwards), runs lineage and policy, sends the alert, and prints the `RESTORE` that undoes it. `--version N` checks a specific version; `--since TIME` checks everything after that time as one change, e.g. all a job run wrote. Keys come from config, `--key`, or the table's `PRIMARY KEY`. Python: `Sentry.check_change(table)`.
8
+ - **Asset Bundle template** in `templates/job-check`: `databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check` creates a serverless job with a table update trigger that checks every change to up to 10 tables, alerts on Slack (webhook read from a secret scope) and fails the run at the verdict you choose. Its README shows how to add the check as a task inside an existing job so a `block` stops the downstream tasks.
9
+ - **`python -m bricksentry.job`**: the job-task entry point used by the template. Takes the table list the trigger provides, a Slack or Teams webhook from a secret scope, and a link back to the run for the alert.
10
+ - Fix: in `bricksentry.yml`, `notify: {on: block}` was ignored, because YAML reads an unquoted `on` key as `true`. It is now read correctly (quoting it was the workaround).
11
+
3
12
  ## 0.1.13 (2026-11-11)
4
13
 
5
14
  From the first live test of column lineage on Databricks (the 0.1.12 column features were verified against real `system.access.column_lineage` and column tags):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bricksentry
3
- Version: 0.1.13
3
+ Version: 0.1.14
4
4
  Summary: Change-safety for Databricks pipelines and the AI agents that edit them: data diffs, Unity Catalog blast radius, policy verdicts and rollback plans.
5
5
  Project-URL: Homepage, https://bricksentry.org
6
6
  Project-URL: Documentation, https://bricksentry.org/docs
@@ -83,6 +83,32 @@ Point the [check-my-table notebook](examples/databricks/bricksentry_check_my_tab
83
83
 
84
84
  If it shows you something, please [share what it found](https://github.com/bricksentry/bricksentry/issues/new?template=it_caught_this.yml) (no table names needed). Real results decide what gets built next.
85
85
 
86
+ ### Check every pipeline run automatically (Asset Bundle, 5 minutes)
87
+
88
+ ```bash
89
+ databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check
90
+ cd bricksentry_check && databricks bundle deploy -t prod
91
+ ```
92
+
93
+ Answer a few prompts (tables to watch, SQL warehouse, scratch schema, policy, optional Slack webhook secret). You get a serverless job with a **table update trigger**: whenever a watched table changes, it checks the change, sends the alert and logs the `RESTORE` that undoes it. To stop downstream tasks when a change is bad, add the same check as a task inside your pipeline job, right after the write (the generated README shows the YAML): with `--since {{job.start_time.iso_datetime}}` it checks everything the run wrote, and a `block` verdict fails the task so the tasks after it don't run.
94
+
95
+ From the command line, the same check is one command:
96
+
97
+ ```bash
98
+ bricksentry check-last-change main.sales.orders # newest data change vs the version before
99
+ bricksentry check-last-change main.sales.orders --version 42 # a specific version
100
+ bricksentry check-last-change main.sales.orders --since 2026-11-11T09:00:00Z --fail-on needs_human
101
+ ```
102
+
103
+ Keys come from `bricksentry.yml`, `--key`, or the table's `PRIMARY KEY` constraint. OPTIMIZE and VACUUM commits are skipped because they don't change data.
104
+
105
+ ### Every feature on an HR pipeline
106
+
107
+ > **HR walkthrough notebook:** Workspace → Import → URL →
108
+ > `https://raw.githubusercontent.com/bricksentry/bricksentry/main/examples/databricks/bricksentry_hr_walkthrough.py`
109
+
110
+ The [HR walkthrough](examples/databricks/bricksentry_hr_walkthrough.py) builds a 200,000-row employee table (tagged pii) feeding a certified pay summary, then shows everything bricksentry does on it: table and column blast radius, two pull requests (one risky, one broken), every rule, an agent's write previewed on a clone with dangerous SQL refused, the PR report, column-level policies, sampling that can't hide a duplicate, lineage from config, alerts and the MCP tools. It removes everything it created at the end. First run on a live workspace by Genie, an AI agent in Databricks, in November 2026.
111
+
86
112
  ### Guided tour on demo data
87
113
 
88
114
  > **Databricks quickstart notebook:** in your workspace, go to **Workspace → Import → URL** and paste
@@ -185,6 +211,7 @@ bricksentry diff main.sales.orders main.sales_pr_42.orders
185
211
  bricksentry preview main.sales.orders --sql "MERGE INTO {{target}} t USING updates u ON t.order_id = u.order_id WHEN MATCHED THEN UPDATE SET *"
186
212
  bricksentry assess --from-git origin/main --pr 42 --format markdown --fail-on needs_human
187
213
  bricksentry rollback main.sales.orders
214
+ bricksentry check-last-change main.sales.orders # the change a pipeline already made
188
215
  ```
189
216
 
190
217
  Exit codes: `0` below `--fail-on`, `1` at or above it, `2` for configuration errors.
@@ -393,7 +420,7 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
393
420
  - `CAN USE` on a SQL warehouse.
394
421
  - `SELECT` on the tables you assess and their candidates.
395
422
  - `SELECT` on `system.access.table_lineage` (and `system.access.column_lineage` for column-level impact), plus `system.information_schema` for owners, table tags and column tags. Without lineage access bricksentry still diffs, and adds a `lineage-unavailable` warning (blast radius unknown) instead of guessing.
396
- - `CREATE TABLE` on `sandbox_schema`, for `preview_write`.
423
+ - `CREATE TABLE` on `sandbox_schema`, for `preview_write` and `check-last-change`. `check-last-change` also needs the table's Delta history (versions not yet removed by `VACUUM`).
397
424
 
398
425
  ## Known limits (v0.1.x)
399
426
 
@@ -36,6 +36,32 @@ Point the [check-my-table notebook](examples/databricks/bricksentry_check_my_tab
36
36
 
37
37
  If it shows you something, please [share what it found](https://github.com/bricksentry/bricksentry/issues/new?template=it_caught_this.yml) (no table names needed). Real results decide what gets built next.
38
38
 
39
+ ### Check every pipeline run automatically (Asset Bundle, 5 minutes)
40
+
41
+ ```bash
42
+ databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check
43
+ cd bricksentry_check && databricks bundle deploy -t prod
44
+ ```
45
+
46
+ Answer a few prompts (tables to watch, SQL warehouse, scratch schema, policy, optional Slack webhook secret). You get a serverless job with a **table update trigger**: whenever a watched table changes, it checks the change, sends the alert and logs the `RESTORE` that undoes it. To stop downstream tasks when a change is bad, add the same check as a task inside your pipeline job, right after the write (the generated README shows the YAML): with `--since {{job.start_time.iso_datetime}}` it checks everything the run wrote, and a `block` verdict fails the task so the tasks after it don't run.
47
+
48
+ From the command line, the same check is one command:
49
+
50
+ ```bash
51
+ bricksentry check-last-change main.sales.orders # newest data change vs the version before
52
+ bricksentry check-last-change main.sales.orders --version 42 # a specific version
53
+ bricksentry check-last-change main.sales.orders --since 2026-11-11T09:00:00Z --fail-on needs_human
54
+ ```
55
+
56
+ Keys come from `bricksentry.yml`, `--key`, or the table's `PRIMARY KEY` constraint. OPTIMIZE and VACUUM commits are skipped because they don't change data.
57
+
58
+ ### Every feature on an HR pipeline
59
+
60
+ > **HR walkthrough notebook:** Workspace → Import → URL →
61
+ > `https://raw.githubusercontent.com/bricksentry/bricksentry/main/examples/databricks/bricksentry_hr_walkthrough.py`
62
+
63
+ The [HR walkthrough](examples/databricks/bricksentry_hr_walkthrough.py) builds a 200,000-row employee table (tagged pii) feeding a certified pay summary, then shows everything bricksentry does on it: table and column blast radius, two pull requests (one risky, one broken), every rule, an agent's write previewed on a clone with dangerous SQL refused, the PR report, column-level policies, sampling that can't hide a duplicate, lineage from config, alerts and the MCP tools. It removes everything it created at the end. First run on a live workspace by Genie, an AI agent in Databricks, in November 2026.
64
+
39
65
  ### Guided tour on demo data
40
66
 
41
67
  > **Databricks quickstart notebook:** in your workspace, go to **Workspace → Import → URL** and paste
@@ -138,6 +164,7 @@ bricksentry diff main.sales.orders main.sales_pr_42.orders
138
164
  bricksentry preview main.sales.orders --sql "MERGE INTO {{target}} t USING updates u ON t.order_id = u.order_id WHEN MATCHED THEN UPDATE SET *"
139
165
  bricksentry assess --from-git origin/main --pr 42 --format markdown --fail-on needs_human
140
166
  bricksentry rollback main.sales.orders
167
+ bricksentry check-last-change main.sales.orders # the change a pipeline already made
141
168
  ```
142
169
 
143
170
  Exit codes: `0` below `--fail-on`, `1` at or above it, `2` for configuration errors.
@@ -346,7 +373,7 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
346
373
  - `CAN USE` on a SQL warehouse.
347
374
  - `SELECT` on the tables you assess and their candidates.
348
375
  - `SELECT` on `system.access.table_lineage` (and `system.access.column_lineage` for column-level impact), plus `system.information_schema` for owners, table tags and column tags. Without lineage access bricksentry still diffs, and adds a `lineage-unavailable` warning (blast radius unknown) instead of guessing.
349
- - `CREATE TABLE` on `sandbox_schema`, for `preview_write`.
376
+ - `CREATE TABLE` on `sandbox_schema`, for `preview_write` and `check-last-change`. `check-last-change` also needs the table's Delta history (versions not yet removed by `VACUUM`).
350
377
 
351
378
  ## Known limits (v0.1.x)
352
379