bricksentry 0.1.16__tar.gz → 0.1.19__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 (82) hide show
  1. {bricksentry-0.1.16 → bricksentry-0.1.19}/CHANGELOG.md +28 -0
  2. {bricksentry-0.1.16 → bricksentry-0.1.19}/PKG-INFO +24 -9
  3. {bricksentry-0.1.16 → bricksentry-0.1.19}/README.md +23 -8
  4. bricksentry-0.1.19/deploy/databricks-app/requirements.txt +1 -0
  5. {bricksentry-0.1.16 → bricksentry-0.1.19}/pyproject.toml +1 -1
  6. bricksentry-0.1.19/scripts/render_demo_image.py +117 -0
  7. {bricksentry-0.1.16 → bricksentry-0.1.19}/server.json +2 -2
  8. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/__init__.py +1 -1
  9. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/demo.py +92 -16
  10. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/history.py +19 -1
  11. bricksentry-0.1.19/src/bricksentry/job_demo.py +76 -0
  12. bricksentry-0.1.19/templates/job-check/README.md +31 -0
  13. {bricksentry-0.1.16 → bricksentry-0.1.19}/templates/job-check/databricks_template_schema.json +28 -17
  14. {bricksentry-0.1.16 → bricksentry-0.1.19}/templates/job-check/template/{{.project_name}}/README.md.tmpl +25 -4
  15. {bricksentry-0.1.16 → bricksentry-0.1.19}/templates/job-check/template/{{.project_name}}/resources/bricksentry_check.job.yml.tmpl +55 -0
  16. bricksentry-0.1.19/templates/job-check/template/{{.project_name}}/src/bricksentry_demo.py +7 -0
  17. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_0114.py +153 -26
  18. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_demo.py +6 -0
  19. bricksentry-0.1.16/deploy/databricks-app/requirements.txt +0 -1
  20. bricksentry-0.1.16/templates/job-check/README.md +0 -13
  21. {bricksentry-0.1.16 → bricksentry-0.1.19}/.gitignore +0 -0
  22. {bricksentry-0.1.16 → bricksentry-0.1.19}/CONTRIBUTING.md +0 -0
  23. {bricksentry-0.1.16 → bricksentry-0.1.19}/LICENSE +0 -0
  24. {bricksentry-0.1.16 → bricksentry-0.1.19}/SECURITY.md +0 -0
  25. {bricksentry-0.1.16 → bricksentry-0.1.19}/action.yml +0 -0
  26. {bricksentry-0.1.16 → bricksentry-0.1.19}/deploy/databricks-app/README.md +0 -0
  27. {bricksentry-0.1.16 → bricksentry-0.1.19}/deploy/databricks-app/app.yaml +0 -0
  28. {bricksentry-0.1.16 → bricksentry-0.1.19}/deploy/databricks-app/bricksentry.yml +0 -0
  29. {bricksentry-0.1.16 → bricksentry-0.1.19}/deploy/databricks-app/databricks.yml +0 -0
  30. {bricksentry-0.1.16 → bricksentry-0.1.19}/deploy/databricks-app/grants.sql +0 -0
  31. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry.yml +0 -0
  32. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry_check_my_table.ipynb +0 -0
  33. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry_check_my_table.py +0 -0
  34. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry_hr_walkthrough.ipynb +0 -0
  35. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry_hr_walkthrough.py +0 -0
  36. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
  37. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/bricksentry_quickstart.py +0 -0
  38. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/github-workflow.yml +0 -0
  39. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/databricks/policy.yml +0 -0
  40. {bricksentry-0.1.16 → bricksentry-0.1.19}/examples/demo/agent_loop_demo.py +0 -0
  41. {bricksentry-0.1.16 → bricksentry-0.1.19}/scripts/build_notebook.py +0 -0
  42. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/__main__.py +0 -0
  43. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/agent_tools.py +0 -0
  44. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/assess.py +0 -0
  45. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/backends/__init__.py +0 -0
  46. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/backends/base.py +0 -0
  47. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/backends/databricks_backend.py +0 -0
  48. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/backends/duckdb_backend.py +0 -0
  49. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/changes.py +0 -0
  50. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/cli.py +0 -0
  51. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/config.py +0 -0
  52. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/diff.py +0 -0
  53. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/explain.py +0 -0
  54. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/github.py +0 -0
  55. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/job.py +0 -0
  56. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/lineage.py +0 -0
  57. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/mcp_server.py +0 -0
  58. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/measures.py +0 -0
  59. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/models.py +0 -0
  60. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/notify.py +0 -0
  61. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/policy.py +0 -0
  62. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/policy_templates.py +0 -0
  63. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/preview.py +0 -0
  64. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/py.typed +0 -0
  65. {bricksentry-0.1.16 → bricksentry-0.1.19}/src/bricksentry/report.py +0 -0
  66. {bricksentry-0.1.16 → bricksentry-0.1.19}/templates/job-check/template/{{.project_name}}/.gitignore +0 -0
  67. {bricksentry-0.1.16 → bricksentry-0.1.19}/templates/job-check/template/{{.project_name}}/databricks.yml.tmpl +0 -0
  68. {bricksentry-0.1.16 → bricksentry-0.1.19}/templates/job-check/template/{{.project_name}}/src/bricksentry_check.py +0 -0
  69. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/conftest.py +0 -0
  70. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_0110.py +0 -0
  71. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_0112.py +0 -0
  72. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_018.py +0 -0
  73. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_019.py +0 -0
  74. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_assess_policy.py +0 -0
  75. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_check_notebook.py +0 -0
  76. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_databricks_and_uc.py +0 -0
  77. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_diff.py +0 -0
  78. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_hr_notebook.py +0 -0
  79. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_notebook.py +0 -0
  80. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_notify_templates.py +0 -0
  81. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_preview_agents.py +0 -0
  82. {bricksentry-0.1.16 → bricksentry-0.1.19}/tests/test_sample_guard_and_store.py +0 -0
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.19 (2026-11-12)
4
+
5
+ - `bricksentry demo` showed black boxes instead of colored verdict labels in macOS Terminal, which doesn't support 24-bit color. Terminals that don't set `COLORTERM=truecolor` now get the standard named colors; the others keep the website's colors.
6
+ - When the scratch schema's catalog doesn't exist, `check-last-change`, the job task and the demo task say so and how to fix it, instead of a raw `NO_SUCH_CATALOG` error.
7
+ - README: how to run the demo inside a Databricks or Jupyter notebook (`%pip install`, then `run_demo()`).
8
+ - The job template pins 0.1.19 by default.
9
+
10
+ Bundle template changes, already live because `bundle init` reads the template from GitHub:
11
+
12
+ - `tables` is optional: leave it empty to deploy only the demo job and see a block before choosing your own tables. The only input without a default is now `warehouse_id`. The demo question comes first.
13
+ - The template README documents non-interactive init (`--config-file`) for CI, scripts and AI agents.
14
+ - `scratch_schema` defaults to `<your default catalog>.bricksentry_scratch` instead of `main.bricksentry_scratch`. Workspaces without a `main` catalog had their first demo run fail with "catalog not found" instead of the intended BLOCK.
15
+
16
+ ## 0.1.18 (2026-11-12)
17
+
18
+ See a block in your own workspace within minutes of `bundle init`.
19
+
20
+ - The job template asks whether to add a **demo job** (default yes). `databricks bundle run bricksentry_demo` creates a 20,000-row demo table in your scratch schema, runs a MERGE whose ON condition compares region case-sensitively (so 25 orders are inserted again as duplicates), then checks that change. The run ends red with BLOCK, the rules that fired and the `RESTORE` that undoes it, plus the Slack alert if you set one up. It writes only to `bricksentry_demo_*` tables.
21
+ - `python -m bricksentry.job_demo`: the task that makes the demo change.
22
+ - Slack is now presented as optional in the template prompt, and the success message lists the next commands.
23
+ - The template README no longer says the trigger is paused in the dev target: the job sets `pause_status: UNPAUSED` on its trigger, which development mode respects.
24
+
25
+ ## 0.1.17 (2026-11-12)
26
+
27
+ - `bricksentry demo` now ends with a pipeline commit: a nightly MERGE with a wrong match condition lands, `check-last-change` finds it in the table history (skipping the OPTIMIZE after it), blocks it for 25 duplicate keys, prints the `RESTORE` and applies it. It replaces the old step 2, which only described a rollback because DuckDB has no table history; the demo now keeps versions itself. It still runs offline in about a second and ends with the one-command Databricks setup.
28
+ - The README opens with three steps, each on more real data: the 30-second demo on your laptop (`uvx --from "bricksentry[duckdb]" bricksentry demo`, nothing to install first), checking every change to your tables on Databricks with the bundle template, and stopping bad changes inside your pipeline job, in CI or for AI agents.
29
+ - New demo screenshot, generated from the real output by `scripts/render_demo_image.py`.
30
+
3
31
  ## 0.1.16 (2026-11-11)
4
32
 
5
33
  From the live test of 0.1.15 on Databricks serverless:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bricksentry
3
- Version: 0.1.16
3
+ Version: 0.1.19
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
@@ -55,22 +55,37 @@ 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](#try-it-in-30-seconds-no-databricks-needed)** · **[Run the Databricks notebook](#run-it-in-your-databricks-workspace)** · **[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)** · **[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
 
62
62
  *Why the name?* Bricks plus entry. Your tables and pipelines are the bricks of the lakehouse, and every change to them is an entry. bricksentry checks each entry, reports what it does, and stands guard before it lands.
63
63
 
64
- ## Try it in 30 seconds (no Databricks needed)
64
+ ## Three steps, each on more real data
65
+
66
+ ### 1. Try it in 30 seconds, on your laptop
65
67
 
66
68
  ```bash
67
- pip install "bricksentry[duckdb]"
68
- bricksentry demo
69
+ uvx --from "bricksentry[duckdb]" bricksentry demo
69
70
  ```
70
71
 
71
- An AI agent changes a 20,000-row revenue table. bricksentry previews its DELETE on a clone (production untouched), **blocks** its pull request for a join that duplicates 40 orders, and routes the fixed version to the owners of a certified table downstream. Everything runs locally on DuckDB.
72
+ (Or `pip install "bricksentry[duckdb]"` and then `bricksentry demo`. In a Databricks or Jupyter notebook, run `%pip install "bricksentry[duckdb]"` in one cell, then `from bricksentry.demo import run_demo; run_demo()` in the next; on Databricks, add `dbutils.library.restartPython()` after the install.) No Databricks account and nothing leaves your machine: it runs on a 20,000-row revenue table in local DuckDB. An AI agent previews a DELETE on a clone (production untouched), gets its pull request **blocked** for a join that duplicates 40 orders, fixes it, and is routed to the owners of a certified table downstream. Then a nightly pipeline commits a bad MERGE anyway: bricksentry finds it in the table history, skips the OPTIMIZE after it, **blocks** it for 25 duplicate keys, prints the `RESTORE` and applies it.
73
+
74
+ ![bricksentry demo: an agent's change is previewed, blocked, fixed and routed to the owners; then a bad pipeline commit is caught from table history and undone](https://raw.githubusercontent.com/bricksentry/bricksentry/main/docs/images/demo.png)
75
+
76
+ ### 2. Check every change to your tables, on Databricks
77
+
78
+ ```bash
79
+ databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check
80
+ cd bricksentry_check && databricks bundle deploy
81
+ databricks bundle run bricksentry_demo # optional: see a block on a demo table in about 2 minutes
82
+ ```
83
+
84
+ One command and a few prompts give you a serverless job that runs after every commit to the tables you pick: the same check as the demo's last step, on your data, with the `RESTORE` that undoes a bad change and an optional Slack alert. The optional demo job writes a known-bad MERGE to a demo table in your scratch schema and checks it, so your first run ends red with a block. [Details below](#check-every-pipeline-run-automatically-asset-bundle).
85
+
86
+ ### 3. Stop bad changes before anything reads them
72
87
 
73
- ![bricksentry demo: an agent's change is previewed, blocked for duplicate keys, then routed to the table owners](https://raw.githubusercontent.com/bricksentry/bricksentry/main/docs/images/demo.png)
88
+ Put the check inside your pipeline job, right after the task that writes the table: a `block` fails that task and the tasks downstream don't run. Or run it on pull requests with the [GitHub Action](#for-data-engineers-cli-and-ci), and give AI agents the same checks through the [MCP server](#for-ai-agents-the-mcp-server).
74
89
 
75
90
  ## Run it in your Databricks workspace
76
91
 
@@ -83,14 +98,14 @@ Point the [check-my-table notebook](examples/databricks/bricksentry_check_my_tab
83
98
 
84
99
  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
100
 
86
- ### Check every pipeline run automatically (Asset Bundle, 5 minutes)
101
+ ### Check every pipeline run automatically (Asset Bundle)
87
102
 
88
103
  ```bash
89
104
  databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check
90
105
  cd bricksentry_check && databricks bundle deploy -t prod
91
106
  ```
92
107
 
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.
108
+ Answer a few prompts (tables to watch, key columns if they have no primary key, SQL warehouse, scratch schema, whether to add the demo job, 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
109
 
95
110
  From the command line, the same check is one command:
96
111
 
@@ -8,22 +8,37 @@
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](#try-it-in-30-seconds-no-databricks-needed)** · **[Run the Databricks notebook](#run-it-in-your-databricks-workspace)** · **[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)** · **[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
 
15
15
  *Why the name?* Bricks plus entry. Your tables and pipelines are the bricks of the lakehouse, and every change to them is an entry. bricksentry checks each entry, reports what it does, and stands guard before it lands.
16
16
 
17
- ## Try it in 30 seconds (no Databricks needed)
17
+ ## Three steps, each on more real data
18
+
19
+ ### 1. Try it in 30 seconds, on your laptop
18
20
 
19
21
  ```bash
20
- pip install "bricksentry[duckdb]"
21
- bricksentry demo
22
+ uvx --from "bricksentry[duckdb]" bricksentry demo
22
23
  ```
23
24
 
24
- An AI agent changes a 20,000-row revenue table. bricksentry previews its DELETE on a clone (production untouched), **blocks** its pull request for a join that duplicates 40 orders, and routes the fixed version to the owners of a certified table downstream. Everything runs locally on DuckDB.
25
+ (Or `pip install "bricksentry[duckdb]"` and then `bricksentry demo`. In a Databricks or Jupyter notebook, run `%pip install "bricksentry[duckdb]"` in one cell, then `from bricksentry.demo import run_demo; run_demo()` in the next; on Databricks, add `dbutils.library.restartPython()` after the install.) No Databricks account and nothing leaves your machine: it runs on a 20,000-row revenue table in local DuckDB. An AI agent previews a DELETE on a clone (production untouched), gets its pull request **blocked** for a join that duplicates 40 orders, fixes it, and is routed to the owners of a certified table downstream. Then a nightly pipeline commits a bad MERGE anyway: bricksentry finds it in the table history, skips the OPTIMIZE after it, **blocks** it for 25 duplicate keys, prints the `RESTORE` and applies it.
26
+
27
+ ![bricksentry demo: an agent's change is previewed, blocked, fixed and routed to the owners; then a bad pipeline commit is caught from table history and undone](https://raw.githubusercontent.com/bricksentry/bricksentry/main/docs/images/demo.png)
28
+
29
+ ### 2. Check every change to your tables, on Databricks
30
+
31
+ ```bash
32
+ databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check
33
+ cd bricksentry_check && databricks bundle deploy
34
+ databricks bundle run bricksentry_demo # optional: see a block on a demo table in about 2 minutes
35
+ ```
36
+
37
+ One command and a few prompts give you a serverless job that runs after every commit to the tables you pick: the same check as the demo's last step, on your data, with the `RESTORE` that undoes a bad change and an optional Slack alert. The optional demo job writes a known-bad MERGE to a demo table in your scratch schema and checks it, so your first run ends red with a block. [Details below](#check-every-pipeline-run-automatically-asset-bundle).
38
+
39
+ ### 3. Stop bad changes before anything reads them
25
40
 
26
- ![bricksentry demo: an agent's change is previewed, blocked for duplicate keys, then routed to the table owners](https://raw.githubusercontent.com/bricksentry/bricksentry/main/docs/images/demo.png)
41
+ Put the check inside your pipeline job, right after the task that writes the table: a `block` fails that task and the tasks downstream don't run. Or run it on pull requests with the [GitHub Action](#for-data-engineers-cli-and-ci), and give AI agents the same checks through the [MCP server](#for-ai-agents-the-mcp-server).
27
42
 
28
43
  ## Run it in your Databricks workspace
29
44
 
@@ -36,14 +51,14 @@ Point the [check-my-table notebook](examples/databricks/bricksentry_check_my_tab
36
51
 
37
52
  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
53
 
39
- ### Check every pipeline run automatically (Asset Bundle, 5 minutes)
54
+ ### Check every pipeline run automatically (Asset Bundle)
40
55
 
41
56
  ```bash
42
57
  databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check
43
58
  cd bricksentry_check && databricks bundle deploy -t prod
44
59
  ```
45
60
 
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.
61
+ Answer a few prompts (tables to watch, key columns if they have no primary key, SQL warehouse, scratch schema, whether to add the demo job, 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
62
 
48
63
  From the command line, the same check is one command:
49
64
 
@@ -0,0 +1 @@
1
+ bricksentry[databricks,mcp]==0.1.19
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bricksentry"
7
- version = "0.1.16"
7
+ version = "0.1.19"
8
8
  description = "Change-safety for Databricks 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"
@@ -0,0 +1,117 @@
1
+ """Render `bricksentry demo` output as docs/images/demo.png (terminal-window style).
2
+
3
+ python scripts/render_demo_image.py # needs: playwright + chromium
4
+
5
+ Runs the demo with colors on, converts the ANSI output to HTML and screenshots it.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import html
11
+ import io
12
+ import os
13
+ import re
14
+ import sys
15
+ from contextlib import redirect_stdout
16
+ from pathlib import Path
17
+
18
+ OUT = Path(__file__).resolve().parents[1] / "docs" / "images" / "demo.png"
19
+ COMMAND = 'uvx --from "bricksentry[duckdb]" bricksentry demo'
20
+
21
+ BASIC = {30: "#1e293b", 31: "#e5484d", 32: "#22c55e", 33: "#e5a93b", 34: "#60a5fa", 35: "#c084fc",
22
+ 36: "#22c4c4", 37: "#e2e8f0", 90: "#7d8794", 91: "#f87171", 92: "#4ade80", 93: "#facc15",
23
+ 94: "#93c5fd", 95: "#e879f9", 96: "#67e8f9", 97: "#ffffff"}
24
+
25
+
26
+ def capture() -> str:
27
+ import click
28
+
29
+ os.environ["COLORTERM"] = "truecolor" # keep the website's exact verdict colors in the image
30
+ from bricksentry.demo import run_demo
31
+
32
+ buf = io.StringIO()
33
+ orig = click.echo
34
+
35
+ def echo(message=None, **kw): # keep ANSI codes when writing to a StringIO
36
+ kw["color"] = True
37
+ return orig(message, **kw)
38
+
39
+ click.echo = echo
40
+ try:
41
+ with redirect_stdout(buf):
42
+ run_demo()
43
+ finally:
44
+ click.echo = orig
45
+ return buf.getvalue()
46
+
47
+
48
+ def ansi_to_html(text: str) -> str:
49
+ out: list[str] = []
50
+ state: dict[str, str] = {}
51
+ pos = 0
52
+ for m in re.finditer(r"\x1b\[([0-9;]*)m", text):
53
+ out.append(_span(text[pos:m.start()], state))
54
+ codes = [int(c) for c in m.group(1).split(";") if c] or [0]
55
+ i = 0
56
+ while i < len(codes):
57
+ c = codes[i]
58
+ if c == 0:
59
+ state = {}
60
+ elif c == 1:
61
+ state["font-weight"] = "700"
62
+ elif c == 4:
63
+ state["text-decoration"] = "underline"
64
+ elif c in BASIC:
65
+ state["color"] = BASIC[c]
66
+ elif c in (38, 48) and codes[i + 1:i + 2] == [2]:
67
+ r, g, b = codes[i + 2:i + 5]
68
+ key = "color" if c == 38 else "background"
69
+ state[key] = f"rgb({r},{g},{b})"
70
+ if c == 48:
71
+ state["padding"] = "0 2px"
72
+ i += 4
73
+ i += 1
74
+ pos = m.end()
75
+ out.append(_span(text[pos:], state))
76
+ return "".join(out)
77
+
78
+
79
+ def _span(s: str, state: dict[str, str]) -> str:
80
+ if not s:
81
+ return ""
82
+ s = html.escape(s)
83
+ if not state:
84
+ return s
85
+ return f'<span style="{";".join(f"{k}:{v}" for k, v in state.items())}">{s}</span>'
86
+
87
+
88
+ PAGE = """<!doctype html><html><head><meta charset="utf-8"><style>
89
+ body{{margin:0;background:transparent}}
90
+ .win{{width:1180px;background:#0f172a;border-radius:12px;overflow:hidden;font:15px/1.6 'DejaVu Sans Mono',monospace;color:#e2e8f0}}
91
+ .bar{{background:#1a2740;padding:10px 16px;display:flex;gap:8px;align-items:center;color:#94a3b8;font-size:13px}}
92
+ .dot{{width:12px;height:12px;border-radius:50%;display:inline-block}}
93
+ pre{{margin:0;padding:18px 24px 26px;white-space:pre-wrap;font:inherit}}
94
+ .cmd{{color:#a5b4fc}}
95
+ </style></head><body><div class="win"><div class="bar"><span class="dot" style="background:#ff5f57"></span>
96
+ <span class="dot" style="background:#e5a93b"></span><span class="dot" style="background:#28c840"></span>
97
+ <span style="margin-left:12px">bricksentry demo</span></div><pre><span class="cmd">$ {cmd}</span>
98
+
99
+ {body}</pre></div></body></html>"""
100
+
101
+
102
+ def main() -> None:
103
+ from playwright.sync_api import sync_playwright
104
+
105
+ body = ansi_to_html(capture().rstrip("\n"))
106
+ page_html = PAGE.format(cmd=html.escape(COMMAND), body=body)
107
+ with sync_playwright() as p:
108
+ b = p.chromium.launch()
109
+ page = b.new_page(device_scale_factor=2, viewport={"width": 1180, "height": 800})
110
+ page.set_content(page_html)
111
+ page.locator(".win").screenshot(path=str(OUT), omit_background=True)
112
+ b.close()
113
+ print(f"wrote {OUT}", file=sys.stderr)
114
+
115
+
116
+ if __name__ == "__main__":
117
+ main()
@@ -8,12 +8,12 @@
8
8
  "source": "github"
9
9
  },
10
10
  "websiteUrl": "https://bricksentry.org",
11
- "version": "0.1.16",
11
+ "version": "0.1.19",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "pypi",
15
15
  "identifier": "bricksentry-mcp",
16
- "version": "0.1.16",
16
+ "version": "0.1.19",
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.16"
26
+ __version__ = "0.1.19"
@@ -1,11 +1,16 @@
1
- """``bricksentry demo``: the whole agent safety loop in about 30 seconds, locally.
1
+ """``bricksentry demo``: the whole safety loop in about 30 seconds, locally.
2
2
 
3
3
  Runs on an in-memory DuckDB database with a 20,000-row orders table and a small
4
4
  lineage graph, so it needs no Databricks workspace and no data leaves your machine.
5
+ Steps 1-4: an AI agent previews a delete, gets its pull request blocked, fixes it.
6
+ Step 5: a bad pipeline commit lands anyway; ``check-last-change`` catches it from the
7
+ table history and the undo is applied. DuckDB has no table history, so the demo keeps
8
+ versions itself; on Databricks the same check reads Delta history.
5
9
  """
6
10
 
7
11
  from __future__ import annotations
8
12
 
13
+ import os
9
14
  from pathlib import Path
10
15
  from typing import Any
11
16
 
@@ -16,6 +21,7 @@ from bricksentry.assess import Sentry
16
21
  from bricksentry.config import Config
17
22
 
18
23
  DOCS_URL = "https://bricksentry.org/docs"
24
+ BUNDLE_CMD = "databricks bundle init https://github.com/bricksentry/bricksentry --template-dir templates/job-check"
19
25
 
20
26
  CONFIG: dict[str, Any] = {
21
27
  "sandbox_schema": "sandbox",
@@ -65,8 +71,25 @@ FROM sales.orders
65
71
 
66
72
  DELETE_SQL = "DELETE FROM sales.orders WHERE status <> 'paid'"
67
73
 
74
+ # A nightly pipeline whose MERGE matches on the wrong column: 25 existing orders come
75
+ # back as new rows (duplicate keys) instead of updating in place.
76
+ BAD_MERGE_SQL = """
77
+ INSERT INTO sales.orders
78
+ SELECT order_id, region, round(amount * 1.05, 2), status FROM sales.orders WHERE order_id % 800 = 0
79
+ """
80
+
68
81
  # Same verdict colors as the website: pass green, warn amber, needs_human orange, block red.
69
- _COLORS: dict[str, Any] = {"pass": (29, 160, 100), "warn": (214, 160, 40), "needs_human": (235, 115, 40), "block": (210, 40, 50)}
82
+ _RGB_COLORS: dict[str, Any] = {"pass": (29, 160, 100), "warn": (214, 160, 40), "needs_human": (235, 115, 40), "block": (210, 40, 50)}
83
+ # Terminals without 24-bit color (macOS Terminal.app) misread RGB codes, e.g. as a black
84
+ # background, so they get the standard named colors instead.
85
+ _NAMED_COLORS: dict[str, Any] = {"pass": "green", "warn": "yellow", "needs_human": "bright_yellow", "block": "red"}
86
+
87
+
88
+ def _truecolor() -> bool:
89
+ return os.environ.get("COLORTERM", "").lower() in ("truecolor", "24bit")
90
+
91
+
92
+ _COLORS: dict[str, Any] = _RGB_COLORS if _truecolor() else _NAMED_COLORS
70
93
 
71
94
 
72
95
  def _verdict(v: str) -> str:
@@ -97,12 +120,45 @@ def _hits(rule_hits: list[dict[str, Any]]) -> None:
97
120
  _line(click.style(f"[{h['verdict']}]", fg=_COLORS.get(h["verdict"], "white")) + f" {h['rule']}: {h['reason']}")
98
121
 
99
122
 
123
+ def _versioned_backend():
124
+ """DuckDB plus a minimal table history (snapshots), so step 5 can run offline."""
125
+ from bricksentry.backends.duckdb_backend import DuckDBBackend
126
+
127
+ class VersionedDuckDB(DuckDBBackend):
128
+ supports_time_travel = True
129
+
130
+ def __init__(self) -> None:
131
+ super().__init__()
132
+ self._history: list[dict[str, Any]] = []
133
+
134
+ def commit(self, table: str, operation: str, sql: str | None = None) -> int:
135
+ if sql:
136
+ self.execute(sql)
137
+ v = len(self._history)
138
+ self.execute(f"CREATE SCHEMA IF NOT EXISTS _history; "
139
+ f"CREATE OR REPLACE TABLE _history.{table.replace('.', '__')}_v{v} AS SELECT * FROM {table}")
140
+ self._history.append({"version": v, "operation": operation, "timestamp": ""})
141
+ return v
142
+
143
+ def history(self, table: str, limit: int = 50) -> list[dict[str, Any]]:
144
+ return list(reversed(self._history))[:limit]
145
+
146
+ def clone_version(self, source: str, target: str, version: int) -> None:
147
+ self.execute(f"CREATE OR REPLACE TABLE {target} AS "
148
+ f"SELECT * FROM _history.{source.replace('.', '__')}_v{int(version)}")
149
+
150
+ def restore(self, table: str, version: int) -> int:
151
+ self.execute(f"CREATE OR REPLACE TABLE {table} AS "
152
+ f"SELECT * FROM _history.{table.replace('.', '__')}_v{int(version)}")
153
+ return self.commit(table, "RESTORE")
154
+
155
+ return VersionedDuckDB()
156
+
157
+
100
158
  def run_demo(report_path: str | None = None) -> dict[str, Any]:
101
159
  """Run the demo, print it, and return the key results (used by tests)."""
102
160
  try:
103
- from bricksentry.backends.duckdb_backend import DuckDBBackend
104
-
105
- backend = DuckDBBackend()
161
+ backend = _versioned_backend()
106
162
  except ImportError:
107
163
  # Raised without the inner traceback so a notebook shows one clear line.
108
164
  raise ImportError(
@@ -112,6 +168,7 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
112
168
 
113
169
  backend.execute("CREATE SCHEMA sales; CREATE SCHEMA sales_pr_42")
114
170
  backend.execute(SEED_SQL)
171
+ backend.commit("sales.orders", "CREATE TABLE AS SELECT")
115
172
  sentry = Sentry(Config.from_dict({**CONFIG, "assessment_store": False}), backend=backend)
116
173
  previous = agent_tools._SENTRY
117
174
  agent_tools.set_sentry(sentry)
@@ -121,7 +178,8 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
121
178
  click.style("bricksentry demo", bold=True)
122
179
  + click.style(" · 20,000-row sales.orders on local DuckDB; nothing leaves your machine", fg="bright_black")
123
180
  )
124
- click.echo(click.style("An AI agent is changing a revenue table. Watch what bricksentry tells it.", fg="bright_black"))
181
+ click.echo(click.style("An AI agent changes a revenue table, then a pipeline does. Watch what bricksentry says.",
182
+ fg="bright_black"))
125
183
  total = 5
126
184
 
127
185
  _step(1, total, "Before editing: what depends on sales.orders?", "whats_downstream")
@@ -146,12 +204,7 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
146
204
  walk("sales.orders", "")
147
205
  results["downstream_count"] = ds["count"]
148
206
 
149
- _step(2, total, "Capture a rollback plan first", "rollback_plan")
150
- _line("On Databricks this returns the exact command, e.g.", fg="bright_black")
151
- _line("RESTORE TABLE `main`.`sales`.`orders` TO VERSION AS OF 41")
152
- _line("(DuckDB has no table history, so the demo skips it.)", fg="bright_black")
153
-
154
- _step(3, total, "Agent wants to delete refunded orders. It previews first", "preview_write")
207
+ _step(2, total, "Agent wants to delete refunded orders. It previews first", "preview_write")
155
208
  _line(DELETE_SQL, fg="bright_black")
156
209
  p = agent_tools.preview_write(DELETE_SQL, "sales.orders")
157
210
  _line(_verdict(p["verdict"]) + " " + _short(p["tables"][0]["summary"]))
@@ -161,7 +214,7 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
161
214
  results["preview_verdict"] = p["verdict"]
162
215
  results["production_rows_after_preview"] = prod_rows
163
216
 
164
- _step(4, total, "Agent opens PR #42 instead. Its join has a fan-out bug", "assess_change")
217
+ _step(3, total, "Agent opens PR #42 instead. Its join has a fan-out bug", "assess_change")
165
218
  backend.execute(BUGGY_SQL)
166
219
  a = agent_tools.assess_change(["sales.orders"], pr="42")
167
220
  _line(_verdict(a["verdict"]) + f" risk {a['risk_tier']}")
@@ -170,7 +223,7 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
170
223
  _line("next_step: " + gate["next_step"], fg="cyan")
171
224
  results["buggy_verdict"] = a["verdict"]
172
225
 
173
- _step(5, total, "Agent fixes the join, rebuilds and checks again", "assess_change → safe_to_ship")
226
+ _step(4, total, "Agent fixes the join, rebuilds and checks again", "assess_change → safe_to_ship")
174
227
  backend.execute(FIXED_SQL)
175
228
  a2 = agent_tools.assess_change(["sales.orders"], pr="42")
176
229
  explanation = agent_tools.explain_diff(assessment_id=a2["id"])["explanations"]["sales.orders"]
@@ -181,6 +234,26 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
181
234
  results["fixed_verdict"] = a2["verdict"]
182
235
  results["notify"] = gate2["notify"]
183
236
 
237
+ _step(5, total, "Later, a nightly pipeline commits a bad MERGE", "check-last-change")
238
+ backend.commit("sales.orders", "MERGE", BAD_MERGE_SQL)
239
+ backend.commit("sales.orders", "OPTIMIZE")
240
+ a3, change = sentry.check_change("sales.orders")
241
+ t3 = a3.tables[0]
242
+ _line(f"History: v2 OPTIMIZE (skipped, no data change) · v1 MERGE, checked against v{change.base_version}",
243
+ fg="bright_black")
244
+ _line(_verdict(a3.verdict.value) + " " + _short(t3.summary.split(": ", 1)[-1]))
245
+ _hits([{"verdict": h.verdict.value, "rule": h.rule, "reason": h.reason} for h in t3.hits
246
+ if h.verdict.value in ("block", "needs_human")])
247
+ undo = t3.rollback.replace('"', "")
248
+ _line("Undo: " + undo, fg="cyan")
249
+ backend.restore("sales.orders", change.base_version)
250
+ rows = backend.scalar("SELECT COUNT(*) FROM sales.orders")
251
+ dups = backend.scalar("SELECT COUNT(*) - COUNT(DISTINCT order_id) FROM sales.orders")
252
+ _line(f"Applied the undo: sales.orders is back to {rows:,} rows, {dups} duplicate keys.", fg="green")
253
+ results["commit_verdict"] = a3.verdict.value
254
+ results["undo"] = undo
255
+ results["rows_after_undo"] = rows
256
+
184
257
  if report_path:
185
258
  from bricksentry.report import to_markdown
186
259
 
@@ -189,8 +262,11 @@ def run_demo(report_path: str | None = None) -> dict[str, Any]:
189
262
  click.echo(f"Wrote {report_path}: the pull-request comment a reviewer would see.")
190
263
 
191
264
  click.echo()
192
- click.echo(click.style("The agent was stopped once, corrected itself, and handed the final call to the owners.", bold=True))
193
- click.echo("Next: run `bricksentry init` in your project, then see " + click.style(DOCS_URL, underline=True))
265
+ click.echo(click.style("The agent was stopped, fixed its change and handed the call to the owners. "
266
+ "The bad commit was caught and undone.", bold=True))
267
+ click.echo("On Databricks, check every change to your tables with one command:")
268
+ click.echo(" " + click.style(BUNDLE_CMD, fg="cyan"))
269
+ click.echo("Docs: " + click.style(DOCS_URL, underline=True))
194
270
  finally:
195
271
  agent_tools.set_sentry(previous)
196
272
  return results
@@ -129,6 +129,24 @@ def _scratch_name(schema: str, table: str, version: int, run: str) -> str:
129
129
  return f"{schema}.bs_check_{short}_v{version}_{run}"
130
130
 
131
131
 
132
+ def _missing_catalog(e: Exception) -> bool:
133
+ m = str(e).upper()
134
+ return any(k in m for k in ("NO_SUCH_CATALOG", "CATALOG_NOT_FOUND", "CATALOG DOES NOT EXIST"))
135
+
136
+
137
+ def _ensure_scratch(db: Any, schema: str) -> None:
138
+ try:
139
+ db.ensure_schema(schema)
140
+ except Exception as e:
141
+ if _missing_catalog(e):
142
+ where = f"catalog {schema.split('.')[0]!r}" if "." in schema else "the default catalog"
143
+ raise RuntimeError(
144
+ f"The scratch schema {schema} is in {where}, which doesn't exist in this "
145
+ "workspace or you can't use it. Set the scratch schema (sandbox_schema, or --scratch-schema in a "
146
+ "job) to catalog.schema in a catalog you can create tables in.") from None
147
+ raise
148
+
149
+
132
150
  def check_change(
133
151
  sentry: Sentry,
134
152
  table: str,
@@ -160,7 +178,7 @@ def check_change(
160
178
  run = uuid.uuid4().hex[:8]
161
179
  base = _scratch_name(scratch, table, change.base_version, run)
162
180
  cand = _scratch_name(scratch, table, change.version, run)
163
- db.ensure_schema(scratch)
181
+ _ensure_scratch(db, scratch)
164
182
  try:
165
183
  for target, v in ((base, change.base_version), (cand, change.version)):
166
184
  try:
@@ -0,0 +1,76 @@
1
+ """Make a known-bad change to a demo table, so the first bricksentry check you see is a block.
2
+
3
+ Used by the ``bricksentry_demo`` job in the bundle template (``templates/job-check``)::
4
+
5
+ python -m bricksentry.job_demo --table main.bricksentry_scratch.bricksentry_demo_orders --warehouse-id abc123
6
+
7
+ It (re)creates a 20,000-row orders table, then runs a MERGE whose ON condition compares
8
+ region case-sensitively ('apac' vs 'APAC'). Nothing matches, so 25 orders that should have
9
+ been updated are inserted again as duplicates. The next task checks that change.
10
+ Only the table named by ``--table`` is written to.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import argparse
16
+ import os
17
+ import re
18
+ from typing import Any
19
+
20
+ SEED_SQL = """CREATE OR REPLACE TABLE {t} AS
21
+ SELECT id AS order_id,
22
+ element_at(array('APAC', 'EMEA', 'AMER'), CAST(1 + id % 3 AS INT)) AS region,
23
+ CAST(round(20 + (id % 97) * 3.1, 2) AS DOUBLE) AS amount,
24
+ CASE WHEN id % 10 = 0 THEN 'refunded' ELSE 'paid' END AS status
25
+ FROM range(1, 20001)"""
26
+
27
+ # Late price corrections for 25 orders. The bug: the source has region in lower case and
28
+ # the ON condition compares it case-sensitively, so no row matches and all 25 are inserted.
29
+ BAD_MERGE_SQL = """MERGE INTO {t} AS t
30
+ USING (
31
+ SELECT order_id, lower(region) AS region, round(amount * 1.05, 2) AS amount, status
32
+ FROM {t} WHERE order_id % 800 = 0
33
+ ) AS s
34
+ ON t.order_id = s.order_id AND t.region = s.region
35
+ WHEN MATCHED THEN UPDATE SET t.amount = s.amount
36
+ WHEN NOT MATCHED THEN INSERT (order_id, region, amount, status)
37
+ VALUES (s.order_id, upper(s.region), s.amount, s.status)"""
38
+
39
+ _NAME = re.compile(r"[A-Za-z0-9_]+\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+")
40
+
41
+
42
+ def run(argv: list[str] | None = None, backend: Any = None, out=print) -> int:
43
+ p = argparse.ArgumentParser(prog="python -m bricksentry.job_demo", description=__doc__.split("\n\n")[0])
44
+ p.add_argument("--table", required=True, help="catalog.schema.table for the demo (created or replaced)")
45
+ p.add_argument("--warehouse-id", default=os.environ.get("DATABRICKS_WAREHOUSE_ID"))
46
+ args = p.parse_args(argv)
47
+ if not _NAME.fullmatch(args.table):
48
+ raise SystemExit(f"--table must be catalog.schema.table, got {args.table!r}")
49
+ if not args.table.split(".")[-1].startswith("bricksentry_demo"):
50
+ raise SystemExit("For safety the demo only writes to a table whose name starts with bricksentry_demo.")
51
+ if backend is None: # pragma: no cover - needs Databricks
52
+ from bricksentry.backends.databricks_backend import DatabricksBackend
53
+
54
+ backend = DatabricksBackend(warehouse_id=args.warehouse_id)
55
+ from bricksentry.history import _ensure_scratch
56
+
57
+ t = backend.qualified(args.table)
58
+ try:
59
+ _ensure_scratch(backend, ".".join(args.table.split(".")[:2]))
60
+ except RuntimeError as e:
61
+ raise SystemExit(str(e)) from None
62
+ backend.execute(SEED_SQL.format(t=t))
63
+ out(f"Created {args.table}: 20,000 orders, one row per order_id.")
64
+ backend.execute(BAD_MERGE_SQL.format(t=t))
65
+ out("Ran a MERGE with a bug: its ON condition compares region case-sensitively ('apac' vs 'APAC'),")
66
+ out("so 25 orders it should have updated were inserted again as duplicates.")
67
+ out("The next task checks this change. Expect BLOCK (duplicate-keys), and the RESTORE that undoes it.")
68
+ return 0
69
+
70
+
71
+ def main(argv: list[str] | None = None) -> None: # pragma: no cover - thin wrapper
72
+ run(argv) # no sys.exit on success: Databricks marks SystemExit(0) as a failed task
73
+
74
+
75
+ if __name__ == "__main__": # pragma: no cover
76
+ main()