# One metric. One meaning. Everywhere.
## Cross-Consumer Semantic Execution Contract

**Metric name:**  
**Business owner / technical owner:**  
**Version / effective date:**  
**Business question(s):**  

## 1. Canonical definition
- **Calculation (including nulls, refunds, discounts, exclusions):**
- **Grain and join keys:**
- **Dimensions and allowed filters:**
- **Fiscal calendar, time zone and date cut-offs:**
- **Valid snapshot / freshness constraints:**
- **Access-control predicates and role scope:**
- **Known exceptions and caveats:**

## 2. Consumer matrix

| Consumer | Engine / query | User role | Same input snapshot? | Same metric version? | Execution evidence |
|---|---|---|---|---|---|
| SQL reference | | | | | |
| BI dashboard | | | | | |
| Application | | | | | |
| AI agent | | | | | |

## 3. Reproducible test suite

| Test ID | Dataset / scope | Expected result | SQL | BI | App | AI | PASS / FAIL |
|---|---|---|---|---|---|---|---|
| BASE-001: nominal scope | | | | | | | |
| REFUND-002: returns | | | | | | | |
| GRAIN-003: join duplication | | | | | | | |
| TIME-004: fiscal boundary | | | | | | | |
| AUTH-005: restricted region | | | | | | | |
| NULL-006: missing/late records | | | | | | | |

**Equality rule:** compare values only for equivalent business questions, data snapshots, temporal windows, roles and authorized scopes. Deliberately different scopes need explainable differences, not numerical equality.

## 4. Discrepancy investigation
- **Case ID and query artifacts:**
- **First divergence in the execution path:**
- **Incorrect definition, join, grain, scope, date, or freshness:**
- **Root cause / owner / fix:**
- **Regression test added:**

## 5. Change control
- **Metric version change and rationale:**
- **Downstream consumers to revalidate:**
- **Roll-back criteria:**
- **Who signs off on release:**

**Interactive synthetic demonstration:** https://himanshugaurav.com/metric-lab.html  
*Framework by Himanshu Gaurav · Not a production certification.*
