Skip to content

Latest commit

 

History

History
124 lines (98 loc) · 3.47 KB

File metadata and controls

124 lines (98 loc) · 3.47 KB
title Rules
description Contract-level rules for customising how DriftGuard evaluates schema changes.
Contract rules are **not yet implemented** in the current version of DriftGuard. The severity scoring described in this section reflects planned behaviour. Today, all checks use the default scoring logic regardless of any rules you define. See [Severity Levels](/concepts/severity-levels) for the current fixed scoring formula.

Rules will let you customise how DriftGuard evaluates schema changes on a per-contract basis. Once implemented, you'll set them in the schema object when creating a contract.


Planned Rules

{
  "rules": {
    "allow_additional_columns": false,
    "treat_renames_as_breaking": true
  }
}
Rule Type Planned Default Description
allow_additional_columns boolean false If true, new columns in the incoming schema will not contribute to the severity score. If false, each new column adds +5 points.
treat_renames_as_breaking boolean true If true, a detected rename is treated as a removal (+40) plus an addition (+5). If false, it adds fewer points.

Planned Rule Behaviour

Strict Contract (Planned Default)

Recommended for production tables where any unexpected change should be flagged:

{
  "rules": {
    "allow_additional_columns": false,
    "treat_renames_as_breaking": true
  }
}
  • New columns → contribute +5 points each toward severity
  • Renames → treated as a removal + addition, pushing toward breaking

Flexible Contract

Recommended for partner feeds or raw ingestion layers where extra columns are expected and acceptable:

{
  "rules": {
    "allow_additional_columns": true,
    "treat_renames_as_breaking": false
  }
}
  • New columns → ignored, no severity points added
  • Renames → treated more leniently

Recommended for dbt Models

{
  "rules": {
    "allow_additional_columns": false,
    "treat_renames_as_breaking": true
  }
}

dbt model outputs should be fully predictable. Any unexpected column addition or rename should contribute to severity scoring.


Current Behaviour (No Rules)

Until rules are implemented, all checks use this fixed scoring formula regardless of contract configuration:

Change Type Points
Required column removed +40
Optional column removed +20
Column type changed +30 per column
New column added +5 per column
Score capped at 100

See Severity Levels for how the score maps to pass, warning, and breaking.


Per-column severity overrides are also on the roadmap — this will let you mark specific columns as `ignore`, `warning-only`, or `breaking-only` regardless of change type. Want to be notified when rules go live? Watch the [Changelog](/changelog) or follow [@naveenbale](https://twitter.com/naveenbale) on X.
See the current fixed severity scoring formula in full detail. Create a contract with the current supported fields.