bricksentry 0.1.5__tar.gz → 0.1.7__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.
- {bricksentry-0.1.5 → bricksentry-0.1.7}/CHANGELOG.md +15 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/PKG-INFO +92 -6
- {bricksentry-0.1.5 → bricksentry-0.1.7}/README.md +91 -5
- {bricksentry-0.1.5 → bricksentry-0.1.7}/action.yml +12 -0
- bricksentry-0.1.7/packages/bricksentry-mcp/LICENSE +202 -0
- bricksentry-0.1.7/packages/bricksentry-mcp/README.md +32 -0
- bricksentry-0.1.7/packages/bricksentry-mcp/src/bricksentry_mcp/__init__.py +5 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/pyproject.toml +1 -1
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/__init__.py +1 -1
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/assess.py +11 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/cli.py +54 -5
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/config.py +13 -2
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/demo.py +6 -4
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/mcp_server.py +1 -1
- bricksentry-0.1.7/src/bricksentry/notify.py +156 -0
- bricksentry-0.1.7/src/bricksentry/policy_templates.py +147 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/preview.py +29 -3
- bricksentry-0.1.7/tests/test_notify_templates.py +201 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/.gitignore +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/CONTRIBUTING.md +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/LICENSE +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/SECURITY.md +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/examples/databricks/bricksentry.yml +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/examples/databricks/bricksentry_quickstart.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/examples/databricks/github-workflow.yml +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/examples/databricks/policy.yml +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/examples/demo/agent_loop_demo.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/scripts/build_notebook.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/agent_tools.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/backends/__init__.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/backends/base.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/backends/databricks_backend.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/backends/duckdb_backend.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/changes.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/diff.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/explain.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/github.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/lineage.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/models.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/policy.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/py.typed +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/src/bricksentry/report.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/conftest.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_assess_policy.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_databricks_and_uc.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_demo.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_diff.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_notebook.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_preview_agents.py +0 -0
- {bricksentry-0.1.5 → bricksentry-0.1.7}/tests/test_sample_guard_and_store.py +0 -0
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.7 (2026-11-11)
|
|
4
|
+
|
|
5
|
+
- New companion package `bricksentry-mcp`: `uvx bricksentry-mcp --config /full/path/bricksentry.yml` starts the MCP server with everything it needs. Before, `uvx bricksentry mcp` installed the package without its MCP extra and failed, and that is what MCP Registry clients ran. The registry listing now points at `bricksentry-mcp`.
|
|
6
|
+
- Setup docs for Claude Code, the Claude desktop app and Cursor now use full config paths, which clients need because they start the server from their own folder.
|
|
7
|
+
- `run_demo()` called from Python without DuckDB now raises one clear ImportError with the install command, instead of a CLI error with a traceback (reported in a Databricks notebook test).
|
|
8
|
+
- New `agent-safe` policy template for changes written by AI agents.
|
|
9
|
+
|
|
10
|
+
## 0.1.6 (2026-11-11)
|
|
11
|
+
|
|
12
|
+
- Slack and Teams alerts. Set `notify:` in bricksentry.yml (or `BRICKSENTRY_SLACK_WEBHOOK` / `BRICKSENTRY_TEAMS_WEBHOOK`) and `assess` / `preview` post the verdict, the rules that fired, the reviewers and a PR link when the verdict reaches `notify.on` (default `needs_human`). `--no-notify` turns it off; `Sentry.notify()` does it from Python; the GitHub Action takes `slack-webhook`, `teams-webhook` and `notify-on`. A failed webhook never changes the verdict.
|
|
13
|
+
- Policy templates: `default`, `strict`, `pii`, `certified` and `finance`. Use `policy: builtin:<name>`, `bricksentry init --policy <name>`, or list them with `bricksentry policies`.
|
|
14
|
+
- When `preview_write` refuses DROP, TRUNCATE, ALTER, GRANT, REVOKE, VACUUM or RESTORE, the error now says what to do instead.
|
|
15
|
+
- Listed in the official MCP Registry as `io.github.bricksentry/bricksentry` (published automatically on each release).
|
|
16
|
+
- A complete copy-paste GitHub Actions workflow in the README.
|
|
17
|
+
|
|
3
18
|
## 0.1.5 (2026-11-10)
|
|
4
19
|
|
|
5
20
|
- Clearer MCP tool definitions for agents. Each tool now says when to use it versus its sibling tools and what it returns, and every parameter has a description in the tool schema (for example the `candidates` map format for `assess_change`). No behavior changes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bricksentry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
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
|
|
@@ -47,6 +47,8 @@ Description-Content-Type: text/markdown
|
|
|
47
47
|
|
|
48
48
|
# Welcome to bricksentry
|
|
49
49
|
|
|
50
|
+
<!-- mcp-name: io.github.bricksentry/bricksentry -->
|
|
51
|
+
|
|
50
52
|
[](https://pypi.org/project/bricksentry/) [](https://pypi.org/project/bricksentry/) [](https://github.com/bricksentry/bricksentry/actions/workflows/ci.yml) [](https://github.com/bricksentry/bricksentry/actions/workflows/lint.yml) [](https://github.com/bricksentry/bricksentry/actions/workflows/ci.yml) [](LICENSE)
|
|
51
53
|
|
|
52
54
|
***The safety check for data changes in the AI era.***
|
|
@@ -105,11 +107,30 @@ AI now writes much of our pipeline code, and checking what that code does to the
|
|
|
105
107
|
|
|
106
108
|
## For AI agents: the MCP server
|
|
107
109
|
|
|
110
|
+
The quickest way to connect an agent is the `bricksentry-mcp` package, which installs bricksentry with its MCP and Databricks extras. With [uv](https://docs.astral.sh/uv/) there is nothing to install first:
|
|
111
|
+
|
|
108
112
|
```bash
|
|
109
|
-
|
|
110
|
-
claude mcp add bricksentry -- bricksentry
|
|
113
|
+
# Claude Code
|
|
114
|
+
claude mcp add bricksentry -- uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"mcpServers": {
|
|
120
|
+
"bricksentry": {
|
|
121
|
+
"command": "uvx",
|
|
122
|
+
"args": ["bricksentry-mcp", "--config", "/full/path/to/bricksentry.yml"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
111
126
|
```
|
|
112
127
|
|
|
128
|
+
The JSON works for the Claude desktop app, Cursor and other MCP clients. Use a **full path** to `bricksentry.yml`, because clients start the server from their own working folder. If an app can't find `uvx`, use its full path (`which uvx`). To share the setup through a repo, `claude mcp add -s project ...` writes it to `.mcp.json`; a relative path then works when Claude Code starts from the repo root. No config yet? `uvx --from bricksentry bricksentry init` writes a starter one.
|
|
129
|
+
|
|
130
|
+
Already installed bricksentry with pip? `pip install "bricksentry[mcp,databricks]"` and run `bricksentry mcp --config /full/path/to/bricksentry.yml` instead. Add `--transport streamable-http` for remote agents.
|
|
131
|
+
|
|
132
|
+
bricksentry is listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.bricksentry/bricksentry) as `io.github.bricksentry/bricksentry`.
|
|
133
|
+
|
|
113
134
|
| Tool | What the agent gets |
|
|
114
135
|
|---|---|
|
|
115
136
|
| `whats_downstream(table, depth)` | Downstream assets with owners and tags. Call it *before* editing. |
|
|
@@ -135,6 +156,8 @@ To watch the whole loop, run `bricksentry demo` (see the top of this page). `bri
|
|
|
135
156
|
|
|
136
157
|
```bash
|
|
137
158
|
bricksentry init # starter bricksentry.yml + policy.yml
|
|
159
|
+
bricksentry init --policy finance # ...or start from a policy template
|
|
160
|
+
bricksentry policies # list the policy templates
|
|
138
161
|
bricksentry impact main.sales.orders # blast radius
|
|
139
162
|
bricksentry diff main.sales.orders main.sales_pr_42.orders
|
|
140
163
|
bricksentry preview main.sales.orders --sql "MERGE INTO {{target}} t USING updates u ON t.order_id = u.order_id WHEN MATCHED THEN UPDATE SET *"
|
|
@@ -171,12 +194,60 @@ Check out with `fetch-depth: 0` and give the job `pull-requests: write` permissi
|
|
|
171
194
|
Or use the bundled GitHub Action, which also writes the report to the job summary:
|
|
172
195
|
|
|
173
196
|
```yaml
|
|
174
|
-
- uses: bricksentry/bricksentry@v0.1.
|
|
197
|
+
- uses: bricksentry/bricksentry@v0.1.7
|
|
175
198
|
with:
|
|
176
199
|
config: bricksentry.yml
|
|
177
200
|
fail-on: needs_human
|
|
178
201
|
```
|
|
179
202
|
|
|
203
|
+
A complete workflow you can copy to `.github/workflows/bricksentry.yml`:
|
|
204
|
+
|
|
205
|
+
```yaml
|
|
206
|
+
name: bricksentry
|
|
207
|
+
on: pull_request
|
|
208
|
+
|
|
209
|
+
permissions:
|
|
210
|
+
contents: read
|
|
211
|
+
pull-requests: write
|
|
212
|
+
|
|
213
|
+
jobs:
|
|
214
|
+
check-data:
|
|
215
|
+
runs-on: ubuntu-latest
|
|
216
|
+
steps:
|
|
217
|
+
- uses: actions/checkout@v4
|
|
218
|
+
with:
|
|
219
|
+
fetch-depth: 0
|
|
220
|
+
# Build this PR's version of your pipeline into a per-PR schema first,
|
|
221
|
+
# for example: databricks bundle deploy -t ci && databricks bundle run -t ci
|
|
222
|
+
- uses: bricksentry/bricksentry@v0.1.7
|
|
223
|
+
with:
|
|
224
|
+
config: bricksentry.yml
|
|
225
|
+
fail-on: needs_human
|
|
226
|
+
slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }} # optional
|
|
227
|
+
teams-webhook: ${{ secrets.TEAMS_WEBHOOK_URL }} # optional
|
|
228
|
+
env:
|
|
229
|
+
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
|
|
230
|
+
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
|
|
231
|
+
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
|
|
232
|
+
DATABRICKS_WAREHOUSE_ID: ${{ secrets.DATABRICKS_WAREHOUSE_ID }}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
To make the check binding, mark this job as a required status check in your branch protection rules. Then a `needs_human` or `block` verdict stops the merge, whatever the author or an agent decides.
|
|
236
|
+
|
|
237
|
+
### Alerts in Slack and Teams
|
|
238
|
+
|
|
239
|
+
When the verdict is `needs_human` or worse, bricksentry can post a short alert: the verdict, the rules that fired, who should review, and a link to the PR.
|
|
240
|
+
|
|
241
|
+
```yaml
|
|
242
|
+
# bricksentry.yml
|
|
243
|
+
notify:
|
|
244
|
+
on: needs_human # alert at this verdict or worse
|
|
245
|
+
slack_webhook: env:SLACK_WEBHOOK_URL # Slack incoming webhook
|
|
246
|
+
teams_webhook: env:TEAMS_WEBHOOK_URL # Teams Workflows "webhook request" URL
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Keep webhook URLs in secrets or environment variables, never in the file. `BRICKSENTRY_SLACK_WEBHOOK` and `BRICKSENTRY_TEAMS_WEBHOOK` work too. `assess` and `preview` send alerts automatically when a webhook is set (`--no-notify` turns them off), and in Python call `sentry.notify(assessment)`. A failed webhook is reported but never changes the verdict or fails the run.
|
|
250
|
+
|
|
180
251
|
## Python API
|
|
181
252
|
|
|
182
253
|
```python
|
|
@@ -204,7 +275,7 @@ tables:
|
|
|
204
275
|
keys: [order_id]
|
|
205
276
|
segment_by: [region]
|
|
206
277
|
paths: ["src/pipelines/orders/**", "resources/orders_job.yml"]
|
|
207
|
-
policy: policy.yml
|
|
278
|
+
policy: policy.yml # or builtin:<template>, see "Policy templates" below
|
|
208
279
|
```
|
|
209
280
|
|
|
210
281
|
### Policy example
|
|
@@ -238,6 +309,21 @@ rules:
|
|
|
238
309
|
|
|
239
310
|
If several rules match, the most severe one wins. The full starter policy is in [`examples/databricks/policy.yml`](examples/databricks/policy.yml), and `bricksentry init` writes one for you.
|
|
240
311
|
|
|
312
|
+
### Policy templates
|
|
313
|
+
|
|
314
|
+
Start from a ready-made policy instead of writing one:
|
|
315
|
+
|
|
316
|
+
| Template | For |
|
|
317
|
+
|---|---|
|
|
318
|
+
| `agent-safe` | Changes written by AI agents: anything beyond a small, clean change goes to a human |
|
|
319
|
+
| `default` | Balanced: block duplicate keys, a human for row loss, dropped columns, PII and certified downstream |
|
|
320
|
+
| `strict` | Production-critical pipelines: small changes need a human, failed checks block |
|
|
321
|
+
| `pii` | Tables with personal data: any change to a `pii`-tagged table, or one feeding it, needs a human |
|
|
322
|
+
| `certified` | Certified or gold tables that dashboards and AI rely on |
|
|
323
|
+
| `finance` | Revenue and money tables: totals can't move quietly, double counting is blocked |
|
|
324
|
+
|
|
325
|
+
Use one directly with `policy: builtin:finance`, or write an editable copy with `bricksentry init --policy finance`. `bricksentry policies finance` prints it. Tags come from Unity Catalog, so tag your tables `pii` or `certified` for those templates to apply.
|
|
326
|
+
|
|
241
327
|
### Policy conditions
|
|
242
328
|
|
|
243
329
|
`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`) · `any_change` · `diff_error`
|
|
@@ -262,7 +348,7 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
|
|
|
262
348
|
|
|
263
349
|
**Top priority: validation across more workspaces.** Classic and serverless compute, AWS, Azure and GCP, and workspaces with restricted system-table access. If you run the quickstart notebook, please [share what you see](https://github.com/bricksentry/bricksentry/issues), whether it works or not.
|
|
264
350
|
|
|
265
|
-
Next: Asset Bundle parsing for automatic table detection · column-level blast radius from `system.access.column_lineage` · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
|
|
351
|
+
Next: dbt support, so dbt models on Databricks get the same diff, blast radius and verdict (planned for 0.2) · Asset Bundle parsing for automatic table detection · column-level blast radius from `system.access.column_lineage` · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
|
|
266
352
|
|
|
267
353
|
## Contributing
|
|
268
354
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Welcome to bricksentry
|
|
2
2
|
|
|
3
|
+
<!-- mcp-name: io.github.bricksentry/bricksentry -->
|
|
4
|
+
|
|
3
5
|
[](https://pypi.org/project/bricksentry/) [](https://pypi.org/project/bricksentry/) [](https://github.com/bricksentry/bricksentry/actions/workflows/ci.yml) [](https://github.com/bricksentry/bricksentry/actions/workflows/lint.yml) [](https://github.com/bricksentry/bricksentry/actions/workflows/ci.yml) [](LICENSE)
|
|
4
6
|
|
|
5
7
|
***The safety check for data changes in the AI era.***
|
|
@@ -58,11 +60,30 @@ AI now writes much of our pipeline code, and checking what that code does to the
|
|
|
58
60
|
|
|
59
61
|
## For AI agents: the MCP server
|
|
60
62
|
|
|
63
|
+
The quickest way to connect an agent is the `bricksentry-mcp` package, which installs bricksentry with its MCP and Databricks extras. With [uv](https://docs.astral.sh/uv/) there is nothing to install first:
|
|
64
|
+
|
|
61
65
|
```bash
|
|
62
|
-
|
|
63
|
-
claude mcp add bricksentry -- bricksentry
|
|
66
|
+
# Claude Code
|
|
67
|
+
claude mcp add bricksentry -- uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"bricksentry": {
|
|
74
|
+
"command": "uvx",
|
|
75
|
+
"args": ["bricksentry-mcp", "--config", "/full/path/to/bricksentry.yml"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
64
79
|
```
|
|
65
80
|
|
|
81
|
+
The JSON works for the Claude desktop app, Cursor and other MCP clients. Use a **full path** to `bricksentry.yml`, because clients start the server from their own working folder. If an app can't find `uvx`, use its full path (`which uvx`). To share the setup through a repo, `claude mcp add -s project ...` writes it to `.mcp.json`; a relative path then works when Claude Code starts from the repo root. No config yet? `uvx --from bricksentry bricksentry init` writes a starter one.
|
|
82
|
+
|
|
83
|
+
Already installed bricksentry with pip? `pip install "bricksentry[mcp,databricks]"` and run `bricksentry mcp --config /full/path/to/bricksentry.yml` instead. Add `--transport streamable-http` for remote agents.
|
|
84
|
+
|
|
85
|
+
bricksentry is listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.bricksentry/bricksentry) as `io.github.bricksentry/bricksentry`.
|
|
86
|
+
|
|
66
87
|
| Tool | What the agent gets |
|
|
67
88
|
|---|---|
|
|
68
89
|
| `whats_downstream(table, depth)` | Downstream assets with owners and tags. Call it *before* editing. |
|
|
@@ -88,6 +109,8 @@ To watch the whole loop, run `bricksentry demo` (see the top of this page). `bri
|
|
|
88
109
|
|
|
89
110
|
```bash
|
|
90
111
|
bricksentry init # starter bricksentry.yml + policy.yml
|
|
112
|
+
bricksentry init --policy finance # ...or start from a policy template
|
|
113
|
+
bricksentry policies # list the policy templates
|
|
91
114
|
bricksentry impact main.sales.orders # blast radius
|
|
92
115
|
bricksentry diff main.sales.orders main.sales_pr_42.orders
|
|
93
116
|
bricksentry preview main.sales.orders --sql "MERGE INTO {{target}} t USING updates u ON t.order_id = u.order_id WHEN MATCHED THEN UPDATE SET *"
|
|
@@ -124,12 +147,60 @@ Check out with `fetch-depth: 0` and give the job `pull-requests: write` permissi
|
|
|
124
147
|
Or use the bundled GitHub Action, which also writes the report to the job summary:
|
|
125
148
|
|
|
126
149
|
```yaml
|
|
127
|
-
- uses: bricksentry/bricksentry@v0.1.
|
|
150
|
+
- uses: bricksentry/bricksentry@v0.1.7
|
|
128
151
|
with:
|
|
129
152
|
config: bricksentry.yml
|
|
130
153
|
fail-on: needs_human
|
|
131
154
|
```
|
|
132
155
|
|
|
156
|
+
A complete workflow you can copy to `.github/workflows/bricksentry.yml`:
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
name: bricksentry
|
|
160
|
+
on: pull_request
|
|
161
|
+
|
|
162
|
+
permissions:
|
|
163
|
+
contents: read
|
|
164
|
+
pull-requests: write
|
|
165
|
+
|
|
166
|
+
jobs:
|
|
167
|
+
check-data:
|
|
168
|
+
runs-on: ubuntu-latest
|
|
169
|
+
steps:
|
|
170
|
+
- uses: actions/checkout@v4
|
|
171
|
+
with:
|
|
172
|
+
fetch-depth: 0
|
|
173
|
+
# Build this PR's version of your pipeline into a per-PR schema first,
|
|
174
|
+
# for example: databricks bundle deploy -t ci && databricks bundle run -t ci
|
|
175
|
+
- uses: bricksentry/bricksentry@v0.1.7
|
|
176
|
+
with:
|
|
177
|
+
config: bricksentry.yml
|
|
178
|
+
fail-on: needs_human
|
|
179
|
+
slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }} # optional
|
|
180
|
+
teams-webhook: ${{ secrets.TEAMS_WEBHOOK_URL }} # optional
|
|
181
|
+
env:
|
|
182
|
+
DATABRICKS_HOST: ${{ secrets.DATABRICKS_HOST }}
|
|
183
|
+
DATABRICKS_CLIENT_ID: ${{ secrets.DATABRICKS_CLIENT_ID }}
|
|
184
|
+
DATABRICKS_CLIENT_SECRET: ${{ secrets.DATABRICKS_CLIENT_SECRET }}
|
|
185
|
+
DATABRICKS_WAREHOUSE_ID: ${{ secrets.DATABRICKS_WAREHOUSE_ID }}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
To make the check binding, mark this job as a required status check in your branch protection rules. Then a `needs_human` or `block` verdict stops the merge, whatever the author or an agent decides.
|
|
189
|
+
|
|
190
|
+
### Alerts in Slack and Teams
|
|
191
|
+
|
|
192
|
+
When the verdict is `needs_human` or worse, bricksentry can post a short alert: the verdict, the rules that fired, who should review, and a link to the PR.
|
|
193
|
+
|
|
194
|
+
```yaml
|
|
195
|
+
# bricksentry.yml
|
|
196
|
+
notify:
|
|
197
|
+
on: needs_human # alert at this verdict or worse
|
|
198
|
+
slack_webhook: env:SLACK_WEBHOOK_URL # Slack incoming webhook
|
|
199
|
+
teams_webhook: env:TEAMS_WEBHOOK_URL # Teams Workflows "webhook request" URL
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Keep webhook URLs in secrets or environment variables, never in the file. `BRICKSENTRY_SLACK_WEBHOOK` and `BRICKSENTRY_TEAMS_WEBHOOK` work too. `assess` and `preview` send alerts automatically when a webhook is set (`--no-notify` turns them off), and in Python call `sentry.notify(assessment)`. A failed webhook is reported but never changes the verdict or fails the run.
|
|
203
|
+
|
|
133
204
|
## Python API
|
|
134
205
|
|
|
135
206
|
```python
|
|
@@ -157,7 +228,7 @@ tables:
|
|
|
157
228
|
keys: [order_id]
|
|
158
229
|
segment_by: [region]
|
|
159
230
|
paths: ["src/pipelines/orders/**", "resources/orders_job.yml"]
|
|
160
|
-
policy: policy.yml
|
|
231
|
+
policy: policy.yml # or builtin:<template>, see "Policy templates" below
|
|
161
232
|
```
|
|
162
233
|
|
|
163
234
|
### Policy example
|
|
@@ -191,6 +262,21 @@ rules:
|
|
|
191
262
|
|
|
192
263
|
If several rules match, the most severe one wins. The full starter policy is in [`examples/databricks/policy.yml`](examples/databricks/policy.yml), and `bricksentry init` writes one for you.
|
|
193
264
|
|
|
265
|
+
### Policy templates
|
|
266
|
+
|
|
267
|
+
Start from a ready-made policy instead of writing one:
|
|
268
|
+
|
|
269
|
+
| Template | For |
|
|
270
|
+
|---|---|
|
|
271
|
+
| `agent-safe` | Changes written by AI agents: anything beyond a small, clean change goes to a human |
|
|
272
|
+
| `default` | Balanced: block duplicate keys, a human for row loss, dropped columns, PII and certified downstream |
|
|
273
|
+
| `strict` | Production-critical pipelines: small changes need a human, failed checks block |
|
|
274
|
+
| `pii` | Tables with personal data: any change to a `pii`-tagged table, or one feeding it, needs a human |
|
|
275
|
+
| `certified` | Certified or gold tables that dashboards and AI rely on |
|
|
276
|
+
| `finance` | Revenue and money tables: totals can't move quietly, double counting is blocked |
|
|
277
|
+
|
|
278
|
+
Use one directly with `policy: builtin:finance`, or write an editable copy with `bricksentry init --policy finance`. `bricksentry policies finance` prints it. Tags come from Unity Catalog, so tag your tables `pii` or `certified` for those templates to apply.
|
|
279
|
+
|
|
194
280
|
### Policy conditions
|
|
195
281
|
|
|
196
282
|
`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`) · `any_change` · `diff_error`
|
|
@@ -215,7 +301,7 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
|
|
|
215
301
|
|
|
216
302
|
**Top priority: validation across more workspaces.** Classic and serverless compute, AWS, Azure and GCP, and workspaces with restricted system-table access. If you run the quickstart notebook, please [share what you see](https://github.com/bricksentry/bricksentry/issues), whether it works or not.
|
|
217
303
|
|
|
218
|
-
Next: Asset Bundle parsing for automatic table detection · column-level blast radius from `system.access.column_lineage` · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
|
|
304
|
+
Next: dbt support, so dbt models on Databricks get the same diff, blast radius and verdict (planned for 0.2) · Asset Bundle parsing for automatic table detection · column-level blast radius from `system.access.column_lineage` · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
|
|
219
305
|
|
|
220
306
|
## Contributing
|
|
221
307
|
|
|
@@ -20,6 +20,15 @@ inputs:
|
|
|
20
20
|
comment:
|
|
21
21
|
description: Post or update a PR comment with the report
|
|
22
22
|
default: "true"
|
|
23
|
+
slack-webhook:
|
|
24
|
+
description: Slack incoming webhook URL for verdict alerts. Pass it from a secret, e.g. secrets.SLACK_WEBHOOK_URL
|
|
25
|
+
default: ""
|
|
26
|
+
teams-webhook:
|
|
27
|
+
description: Microsoft Teams Workflows webhook URL for verdict alerts. Pass it from a secret
|
|
28
|
+
default: ""
|
|
29
|
+
notify-on:
|
|
30
|
+
description: Send an alert at this verdict or worse (pass, warn, needs_human, block)
|
|
31
|
+
default: needs_human
|
|
23
32
|
version:
|
|
24
33
|
description: bricksentry version spec to install (e.g. "==0.1.0"); empty = latest
|
|
25
34
|
default: ""
|
|
@@ -44,6 +53,9 @@ runs:
|
|
|
44
53
|
env:
|
|
45
54
|
BRICKSENTRY_PR: ${{ github.event.pull_request.number }}
|
|
46
55
|
GITHUB_TOKEN: ${{ github.token }}
|
|
56
|
+
BRICKSENTRY_SLACK_WEBHOOK: ${{ inputs.slack-webhook }}
|
|
57
|
+
BRICKSENTRY_TEAMS_WEBHOOK: ${{ inputs.teams-webhook }}
|
|
58
|
+
BRICKSENTRY_NOTIFY_ON: ${{ inputs.notify-on }}
|
|
47
59
|
run: |
|
|
48
60
|
set +e
|
|
49
61
|
BASE="${{ inputs.base-ref }}"
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# bricksentry-mcp
|
|
2
|
+
|
|
3
|
+
<!-- mcp-name: io.github.bricksentry/bricksentry -->
|
|
4
|
+
|
|
5
|
+
The MCP server for [bricksentry](https://github.com/bricksentry/bricksentry), the safety check for data changes in the AI era. This package only installs `bricksentry` with its MCP and Databricks extras and gives you one command, so agents can start the server with `uvx`:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Claude Code**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
claude mcp add bricksentry -- uvx bricksentry-mcp --config /full/path/to/bricksentry.yml
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Claude desktop, Cursor and other clients** (`mcpServers` config):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"bricksentry": {
|
|
23
|
+
"command": "uvx",
|
|
24
|
+
"args": ["bricksentry-mcp", "--config", "/full/path/to/bricksentry.yml"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use a full path to `bricksentry.yml`: clients start the server from their own working folder. If an app can't find `uvx`, use its full path (`which uvx`).
|
|
31
|
+
|
|
32
|
+
`bricksentry-mcp` accepts the same options as `bricksentry mcp`, for example `--transport streamable-http`. Docs: [bricksentry.org/docs/agents](https://bricksentry.org/docs/agents). License: Apache-2.0.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bricksentry"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.7"
|
|
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"
|
|
@@ -186,6 +186,17 @@ class Sentry:
|
|
|
186
186
|
out["preview"] = {"sandbox_table": clone if keep else None, "executed_sql": rewritten}
|
|
187
187
|
return out
|
|
188
188
|
|
|
189
|
+
# --- alerts ---------------------------------------------------------------
|
|
190
|
+
def notify(self, assessment: Assessment, pr: str | None = None, force: bool = False) -> list[str]:
|
|
191
|
+
"""Send a Slack / Teams alert for ``assessment`` if configured. Never raises."""
|
|
192
|
+
from bricksentry.notify import NotifySettings, send
|
|
193
|
+
|
|
194
|
+
try:
|
|
195
|
+
settings = NotifySettings.from_config(self.config.notify)
|
|
196
|
+
except ValueError as e:
|
|
197
|
+
return [f"notify: bad config ({e})"]
|
|
198
|
+
return send(assessment, settings, pr=pr, force=force)
|
|
199
|
+
|
|
189
200
|
# --- lookups for agents -------------------------------------------------
|
|
190
201
|
def get_assessment(self, assessment_id: str) -> Assessment | None:
|
|
191
202
|
return self._assessments.get(assessment_id) or self._load(assessment_id)
|