bricksentry 0.1.24__tar.gz → 0.1.26__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 (91) hide show
  1. {bricksentry-0.1.24 → bricksentry-0.1.26}/CHANGELOG.md +20 -0
  2. {bricksentry-0.1.24 → bricksentry-0.1.26}/PKG-INFO +5 -3
  3. {bricksentry-0.1.24 → bricksentry-0.1.26}/README.md +4 -2
  4. bricksentry-0.1.26/deploy/databricks-app/requirements.txt +1 -0
  5. bricksentry-0.1.26/examples/databricks/bricksentry_validation.ipynb +152 -0
  6. bricksentry-0.1.26/examples/databricks/bricksentry_validation.py +95 -0
  7. {bricksentry-0.1.24 → bricksentry-0.1.26}/pyproject.toml +1 -1
  8. {bricksentry-0.1.24 → bricksentry-0.1.26}/scripts/build_notebook.py +1 -0
  9. {bricksentry-0.1.24 → bricksentry-0.1.26}/server.json +2 -2
  10. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/__init__.py +1 -1
  11. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/agent_tools.py +17 -2
  12. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/assess.py +20 -2
  13. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/backends/base.py +17 -2
  14. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/config.py +13 -1
  15. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/diff.py +69 -18
  16. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/explain.py +5 -3
  17. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/history.py +39 -3
  18. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/models.py +7 -0
  19. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/policy.py +46 -14
  20. bricksentry-0.1.26/src/bricksentry/validation.py +316 -0
  21. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/databricks_template_schema.json +2 -2
  22. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0123.py +32 -1
  23. bricksentry-0.1.26/tests/test_0126.py +173 -0
  24. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_assess_policy.py +3 -4
  25. bricksentry-0.1.24/deploy/databricks-app/requirements.txt +0 -1
  26. {bricksentry-0.1.24 → bricksentry-0.1.26}/.gitignore +0 -0
  27. {bricksentry-0.1.24 → bricksentry-0.1.26}/CONTRIBUTING.md +0 -0
  28. {bricksentry-0.1.24 → bricksentry-0.1.26}/LICENSE +0 -0
  29. {bricksentry-0.1.24 → bricksentry-0.1.26}/SECURITY.md +0 -0
  30. {bricksentry-0.1.24 → bricksentry-0.1.26}/action.yml +0 -0
  31. {bricksentry-0.1.24 → bricksentry-0.1.26}/deploy/container/Dockerfile +0 -0
  32. {bricksentry-0.1.24 → bricksentry-0.1.26}/deploy/databricks-app/README.md +0 -0
  33. {bricksentry-0.1.24 → bricksentry-0.1.26}/deploy/databricks-app/app.yaml +0 -0
  34. {bricksentry-0.1.24 → bricksentry-0.1.26}/deploy/databricks-app/bricksentry.yml +0 -0
  35. {bricksentry-0.1.24 → bricksentry-0.1.26}/deploy/databricks-app/databricks.yml +0 -0
  36. {bricksentry-0.1.24 → bricksentry-0.1.26}/deploy/databricks-app/grants.sql +0 -0
  37. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry.yml +0 -0
  38. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry_check_my_table.ipynb +0 -0
  39. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry_check_my_table.py +0 -0
  40. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry_hr_walkthrough.ipynb +0 -0
  41. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry_hr_walkthrough.py +0 -0
  42. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
  43. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/bricksentry_quickstart.py +0 -0
  44. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/github-workflow.yml +0 -0
  45. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/databricks/policy.yml +0 -0
  46. {bricksentry-0.1.24 → bricksentry-0.1.26}/examples/demo/agent_loop_demo.py +0 -0
  47. {bricksentry-0.1.24 → bricksentry-0.1.26}/scripts/render_demo_image.py +0 -0
  48. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/__main__.py +0 -0
  49. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/backends/__init__.py +0 -0
  50. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/backends/databricks_backend.py +0 -0
  51. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/backends/duckdb_backend.py +0 -0
  52. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/changes.py +0 -0
  53. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/cli.py +0 -0
  54. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/demo.py +0 -0
  55. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/github.py +0 -0
  56. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/job.py +0 -0
  57. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/job_demo.py +0 -0
  58. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/lineage.py +0 -0
  59. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/mcp_server.py +0 -0
  60. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/measures.py +0 -0
  61. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/netguard.py +0 -0
  62. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/notify.py +0 -0
  63. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/policy_templates.py +0 -0
  64. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/preview.py +0 -0
  65. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/py.typed +0 -0
  66. {bricksentry-0.1.24 → bricksentry-0.1.26}/src/bricksentry/report.py +0 -0
  67. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/README.md +0 -0
  68. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/template/{{.project_name}}/.gitignore +0 -0
  69. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/template/{{.project_name}}/README.md.tmpl +0 -0
  70. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/template/{{.project_name}}/databricks.yml.tmpl +0 -0
  71. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/template/{{.project_name}}/resources/bricksentry_check.job.yml.tmpl +0 -0
  72. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/template/{{.project_name}}/src/bricksentry_check.py +0 -0
  73. {bricksentry-0.1.24 → bricksentry-0.1.26}/templates/job-check/template/{{.project_name}}/src/bricksentry_demo.py +0 -0
  74. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/conftest.py +0 -0
  75. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0110.py +0 -0
  76. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0112.py +0 -0
  77. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0114.py +0 -0
  78. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0120.py +0 -0
  79. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0121.py +0 -0
  80. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_0122.py +0 -0
  81. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_018.py +0 -0
  82. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_019.py +0 -0
  83. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_check_notebook.py +0 -0
  84. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_databricks_and_uc.py +0 -0
  85. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_demo.py +0 -0
  86. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_diff.py +0 -0
  87. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_hr_notebook.py +0 -0
  88. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_notebook.py +0 -0
  89. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_notify_templates.py +0 -0
  90. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_preview_agents.py +0 -0
  91. {bricksentry-0.1.24 → bricksentry-0.1.26}/tests/test_sample_guard_and_store.py +0 -0
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.26 (2026-11-17)
4
+
5
+ Fixes for what two worst-case live tests of 0.1.25 on Databricks found. A pre-release check passed on two Databricks Free Edition workspaces (47 of 47 on the first), including the 12-scenario validation battery and before/after repros of every fix.
6
+
7
+ - **A changed copy of a duplicated key no longer shifts how the other copies pair.** 0.1.23 numbered the copies of a key by row hash and matched copy *n* with copy *n*, so one changed copy could move every copy after it: 2,000 rows sharing a NULL key with 2 real changes reported over a thousand changed rows (50,000 such rows: 36,563). Identical copies are now matched first; only the copies left over are paired. The same test now reports exactly 2 changed. New validation scenario `null_keys_changed`.
8
+ - **A total moving away from zero now fires `sum_change_pct_gt`.** A column whose total went from 0 to 5 had no percentage change, so the rule never matched. It now matches, with the reason "sum(col) 0 -> 5", and the plain-English explanation lists it under totals.
9
+ - **An overflowing exact total no longer loses the whole diff.** If a `DECIMAL(38)` total overflows, totals fall back to `DOUBLE` (or are skipped), the row counts and changes are still reported, and the diff notes it.
10
+ - **The rollback warning lists newer table changes that aren't data** (renamed columns, table properties, constraints): `RESTORE` undoes those too. Maintenance (OPTIMIZE, VACUUM, ANALYZE) is still ignored.
11
+ - **Clearer policy mistakes.** A verdict typo (`then: blok`) names the valid verdicts; verdicts are accepted in any case; `policy: strict` without `builtin:` says to write `builtin:strict`; a policy with no rules warns that every change will pass.
12
+ - **Behavior change: no-op pull requests to pii and certified-fed tables now pass.** The default rules `pii-table` and `certified-downstream` now have `any_change: true`, like `dashboard-downstream`: they fire on any added, removed or changed row, any schema change or new duplicate keys, but not when the candidate is identical to production (before, that got `needs_human` with nothing to review). A failed or missing diff still counts as a change, for every `any_change` rule. To require a review regardless, add a custom rule such as `{name: pii-review, when: {tag: pii}, then: needs_human}`. New validation scenario `pii_noop` (identical rebuild: pass; 1-row edit: needs_human). Found in a live test of 0.1.25.
13
+ - `preview_write` / `bricksentry preview` show one line when the clone or the statement fails ("The statement failed on the preview clone, so production was not touched: …") instead of the engine's full error. MCP tool errors keep only the first line.
14
+ - The MCP tools `whats_downstream` and `rollback_plan` report a mistyped or missing table as "Table … not found" instead of an empty downstream list (which read as "nothing is downstream") or advice to take a snapshot. Found in the pre-release check.
15
+ - A misspelled key under `backend:` in `bricksentry.yml` (say `path:` instead of `database:`) is rejected with the valid keys, instead of being ignored and connecting somewhere else. Found in the pre-release check.
16
+
17
+ ## 0.1.25 (2026-11-16)
18
+
19
+ - **Validation you can reproduce.** `VALIDATION.md` records every live test on Databricks with its numbers, the results that weren't perfect and the bugs each test found. `bricksentry.validation.run_validation()` and the new notebook `examples/databricks/bricksentry_validation.py` run the same ten risky changes on your own workspace in a scratch schema and drop everything afterwards. A new issue form, "Validation report", collects results from other setups.
20
+ - Fix: a sampled diff (`sample_pct`) skipped the full-table check when the schema had also changed, so changed values in a retyped column outside the sample could go uncounted. The verdict still flagged the type change. The check now runs whenever the sample shows no row changes. Found by the new validation battery.
21
+ - The battery passed 10 of 10 on Databricks (111 s on a 2X-Small serverless warehouse), including the two scenarios that need Delta history. The certified-table scenario now keeps the column type, so its strict verdict comes from `certified-table-changed` alone (on Databricks, doubling a decimal widened its type).
22
+
3
23
  ## 0.1.24 (2026-11-16)
4
24
 
5
25
  Small fixes from two adversarial live tests of 0.1.23 on Databricks, including the job task running inside a real Databricks job.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bricksentry
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: Change impact analysis and deployment guardrails for data changes on Databricks, for 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
@@ -55,7 +55,7 @@ Description-Content-Type: text/markdown
55
55
 
56
56
  Change-safety for Databricks pipelines and the AI agents that edit them: know what a change does to your data before it ships.
57
57
 
58
- **[Try it in 30 seconds](#1-try-it-in-30-seconds-on-your-laptop)** · **[Check every change on Databricks](#2-check-every-change-to-your-tables-on-databricks)** · **[Docs: bricksentry.org](https://bricksentry.org)** · **[LinkedIn](https://www.linkedin.com/company/bricksentry-org/)**
58
+ **[Try it in 30 seconds](#1-try-it-in-30-seconds-on-your-laptop)** · **[Check every change on Databricks](#2-check-every-change-to-your-tables-on-databricks)** · **[Docs: bricksentry.org](https://bricksentry.org)** · **[Validated live: what we tested and found](VALIDATION.md)** · **[LinkedIn](https://www.linkedin.com/company/bricksentry-org/)**
59
59
 
60
60
  Built by Brahmareddy, Databricks Champion. Open source under Apache-2.0.
61
61
 
@@ -428,6 +428,8 @@ Use one directly with `policy: builtin:finance`, or write an editable copy with
428
428
 
429
429
  `table` (glob) · `tag` · `downstream_tag` · `downstream_kind` · `downstream_count_gt` · `removed_pct_gt` · `added_pct_gt` · `changed_pct_gt` · `row_count_change_pct_gt` · `row_count_drop_pct_gt` · `column_removed` · `column_added` · `column_type_changed` · `duplicate_keys` · `null_keys` · `sum_change_pct_gt` / `null_increase_gt` (optionally with `column`) · `changed_column` (glob) · `changed_column_tag` · `downstream_column_tag` · `any_change` · `diff_error` · `lineage_error`
430
430
 
431
+ **The pii and certified gates skip changes that change nothing.** In the default policy, `pii-table` (the table is tagged `pii`) and `certified-downstream` (it feeds something tagged `certified`) fire only when the diff shows a change: rows added, removed or changed, a schema change or new duplicate keys. A rebuild identical to production passes. A failed or missing diff still counts as a possible change. To require a review of every pull request touching a PII table regardless, add a rule without `any_change`: `{name: pii-review, when: {tag: pii}, then: needs_human}`.
432
+
431
433
  **Column conditions** look only at the columns the change touched (changed values, new NULLs, dropped or retyped): `changed_column_tag: pii` matches when one of them is tagged `pii` in Unity Catalog, and `downstream_column_tag: certified` when one of them feeds a column tagged `certified`, following `system.access.column_lineage` up to `lineage.column_depth` hops (default 2; `0` turns it off). The default policy asks a human when a `pii` column changes; `strict`, `agent-safe` and `certified` also flag changes that feed certified columns.
432
434
 
433
435
  All conditions in a `when` must hold. The most severe matching rule sets the verdict. Unknown conditions are rejected at load time, so a typo can't silently disable a rule.
@@ -461,7 +463,7 @@ Every assessment records when it ran (UTC), the bricksentry version, a SHA-256 f
461
463
  - **Lineage is recorded at runtime.** Brand-new tables have no downstream history yet. Unity Catalog doesn't capture RDD operations, and UDFs hide column-level mapping; column lineage records source-to-target derivations, so a column used only in a filter or join may not appear.
462
464
  - **Keys are required.** Tables without a stable key can't be diffed row by row yet (an aggregate-profile mode is planned).
463
465
  - **Changed-table detection uses path globs** from config. It doesn't parse Asset Bundles yet.
464
- - **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.23 on a Free Edition workspace with an HR pipeline: pull-request gating with comment updates, the bundle demo job, `check-last-change` and the newer-changes warning in the CLI, report, JSON and Slack, the refused-statement guards, outbound-URL checks, one-to-one matching of 2,000 NULL keys, exact totals over a million decimal rows, the audit trail, an AI agent attempting six risky changes on the live pipeline, and the job task blocking a bad MERGE inside a real Databricks job. The automated tests use DuckDB and a mocked SDK, so please [open an issue](https://github.com/bricksentry/bricksentry/issues) if something behaves differently on yours.
466
+ - **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.26 on a Free Edition workspace with an HR pipeline: pull-request gating with comment updates, the bundle demo job, `check-last-change` and the newer-changes warning in the CLI, report, JSON and Slack, the refused-statement guards, outbound-URL checks, one-to-one matching of 2,000 NULL keys, exact totals over a million decimal rows, the audit trail, an AI agent attempting six risky changes on the live pipeline, the job task blocking a bad MERGE inside a real Databricks job, and worst-case rounds (50,000 NULL keys, near-max decimals, exotic types, 200-column tables) whose five findings were fixed in 0.1.26. Every run, with its numbers and the bugs it found, is in [VALIDATION.md](VALIDATION.md). The automated tests use DuckDB and a mocked SDK, so please run the [validation notebook](examples/databricks/bricksentry_validation.py) on your workspace and [share a validation report](https://github.com/bricksentry/bricksentry/issues/new?template=validation_report.yml), whether it passes or not.
465
467
 
466
468
  ## Roadmap
467
469
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  Change-safety for Databricks pipelines and the AI agents that edit them: know what a change does to your data before it ships.
10
10
 
11
- **[Try it in 30 seconds](#1-try-it-in-30-seconds-on-your-laptop)** · **[Check every change on Databricks](#2-check-every-change-to-your-tables-on-databricks)** · **[Docs: bricksentry.org](https://bricksentry.org)** · **[LinkedIn](https://www.linkedin.com/company/bricksentry-org/)**
11
+ **[Try it in 30 seconds](#1-try-it-in-30-seconds-on-your-laptop)** · **[Check every change on Databricks](#2-check-every-change-to-your-tables-on-databricks)** · **[Docs: bricksentry.org](https://bricksentry.org)** · **[Validated live: what we tested and found](VALIDATION.md)** · **[LinkedIn](https://www.linkedin.com/company/bricksentry-org/)**
12
12
 
13
13
  Built by Brahmareddy, Databricks Champion. Open source under Apache-2.0.
14
14
 
@@ -381,6 +381,8 @@ Use one directly with `policy: builtin:finance`, or write an editable copy with
381
381
 
382
382
  `table` (glob) · `tag` · `downstream_tag` · `downstream_kind` · `downstream_count_gt` · `removed_pct_gt` · `added_pct_gt` · `changed_pct_gt` · `row_count_change_pct_gt` · `row_count_drop_pct_gt` · `column_removed` · `column_added` · `column_type_changed` · `duplicate_keys` · `null_keys` · `sum_change_pct_gt` / `null_increase_gt` (optionally with `column`) · `changed_column` (glob) · `changed_column_tag` · `downstream_column_tag` · `any_change` · `diff_error` · `lineage_error`
383
383
 
384
+ **The pii and certified gates skip changes that change nothing.** In the default policy, `pii-table` (the table is tagged `pii`) and `certified-downstream` (it feeds something tagged `certified`) fire only when the diff shows a change: rows added, removed or changed, a schema change or new duplicate keys. A rebuild identical to production passes. A failed or missing diff still counts as a possible change. To require a review of every pull request touching a PII table regardless, add a rule without `any_change`: `{name: pii-review, when: {tag: pii}, then: needs_human}`.
385
+
384
386
  **Column conditions** look only at the columns the change touched (changed values, new NULLs, dropped or retyped): `changed_column_tag: pii` matches when one of them is tagged `pii` in Unity Catalog, and `downstream_column_tag: certified` when one of them feeds a column tagged `certified`, following `system.access.column_lineage` up to `lineage.column_depth` hops (default 2; `0` turns it off). The default policy asks a human when a `pii` column changes; `strict`, `agent-safe` and `certified` also flag changes that feed certified columns.
385
387
 
386
388
  All conditions in a `when` must hold. The most severe matching rule sets the verdict. Unknown conditions are rejected at load time, so a typo can't silently disable a rule.
@@ -414,7 +416,7 @@ Every assessment records when it ran (UTC), the bricksentry version, a SHA-256 f
414
416
  - **Lineage is recorded at runtime.** Brand-new tables have no downstream history yet. Unity Catalog doesn't capture RDD operations, and UDFs hide column-level mapping; column lineage records source-to-target derivations, so a column used only in a filter or join may not appear.
415
417
  - **Keys are required.** Tables without a stable key can't be diffed row by row yet (an aggregate-profile mode is planned).
416
418
  - **Changed-table detection uses path globs** from config. It doesn't parse Asset Bundles yet.
417
- - **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.23 on a Free Edition workspace with an HR pipeline: pull-request gating with comment updates, the bundle demo job, `check-last-change` and the newer-changes warning in the CLI, report, JSON and Slack, the refused-statement guards, outbound-URL checks, one-to-one matching of 2,000 NULL keys, exact totals over a million decimal rows, the audit trail, an AI agent attempting six risky changes on the live pipeline, and the job task blocking a bad MERGE inside a real Databricks job. The automated tests use DuckDB and a mocked SDK, so please [open an issue](https://github.com/bricksentry/bricksentry/issues) if something behaves differently on yours.
419
+ - **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.26 on a Free Edition workspace with an HR pipeline: pull-request gating with comment updates, the bundle demo job, `check-last-change` and the newer-changes warning in the CLI, report, JSON and Slack, the refused-statement guards, outbound-URL checks, one-to-one matching of 2,000 NULL keys, exact totals over a million decimal rows, the audit trail, an AI agent attempting six risky changes on the live pipeline, the job task blocking a bad MERGE inside a real Databricks job, and worst-case rounds (50,000 NULL keys, near-max decimals, exotic types, 200-column tables) whose five findings were fixed in 0.1.26. Every run, with its numbers and the bugs it found, is in [VALIDATION.md](VALIDATION.md). The automated tests use DuckDB and a mocked SDK, so please run the [validation notebook](examples/databricks/bricksentry_validation.py) on your workspace and [share a validation report](https://github.com/bricksentry/bricksentry/issues/new?template=validation_report.yml), whether it passes or not.
418
420
 
419
421
  ## Roadmap
420
422
 
@@ -0,0 +1 @@
1
+ bricksentry[databricks,mcp]==0.1.26
@@ -0,0 +1,152 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Validate bricksentry on your own workspace\n",
8
+ "\n",
9
+ "**12 risky changes, about 2 minutes, nothing outside a scratch schema touched.** This notebook runs the same\n",
10
+ "validation battery we publish in [VALIDATION.md](https://github.com/bricksentry/bricksentry/blob/main/VALIDATION.md),\n",
11
+ "so you can check the results yourself instead of taking our word for them.\n",
12
+ "\n",
13
+ "It generates an HR-style employees table (200,000 rows) and a department mart in the scratch schema, then tries the\n",
14
+ "changes that go wrong in real pipelines: silent row loss, a MERGE that duplicates a department, one change with\n",
15
+ "everything wrong, five bad rows hidden outside a 5% sample, a doubled total on a certified table, 2,000 NULL keys,\n",
16
+ "exact totals over a million decimal rows, a bad change that already landed in Delta, and a mistyped table name.\n",
17
+ "Every table it creates is dropped at the end.\n",
18
+ "\n",
19
+ "**You need:** a SQL warehouse you can use and `CREATE TABLE` on the scratch schema (it is created if missing).\n",
20
+ "\n",
21
+ "Please share what you see, whether everything passes or not:\n",
22
+ "[open a validation report](https://github.com/bricksentry/bricksentry/issues/new?template=validation_report.yml).\n",
23
+ "Results from other clouds, classic compute and bigger tables are the most useful."
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "code",
28
+ "execution_count": null,
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": [
32
+ "%pip install --quiet --upgrade \"bricksentry[databricks]\""
33
+ ]
34
+ },
35
+ {
36
+ "cell_type": "code",
37
+ "execution_count": null,
38
+ "metadata": {},
39
+ "outputs": [],
40
+ "source": [
41
+ "dbutils.library.restartPython()"
42
+ ]
43
+ },
44
+ {
45
+ "cell_type": "markdown",
46
+ "metadata": {},
47
+ "source": [
48
+ "## Settings\n",
49
+ "- **warehouse_id:** SQL Warehouses → your warehouse → Connection details.\n",
50
+ "- **scratch_schema:** `catalog.schema` where the test tables are created and dropped. Use a schema with nothing else in it.\n",
51
+ "- **rows:** size of the generated employees table (default 200,000)."
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": null,
57
+ "metadata": {},
58
+ "outputs": [],
59
+ "source": [
60
+ "import re\n",
61
+ "\n",
62
+ "dbutils.widgets.text(\"warehouse_id\", \"\")\n",
63
+ "dbutils.widgets.text(\"scratch_schema\", \"main.bricksentry_validation\")\n",
64
+ "dbutils.widgets.text(\"rows\", \"200000\")\n",
65
+ "\n",
66
+ "WAREHOUSE_ID = dbutils.widgets.get(\"warehouse_id\").strip()\n",
67
+ "SCRATCH = dbutils.widgets.get(\"scratch_schema\").strip()\n",
68
+ "ROWS = int(dbutils.widgets.get(\"rows\").strip() or \"200000\")\n",
69
+ "\n",
70
+ "NAME = r\"[A-Za-z0-9_]+\"\n",
71
+ "if not re.fullmatch(r\"[A-Za-z0-9]+\", WAREHOUSE_ID):\n",
72
+ " raise ValueError(\"Set the 'warehouse_id' widget to your SQL warehouse ID (SQL Warehouses → Connection details).\")\n",
73
+ "if not re.fullmatch(rf\"{NAME}\\.{NAME}\", SCRATCH):\n",
74
+ " raise ValueError(f\"Set 'scratch_schema' to catalog.schema; got {SCRATCH!r}\")\n",
75
+ "\n",
76
+ "import bricksentry\n",
77
+ "from bricksentry.backends.base import make_backend\n",
78
+ "\n",
79
+ "backend = make_backend({\"type\": \"databricks\", \"warehouse_id\": WAREHOUSE_ID})\n",
80
+ "print(f\"bricksentry {bricksentry.__version__}, scratch schema {SCRATCH}, {ROWS:,} rows\")"
81
+ ]
82
+ },
83
+ {
84
+ "cell_type": "markdown",
85
+ "metadata": {},
86
+ "source": [
87
+ "## Run the battery"
88
+ ]
89
+ },
90
+ {
91
+ "cell_type": "code",
92
+ "execution_count": null,
93
+ "metadata": {},
94
+ "outputs": [],
95
+ "source": [
96
+ "from bricksentry.validation import print_results, run_validation\n",
97
+ "\n",
98
+ "results = run_validation(backend, SCRATCH, rows=ROWS)\n",
99
+ "print_results(results)"
100
+ ]
101
+ },
102
+ {
103
+ "cell_type": "markdown",
104
+ "metadata": {},
105
+ "source": [
106
+ "## Results as a table\n",
107
+ "Copy this into a [validation report](https://github.com/bricksentry/bricksentry/issues/new?template=validation_report.yml),\n",
108
+ "with your cloud and compute type. Leave out anything private (workspace URLs, warehouse IDs, emails)."
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "metadata": {},
115
+ "outputs": [],
116
+ "source": [
117
+ "import pandas as pd\n",
118
+ "\n",
119
+ "display(pd.DataFrame([r.to_dict() for r in results])[[\"scenario\", \"result\", \"expected\", \"actual\", \"seconds\"]])"
120
+ ]
121
+ },
122
+ {
123
+ "cell_type": "markdown",
124
+ "metadata": {},
125
+ "source": [
126
+ "## What the results mean\n",
127
+ "- **PASS** on every row means bricksentry caught each change the way VALIDATION.md describes.\n",
128
+ "- `certified_totals_default` passes when the verdict is only a **warning**: that's the documented default for a\n",
129
+ " certified table itself. `certified_totals_strict` shows the same change under `policy: builtin:certified`.\n",
130
+ "- Any **FAIL** is a bug we want to hear about. Please include the `actual` column in your report.\n",
131
+ "\n",
132
+ "The scratch tables were dropped when the battery finished. The scratch schema itself is left in place."
133
+ ]
134
+ }
135
+ ],
136
+ "metadata": {
137
+ "kernelspec": {
138
+ "display_name": "Python 3",
139
+ "language": "python",
140
+ "name": "python3"
141
+ },
142
+ "language_info": {
143
+ "name": "python"
144
+ },
145
+ "application/vnd.databricks.v1+notebook": {
146
+ "notebookName": "bricksentry_validation",
147
+ "language": "python"
148
+ }
149
+ },
150
+ "nbformat": 4,
151
+ "nbformat_minor": 5
152
+ }
@@ -0,0 +1,95 @@
1
+ # Databricks notebook source
2
+ # MAGIC %md
3
+ # MAGIC # Validate bricksentry on your own workspace
4
+ # MAGIC
5
+ # MAGIC **12 risky changes, about 2 minutes, nothing outside a scratch schema touched.** This notebook runs the same
6
+ # MAGIC validation battery we publish in [VALIDATION.md](https://github.com/bricksentry/bricksentry/blob/main/VALIDATION.md),
7
+ # MAGIC so you can check the results yourself instead of taking our word for them.
8
+ # MAGIC
9
+ # MAGIC It generates an HR-style employees table (200,000 rows) and a department mart in the scratch schema, then tries the
10
+ # MAGIC changes that go wrong in real pipelines: silent row loss, a MERGE that duplicates a department, one change with
11
+ # MAGIC everything wrong, five bad rows hidden outside a 5% sample, a doubled total on a certified table, 2,000 NULL keys,
12
+ # MAGIC exact totals over a million decimal rows, a bad change that already landed in Delta, and a mistyped table name.
13
+ # MAGIC Every table it creates is dropped at the end.
14
+ # MAGIC
15
+ # MAGIC **You need:** a SQL warehouse you can use and `CREATE TABLE` on the scratch schema (it is created if missing).
16
+ # MAGIC
17
+ # MAGIC Please share what you see, whether everything passes or not:
18
+ # MAGIC [open a validation report](https://github.com/bricksentry/bricksentry/issues/new?template=validation_report.yml).
19
+ # MAGIC Results from other clouds, classic compute and bigger tables are the most useful.
20
+
21
+ # COMMAND ----------
22
+
23
+ # MAGIC %pip install --quiet --upgrade "bricksentry[databricks]"
24
+
25
+ # COMMAND ----------
26
+
27
+ dbutils.library.restartPython()
28
+
29
+ # COMMAND ----------
30
+
31
+ # MAGIC %md
32
+ # MAGIC ## Settings
33
+ # MAGIC - **warehouse_id:** SQL Warehouses → your warehouse → Connection details.
34
+ # MAGIC - **scratch_schema:** `catalog.schema` where the test tables are created and dropped. Use a schema with nothing else in it.
35
+ # MAGIC - **rows:** size of the generated employees table (default 200,000).
36
+
37
+ # COMMAND ----------
38
+
39
+ import re
40
+
41
+ dbutils.widgets.text("warehouse_id", "")
42
+ dbutils.widgets.text("scratch_schema", "main.bricksentry_validation")
43
+ dbutils.widgets.text("rows", "200000")
44
+
45
+ WAREHOUSE_ID = dbutils.widgets.get("warehouse_id").strip()
46
+ SCRATCH = dbutils.widgets.get("scratch_schema").strip()
47
+ ROWS = int(dbutils.widgets.get("rows").strip() or "200000")
48
+
49
+ NAME = r"[A-Za-z0-9_]+"
50
+ if not re.fullmatch(r"[A-Za-z0-9]+", WAREHOUSE_ID):
51
+ raise ValueError("Set the 'warehouse_id' widget to your SQL warehouse ID (SQL Warehouses → Connection details).")
52
+ if not re.fullmatch(rf"{NAME}\.{NAME}", SCRATCH):
53
+ raise ValueError(f"Set 'scratch_schema' to catalog.schema; got {SCRATCH!r}")
54
+
55
+ import bricksentry
56
+ from bricksentry.backends.base import make_backend
57
+
58
+ backend = make_backend({"type": "databricks", "warehouse_id": WAREHOUSE_ID})
59
+ print(f"bricksentry {bricksentry.__version__}, scratch schema {SCRATCH}, {ROWS:,} rows")
60
+
61
+ # COMMAND ----------
62
+
63
+ # MAGIC %md
64
+ # MAGIC ## Run the battery
65
+
66
+ # COMMAND ----------
67
+
68
+ from bricksentry.validation import print_results, run_validation
69
+
70
+ results = run_validation(backend, SCRATCH, rows=ROWS)
71
+ print_results(results)
72
+
73
+ # COMMAND ----------
74
+
75
+ # MAGIC %md
76
+ # MAGIC ## Results as a table
77
+ # MAGIC Copy this into a [validation report](https://github.com/bricksentry/bricksentry/issues/new?template=validation_report.yml),
78
+ # MAGIC with your cloud and compute type. Leave out anything private (workspace URLs, warehouse IDs, emails).
79
+
80
+ # COMMAND ----------
81
+
82
+ import pandas as pd
83
+
84
+ display(pd.DataFrame([r.to_dict() for r in results])[["scenario", "result", "expected", "actual", "seconds"]])
85
+
86
+ # COMMAND ----------
87
+
88
+ # MAGIC %md
89
+ # MAGIC ## What the results mean
90
+ # MAGIC - **PASS** on every row means bricksentry caught each change the way VALIDATION.md describes.
91
+ # MAGIC - `certified_totals_default` passes when the verdict is only a **warning**: that's the documented default for a
92
+ # MAGIC certified table itself. `certified_totals_strict` shows the same change under `policy: builtin:certified`.
93
+ # MAGIC - Any **FAIL** is a bug we want to hear about. Please include the `actual` column in your report.
94
+ # MAGIC
95
+ # MAGIC The scratch tables were dropped when the battery finished. The scratch schema itself is left in place.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bricksentry"
7
- version = "0.1.24"
7
+ version = "0.1.26"
8
8
  description = "Change impact analysis and deployment guardrails for data changes on Databricks, for pipelines and the AI agents that edit them: data diffs, Unity Catalog blast radius, policy verdicts and rollback plans."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -15,6 +15,7 @@ SOURCES = [
15
15
  ROOT / "examples" / "databricks" / "bricksentry_quickstart.py",
16
16
  ROOT / "examples" / "databricks" / "bricksentry_check_my_table.py",
17
17
  ROOT / "examples" / "databricks" / "bricksentry_hr_walkthrough.py",
18
+ ROOT / "examples" / "databricks" / "bricksentry_validation.py",
18
19
  ]
19
20
  SRC = SOURCES[0]
20
21
  OUT = SRC.with_suffix(".ipynb")
@@ -8,12 +8,12 @@
8
8
  "source": "github"
9
9
  },
10
10
  "websiteUrl": "https://bricksentry.org",
11
- "version": "0.1.24",
11
+ "version": "0.1.26",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "pypi",
15
15
  "identifier": "bricksentry-mcp",
16
- "version": "0.1.24",
16
+ "version": "0.1.26",
17
17
  "runtimeHint": "uvx",
18
18
  "transport": {
19
19
  "type": "stdio"
@@ -23,4 +23,4 @@ __all__ = [
23
23
  "TableDiff",
24
24
  "Verdict",
25
25
  ]
26
- __version__ = "0.1.24"
26
+ __version__ = "0.1.26"
@@ -47,7 +47,11 @@ def _safe(fn):
47
47
  try:
48
48
  return fn(*args, **kwargs)
49
49
  except Exception as e:
50
- return {"error": f"{type(e).__name__}: {e}"}
50
+ text = str(e).strip()
51
+ line = text.splitlines()[0] if text else ""
52
+ if len(line) > 300:
53
+ line = line[:297] + "..."
54
+ return {"error": f"{type(e).__name__}: {line}"}
51
55
 
52
56
  return wrapper
53
57
 
@@ -79,6 +83,9 @@ def whats_downstream(
79
83
  s = get_sentry()
80
84
  nodes = s.downstream(table, depth)
81
85
  owner, tags = s.lineage.owner_and_tags(table)
86
+ if not nodes and not owner and not tags and not s.backend.table_exists(table):
87
+ # An empty answer for a mistyped name would read as "nothing is downstream".
88
+ raise LookupError(_not_found(table))
82
89
  out: dict[str, Any] = {
83
90
  "table": table,
84
91
  "owner": owner,
@@ -233,12 +240,20 @@ def rollback_plan(
233
240
  Returns {table, current_version, rollback_sql}, e.g. "RESTORE TABLE
234
241
  main.sales.orders TO VERSION AS OF 42", or {error}."""
235
242
  s = get_sentry()
243
+ version = s.backend.current_version(table)
244
+ if version is None and not s.backend.table_exists(table):
245
+ raise LookupError(_not_found(table))
236
246
  return {
237
247
  "table": table,
238
- "current_version": s.backend.current_version(table),
248
+ "current_version": version,
239
249
  "rollback_sql": s.rollback_plan(table),
240
250
  }
241
251
 
242
252
 
253
+ def _not_found(table: str) -> str:
254
+ return (f"Table {table} not found. Check the catalog, schema and table name (they must match "
255
+ "Unity Catalog exactly) and that you have SELECT on it.")
256
+
257
+
243
258
  TOOLS = [whats_downstream, assess_change, preview_write, explain_diff, safe_to_ship, rollback_plan]
244
259
  READ_ONLY = {"whats_downstream", "assess_change", "explain_diff", "safe_to_ship", "rollback_plan"}
@@ -212,9 +212,20 @@ class Sentry:
212
212
  schema = ".".join(clone.split(".")[:-1])
213
213
  if schema:
214
214
  self.backend.ensure_schema(schema)
215
- self.backend.clone(target, clone)
216
215
  try:
217
- self.backend.execute(rewritten)
216
+ self.backend.clone(target, clone)
217
+ except Exception as e:
218
+ raise RuntimeError(
219
+ f"Could not clone {target} to preview the write: {_first_line(e)}. Check the table name "
220
+ f"and that you can create tables in {schema or 'the sandbox schema'}."
221
+ ) from None
222
+ try:
223
+ try:
224
+ self.backend.execute(rewritten)
225
+ except Exception as e:
226
+ raise RuntimeError(
227
+ f"The statement failed on the preview clone, so production was not touched: {_first_line(e)}"
228
+ ) from None
218
229
  diff = self.diff(target, clone, keys=keys, table=target)
219
230
  assessment = self.assess([target], diffs={target: diff})
220
231
  finally:
@@ -295,3 +306,10 @@ def changed_columns(diff: TableDiff | None) -> list[str]:
295
306
  out.append(c.column)
296
307
  out += list(diff.schema.removed) + list(diff.schema.type_changed)
297
308
  return list(dict.fromkeys(out))
309
+
310
+
311
+ def _first_line(e: BaseException) -> str:
312
+ """The useful part of an engine error: its first line, trimmed."""
313
+ text = str(e).strip()
314
+ line = text.splitlines()[0] if text else type(e).__name__
315
+ return line if len(line) <= 300 else line[:297] + "..."
@@ -123,9 +123,24 @@ def make_backend(spec: dict[str, Any] | None) -> Backend:
123
123
  if kind == "duckdb":
124
124
  from bricksentry.backends.duckdb_backend import DuckDBBackend
125
125
 
126
- return DuckDBBackend(**spec)
126
+ return DuckDBBackend(**_known_keys(DuckDBBackend, kind, spec))
127
127
  if kind == "databricks":
128
128
  from bricksentry.backends.databricks_backend import DatabricksBackend
129
129
 
130
- return DatabricksBackend(**spec)
130
+ return DatabricksBackend(**_known_keys(DatabricksBackend, kind, spec))
131
131
  raise ValueError(f"Unknown backend type: {kind!r} (expected 'databricks' or 'duckdb')")
132
+
133
+
134
+
135
+ def _known_keys(cls: type, kind: str, spec: dict[str, Any]) -> dict[str, Any]:
136
+ """Reject misspelled `backend:` keys instead of silently ignoring them (a `path:`
137
+ meant as `database:` would quietly connect to an empty in-memory database)."""
138
+ import inspect
139
+
140
+ params = inspect.signature(cls.__init__).parameters
141
+ known = [n for n, p in params.items() if n != "self" and p.kind not in (p.VAR_KEYWORD, p.VAR_POSITIONAL)]
142
+ unknown = sorted(set(spec) - set(known))
143
+ if unknown:
144
+ raise ValueError(f"Unknown key(s) under backend: {', '.join(unknown)} for type {kind}. "
145
+ f"Valid keys: type, {', '.join(k for k in known if k != 'client' and k != 'connection')}.")
146
+ return spec
@@ -102,6 +102,18 @@ def _measures(v: Any) -> list[str] | str | None:
102
102
  return [str(x) for x in v]
103
103
 
104
104
 
105
+ def _load_policy_file(root: Path, name: str) -> dict[str, Any]:
106
+ path = root / name
107
+ if not path.exists():
108
+ from bricksentry.policy_templates import TEMPLATES
109
+
110
+ hint = ""
111
+ if name.strip().lower() in TEMPLATES:
112
+ hint = f" To use the built-in template, write `policy: builtin:{name.strip().lower()}`."
113
+ raise FileNotFoundError(f"Policy file {name!r} not found (looked for {path}).{hint}")
114
+ return yaml.safe_load(path.read_text()) or {}
115
+
116
+
105
117
  @dataclass
106
118
  class TableSpec:
107
119
  name: str
@@ -155,7 +167,7 @@ class Config:
155
167
 
156
168
  policy = get_template(policy.split(":", 1)[1])
157
169
  else:
158
- policy = yaml.safe_load((root / policy).read_text()) or {}
170
+ policy = _load_policy_file(root, policy)
159
171
  return cls(
160
172
  backend=data.get("backend") or {"type": "duckdb"},
161
173
  sandbox_schema=data.get("sandbox_schema", "bricksentry_sandbox"),