bricksentry
v0.1.36Safety check for AI agent and pipeline writes to Databricks tables, before they reach production.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
whats_downstream
List what depends on a table, so you know the blast radius BEFORE you edit it. Use this first, when planning a change. It reads Unity Catalog lineage and returns every downstream table, job, notebook, pipeline, dashboard and query, up to `depth` hops, with owners and tags. Dropped tables are filtered out. Pass `columns` when you will change specific columns to see the downstream columns they feed (column lineage) and whether any carry tags such as pii or certified. Read-only; changes nothing. To check a change you have already made, use assess_change instead.…
| Parameter | Type | Description |
|---|---|---|
table * | string | Fully qualified table name, e.g. main.sales.orders. |
columns | Optional columns you plan to change, e.g. ['email']. Adds the downstream columns they feed, with their tags, and the tags on these columns. | |
depth | integer | How many lineage hops to follow downstream (default 3). |
assess_change
Assess a change that has already been built into candidate tables. Use this after your pipeline change has written candidate (dev/PR) tables. For a single SQL write that has not run yet, use preview_write instead. For each table it diffs production against the candidate (row, column and schema changes, null-safe keys), walks downstream lineage and applies the rules in policy.yml. The verdict is deterministic: rules decide, not an LLM. Read-only on production and candidates. Returns {id, verdict: pass|warn|needs_human|block, risk_tier, safe_to_ship, notify, rul…
| Parameter | Type | Description |
|---|---|---|
tables * | array | Production tables your change affects, fully qualified. |
candidates | Optional map of production table -> candidate table your change built (e.g. {'main.sales.orders': 'dev.sales.orders'}). Omit to use the candidate pattern from bricksentry.yml. | |
pr | Optional pull request number or id, used to name candidates and the report. |
preview_write
Dry-run ONE write statement on a disposable shallow clone of `target`, never on production, and report what it would change plus the policy verdict. Use this before running any direct write. It clones the table, rewrites the statement to hit the clone, runs it, diffs clone vs production, applies policy and drops the clone, even on failure. DROP, TRUNCATE, ALTER, GRANT and multiple statements are refused. Returns the same shape as assess_change (with an `id` for safe_to_ship), or {error} if the statement is refused or fails.
| Parameter | Type | Description |
|---|---|---|
sql * | string | Exactly one INSERT, MERGE, UPDATE, DELETE or CREATE OR REPLACE TABLE statement. Write {{target}} where the table name goes, or use the literal name. |
target * | string | Fully qualified production table the statement would write to. |
keys | Optional key columns for the row diff. Omit to use keys from bricksentry.yml. |
explain_diff
Explain in plain English what a diff changed, for a PR description or a human reviewer. Use after assess_change or preview_write when you need readable text rather than raw numbers, e.g. "removed 1 row (0.00%); revenue sum -3.1%". Read-only. Works across processes because assessments are saved to disk. Returns {assessment_id, explanations: {table: text}} when given an id, or {table, explanation} when given a table, or {error} if nothing matches.
| Parameter | Type | Description |
|---|---|---|
assessment_id | Id returned by assess_change or preview_write. Give this or `table`. | |
table | Table name, to explain its most recent diff in this session. Give this or `assessment_id`. |
safe_to_ship
Final gate: decide whether to merge or apply a change. Call this last, and follow `next_step` exactly. safe_to_ship is true only for pass and warn. For needs_human, do not merge: open the PR with the report and request review from the listed owners. For block, stop and fix the issues in rule_hits. Never bypass needs_human or block. Read-only. Returns {assessment_id, safe_to_ship: bool, verdict, risk_tier, rule_hits: [{rule, verdict, table, reason}], notify, next_step}, or {error} if the id is unknown.
| Parameter | Type | Description |
|---|---|---|
assessment_id * | string | Id returned by assess_change or preview_write. |
rollback_plan
Get the exact SQL to restore `table` to its current Delta version. Call this BEFORE applying a change and keep the SQL (e.g. in the PR or job log), so undo is one statement if the change goes wrong. Read-only: it reads DESCRIBE HISTORY and runs nothing. Returns {table, current_version, rollback_sql}, e.g. "RESTORE TABLE main.sales.orders TO VERSION AS OF 42", or {error}.
| Parameter | Type | Description |
|---|---|---|
table * | string | Fully qualified Delta table name. |