bricksentry 0.1.15__tar.gz → 0.1.16__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 (78) hide show
  1. {bricksentry-0.1.15 → bricksentry-0.1.16}/CHANGELOG.md +8 -0
  2. {bricksentry-0.1.15 → bricksentry-0.1.16}/PKG-INFO +1 -1
  3. bricksentry-0.1.16/deploy/databricks-app/requirements.txt +1 -0
  4. {bricksentry-0.1.15 → bricksentry-0.1.16}/pyproject.toml +1 -1
  5. {bricksentry-0.1.15 → bricksentry-0.1.16}/server.json +2 -2
  6. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/__init__.py +1 -1
  7. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/history.py +8 -4
  8. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/databricks_template_schema.json +8 -0
  9. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/template/{{.project_name}}/README.md.tmpl +7 -1
  10. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/template/{{.project_name}}/resources/bricksentry_check.job.yml.tmpl +7 -2
  11. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_0114.py +16 -3
  12. bricksentry-0.1.15/deploy/databricks-app/requirements.txt +0 -1
  13. {bricksentry-0.1.15 → bricksentry-0.1.16}/.gitignore +0 -0
  14. {bricksentry-0.1.15 → bricksentry-0.1.16}/CONTRIBUTING.md +0 -0
  15. {bricksentry-0.1.15 → bricksentry-0.1.16}/LICENSE +0 -0
  16. {bricksentry-0.1.15 → bricksentry-0.1.16}/README.md +0 -0
  17. {bricksentry-0.1.15 → bricksentry-0.1.16}/SECURITY.md +0 -0
  18. {bricksentry-0.1.15 → bricksentry-0.1.16}/action.yml +0 -0
  19. {bricksentry-0.1.15 → bricksentry-0.1.16}/deploy/databricks-app/README.md +0 -0
  20. {bricksentry-0.1.15 → bricksentry-0.1.16}/deploy/databricks-app/app.yaml +0 -0
  21. {bricksentry-0.1.15 → bricksentry-0.1.16}/deploy/databricks-app/bricksentry.yml +0 -0
  22. {bricksentry-0.1.15 → bricksentry-0.1.16}/deploy/databricks-app/databricks.yml +0 -0
  23. {bricksentry-0.1.15 → bricksentry-0.1.16}/deploy/databricks-app/grants.sql +0 -0
  24. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry.yml +0 -0
  25. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry_check_my_table.ipynb +0 -0
  26. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry_check_my_table.py +0 -0
  27. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry_hr_walkthrough.ipynb +0 -0
  28. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry_hr_walkthrough.py +0 -0
  29. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
  30. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/bricksentry_quickstart.py +0 -0
  31. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/github-workflow.yml +0 -0
  32. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/databricks/policy.yml +0 -0
  33. {bricksentry-0.1.15 → bricksentry-0.1.16}/examples/demo/agent_loop_demo.py +0 -0
  34. {bricksentry-0.1.15 → bricksentry-0.1.16}/scripts/build_notebook.py +0 -0
  35. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/__main__.py +0 -0
  36. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/agent_tools.py +0 -0
  37. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/assess.py +0 -0
  38. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/backends/__init__.py +0 -0
  39. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/backends/base.py +0 -0
  40. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/backends/databricks_backend.py +0 -0
  41. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/backends/duckdb_backend.py +0 -0
  42. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/changes.py +0 -0
  43. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/cli.py +0 -0
  44. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/config.py +0 -0
  45. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/demo.py +0 -0
  46. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/diff.py +0 -0
  47. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/explain.py +0 -0
  48. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/github.py +0 -0
  49. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/job.py +0 -0
  50. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/lineage.py +0 -0
  51. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/mcp_server.py +0 -0
  52. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/measures.py +0 -0
  53. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/models.py +0 -0
  54. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/notify.py +0 -0
  55. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/policy.py +0 -0
  56. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/policy_templates.py +0 -0
  57. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/preview.py +0 -0
  58. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/py.typed +0 -0
  59. {bricksentry-0.1.15 → bricksentry-0.1.16}/src/bricksentry/report.py +0 -0
  60. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/README.md +0 -0
  61. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/template/{{.project_name}}/.gitignore +0 -0
  62. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/template/{{.project_name}}/databricks.yml.tmpl +0 -0
  63. {bricksentry-0.1.15 → bricksentry-0.1.16}/templates/job-check/template/{{.project_name}}/src/bricksentry_check.py +0 -0
  64. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/conftest.py +0 -0
  65. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_0110.py +0 -0
  66. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_0112.py +0 -0
  67. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_018.py +0 -0
  68. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_019.py +0 -0
  69. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_assess_policy.py +0 -0
  70. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_check_notebook.py +0 -0
  71. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_databricks_and_uc.py +0 -0
  72. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_demo.py +0 -0
  73. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_diff.py +0 -0
  74. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_hr_notebook.py +0 -0
  75. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_notebook.py +0 -0
  76. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_notify_templates.py +0 -0
  77. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_preview_agents.py +0 -0
  78. {bricksentry-0.1.15 → bricksentry-0.1.16}/tests/test_sample_guard_and_store.py +0 -0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.16 (2026-11-11)
4
+
5
+ From the live test of 0.1.15 on Databricks serverless:
6
+
7
+ - Fix: two checks of the same table at the same time (two jobs watching it, or a job and a notebook) used the same scratch clone names, so one check's cleanup could drop the other's clone mid-diff (`TABLE_OR_VIEW_NOT_FOUND`). Each check now uses its own clone names.
8
+ - The job template's task also sets `disable_auto_optimization: true`. On serverless, auto-optimization retries failed tasks even with `max_retries: 0`, so a `block` was still run twice.
9
+ - The job template now pins the bricksentry version (new `bricksentry_version` prompt, default the current release). Correction to the 0.1.15 release notes: a job deployed with `>=0.1.14` does **not** pick up new releases by itself, because serverless resolves a job's dependencies once and caches them. To upgrade, change the version in the job's YAML and redeploy; the generated README says so.
10
+
3
11
  ## 0.1.15 (2026-11-11)
4
12
 
5
13
  From the first live test of the 0.1.14 job template on Databricks serverless (deployed with `databricks bundle deploy`, started by the table update trigger and by hand):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bricksentry
3
- Version: 0.1.15
3
+ Version: 0.1.16
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
@@ -0,0 +1 @@
1
+ bricksentry[databricks,mcp]==0.1.16
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bricksentry"
7
- version = "0.1.15"
7
+ version = "0.1.16"
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"
@@ -8,12 +8,12 @@
8
8
  "source": "github"
9
9
  },
10
10
  "websiteUrl": "https://bricksentry.org",
11
- "version": "0.1.15",
11
+ "version": "0.1.16",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "pypi",
15
15
  "identifier": "bricksentry-mcp",
16
- "version": "0.1.15",
16
+ "version": "0.1.16",
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.15"
26
+ __version__ = "0.1.16"
@@ -9,6 +9,7 @@ version after), diffs them, runs lineage and policy, and returns the assessment
9
9
  from __future__ import annotations
10
10
 
11
11
  import re
12
+ import uuid
12
13
  from dataclasses import dataclass
13
14
  from datetime import datetime, timezone
14
15
  from typing import TYPE_CHECKING, Any
@@ -123,9 +124,9 @@ def pick_change(
123
124
  str(h.get("timestamp") or ""), [h["version"]])
124
125
 
125
126
 
126
- def _scratch_name(schema: str, table: str, version: int) -> str:
127
+ def _scratch_name(schema: str, table: str, version: int, run: str) -> str:
127
128
  short = re.sub(r"[^A-Za-z0-9_]", "_", table.split(".")[-1])[:40]
128
- return f"{schema}.bs_check_{short}_v{version}"
129
+ return f"{schema}.bs_check_{short}_v{version}_{run}"
129
130
 
130
131
 
131
132
  def check_change(
@@ -154,8 +155,11 @@ def check_change(
154
155
  "or add a PRIMARY KEY constraint to the table.")
155
156
 
156
157
  scratch = sentry.config.sandbox_schema
157
- base = _scratch_name(scratch, table, change.base_version)
158
- cand = _scratch_name(scratch, table, change.version)
158
+ # Unique per check, so two checks of the same table at the same time (two jobs, or a job
159
+ # and a notebook) never drop each other's clones.
160
+ run = uuid.uuid4().hex[:8]
161
+ base = _scratch_name(scratch, table, change.base_version, run)
162
+ cand = _scratch_name(scratch, table, change.version, run)
159
163
  db.ensure_schema(scratch)
160
164
  try:
161
165
  for target, v in ((base, change.base_version), (cand, change.version)):
@@ -72,6 +72,14 @@
72
72
  ],
73
73
  "description": "Mark the run failed when the verdict is at least",
74
74
  "order": 8
75
+ },
76
+ "bricksentry_version": {
77
+ "type": "string",
78
+ "default": "0.1.16",
79
+ "description": "bricksentry version to install in the job (pinned; change it and redeploy to upgrade)",
80
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
81
+ "pattern_match_failure_message": "Use a version like 0.1.16.",
82
+ "order": 9
75
83
  }
76
84
  },
77
85
  "success_message": "Created {{.project_name}}. Next: cd {{.project_name}} && databricks bundle deploy. See {{.project_name}}/README.md."
@@ -26,6 +26,12 @@ The job's identity needs `SELECT` on the tables, `USE` and `CREATE TABLE` on
26
26
  lineage){{if .slack_secret}}, and `READ` on the secret scope{{end}}. Table history must still be there
27
27
  (not removed by `VACUUM`).
28
28
 
29
+ ## Upgrading bricksentry
30
+
31
+ The job installs `bricksentry[databricks]=={{.bricksentry_version}}`. Serverless resolves a job's
32
+ dependencies once and caches them, so to upgrade, change that version in
33
+ `resources/bricksentry_check.job.yml` and run `databricks bundle deploy` again.
34
+
29
35
  ## Slack alerts
30
36
 
31
37
  ```bash
@@ -55,7 +61,7 @@ writes the table:
55
61
  depends_on: [{task_key: bricksentry_check}]
56
62
  environments:
57
63
  - environment_key: bricksentry
58
- spec: {environment_version: "2", dependencies: ["bricksentry[databricks]>=0.1.15"]}
64
+ spec: {environment_version: "2", dependencies: ["bricksentry[databricks]=={{.bricksentry_version}}"]}
59
65
  ```
60
66
 
61
67
  `--since {{`{{job.start_time.iso_datetime}}`}}` checks everything this run wrote as one change.
@@ -16,7 +16,10 @@ resources:
16
16
  tasks:
17
17
  - task_key: bricksentry_check
18
18
  environment_key: default
19
- max_retries: 0 # a block verdict is an answer, not a flaky failure
19
+ # A block verdict is an answer, not a flaky failure: no retries. On serverless,
20
+ # auto-optimization retries failed tasks even with max_retries: 0, so turn it off too.
21
+ max_retries: 0
22
+ disable_auto_optimization: true
20
23
  spark_python_task:
21
24
  python_file: ../src/bricksentry_check.py
22
25
  parameters:
@@ -51,4 +54,6 @@ resources:
51
54
  spec:
52
55
  environment_version: "2"
53
56
  dependencies:
54
- - bricksentry[databricks]>=0.1.15
57
+ # Pinned: serverless resolves the dependencies once and caches them, so a range
58
+ # would not pick up new releases. To upgrade, change the version and redeploy.
59
+ - bricksentry[databricks]=={{.bricksentry_version}}
@@ -113,8 +113,10 @@ def test_check_change_end_to_end():
113
113
  assert t.rollback == 'RESTORE TABLE "sales"."orders" TO VERSION AS OF 2'
114
114
  assert t.summary.startswith("v2 -> v3 (MERGE): ")
115
115
  assert [n.name for n in t.downstream] == ["sales.daily_revenue"]
116
- assert db.dropped == ["scratch.bs_check_orders_v2", "scratch.bs_check_orders_v3"]
117
- assert not db.table_exists("scratch.bs_check_orders_v3")
116
+ assert [re.sub(r"_[0-9a-f]{8}$", "", d) for d in db.dropped] == [
117
+ "scratch.bs_check_orders_v2", "scratch.bs_check_orders_v3"]
118
+ assert db.dropped[0][-8:] == db.dropped[1][-8:] # one run id per check
119
+ assert not any(db.table_exists(d) for d in db.dropped)
118
120
 
119
121
 
120
122
  def test_check_change_since_and_keys_from_config():
@@ -320,6 +322,7 @@ def test_bundle_template_renders(slack, keys):
320
322
  root = Path(__file__).resolve().parents[1] / "templates" / "job-check"
321
323
  schema = json.loads((root / "databricks_template_schema.json").read_text())
322
324
  values = {k: p.get("default", "") for k, p in schema["properties"].items()}
325
+ assert values["bricksentry_version"] == __import__("bricksentry").__version__
323
326
  values.update(tables="main.sales.orders, main.sales.customers", warehouse_id="abc123", slack_secret=slack,
324
327
  keys=keys)
325
328
  for k, p in schema["properties"].items():
@@ -337,7 +340,8 @@ def test_bundle_template_renders(slack, keys):
337
340
  assert "{{workspace.url}}/jobs/{{job.id}}/runs/{{job.run_id}}" in params
338
341
  assert ("--slack-secret" in params) == bool(slack)
339
342
  assert ("--keys" in params) == bool(keys)
340
- assert task["max_retries"] == 0
343
+ assert task["max_retries"] == 0 and task["disable_auto_optimization"] is True
344
+ assert j["environments"][0]["spec"]["dependencies"] == [f"bricksentry[databricks]=={values['bricksentry_version']}"]
341
345
  assert task["environment_key"] == j["environments"][0]["environment_key"]
342
346
  assert j["environments"][0]["spec"]["dependencies"][0].startswith("bricksentry[databricks]")
343
347
  # the job task's argv parses, and an unresolved trigger value falls back to --default-tables
@@ -375,3 +379,12 @@ def test_job_keys_option():
375
379
  code = job.run(["--tables", "sales.orders", "--keys", "sales.orders=order_id; sales.other=x",
376
380
  "--scratch-schema", "scratch", "--fail-on", "never"], backend=FakeDelta(pk=()), out=lines.append)
377
381
  assert code == 0 and "sales.orders: BLOCK" in lines[0]
382
+
383
+
384
+ def test_concurrent_checks_use_different_clones():
385
+ """Two checks of the same table must not share clone names (found live: one job's cleanup
386
+ dropped the other's clone mid-diff)."""
387
+ db = FakeDelta()
388
+ sentry(db).check_change("sales.orders")
389
+ sentry(db).check_change("sales.orders")
390
+ assert len(set(db.dropped)) == 4
@@ -1 +0,0 @@
1
- bricksentry[databricks,mcp]==0.1.15
File without changes
File without changes
File without changes
File without changes
File without changes