# Severity, priority, score and status

The script computes all of this; this file is the rule set behind it and the way to do it by hand. The status decides what happens next. The score shows how much is left per area. Neither is a compliance verdict.

## Verdicts

- FAIL: the configuration produces wrong data, sends data without permission, exposes a credential or breaks code, unless a valid exception exists.
- WARN: a plausible defect that needs a decision or a runtime check.
- PASS: the rule ran and found nothing, or found something correct (stated with the reason).
- INFO: context for the report; never scored.
- NOT CHECKED: the rule could not run (an input is missing); the report says why. Partial gaps inside a rule appear under "Not checked" with the rule ID.

## Priorities

Every FAIL and WARN carries one priority and one area.

- P1 critical: data sent without permission, exposed secrets, compromised code hosts, conversions recorded for non-events, personal data to GA4 or ad platforms, data excluded for good by a setting (debug_mode with an Active Developer traffic filter).
- P2 high: double counting, lost or misattributed conversions or revenue, wrong, unknown or retired destinations, broken references, dead key events.
- P3 medium: attribution and session quality, fragile wiring, performance, settings Preview cannot show.
- P4 low: hygiene, naming, documentation, consolidation.

## Areas and weights

- Consent and privacy, 25: R01, R02, R16, R21
- Conversions and counting, 25: R06, R07, R12, R15, R17, R18, R29
- Google tag and GA4 setup, 15: R03, R05, R08, R13, R19, R20
- Destinations and duplicates, 10: R04, R11, R23, R24
- Custom code and security, 10: R09, R22, R25, R26, R27
- Triggers, variables and data layer, 10: R10, R28, R30
- Versions, workspaces and naming, 5: R14, R31

## Deductions and score

- Base deduction per finding: P1 60, P2 40, P3 20, P4 10; a WARN deducts half.
- Each rule deducts once per area: its worst finding's deduction, plus 10% of that for each further finding of the same rule, capped at twice the worst. One noisy rule cannot sink an area on volume alone.
- Area percent: 100 times the product, over the area's rules, of (1 - rule deduction / 200). The largest possible rule deduction is 120 (a P1 FAIL at the cap), so one rule never takes an area below 40%, and every cleared finding raises its area.
- Overall score: the sum of weight times area percent divided by 100, rounded to a whole number.
- Not counted: PASS, INFO and NOT CHECKED lines (a workspace export's R14 line is INFO), findings covered by a valid exception, and findings refuted in the runtime evidence file.

## Status

- RED, act before any other container change: any P1 FAIL not refuted; or a P2 FAIL on a biddable conversion (Google Ads, Floodlight, a purchase, or an action with primary_for_goal true); or three or more P2 FAILs.
- AMBER, fix in the next release: any other P2 FAIL, or any P1 or P2 WARN.
- GREEN, schedule hygiene: only P3 and P4 findings.
- A skipped check never improves the status: a rule that could not run is NOT CHECKED, not PASS.

## Static and confirmed

- The label reads "static" until a runtime evidence file marks every P1 and P2 FAIL (not covered by an exception) confirmed or refuted; then it reads "confirmed".
- Evidence entries: `finding` (the exact ID), `status` (confirmed or refuted), `evidence` (what was seen and where the record is stored), `by` (a role), `date`, `approval` (for any live test). Template: [../assets/runtime-evidence-template.json](../assets/runtime-evidence-template.json).
- A refuted finding stays in the report with its evidence and leaves the score and status. An entry whose ID matches nothing is listed so a stale evidence file is visible.

## Exceptions

- An exception accepts a FAIL or WARN only when it cites a decisions.md entry, names who approved it and expires within 12 months of the audit date. Template: [../assets/exceptions-template.json](../assets/exceptions-template.json); the worked example's entries are in [../assets/example-acme-exceptions.json](../assets/example-acme-exceptions.json).
- An accepted finding keeps its FAIL or WARN verdict, is marked accepted in every format (text, md, csv, json) and leaves the score, the status and the exit code. Never change a verdict by hand in the report.
- Match by exact finding ID, or by rule plus an optional entity key (tag:6, trigger:15, variable:3, id:GA4 G-XXXXXXXXXX, container) and optional message text.
- Entries without a decision, an approver or a valid expiry are listed as not applied. Expired entries re-raise their findings with the note "exception expired".

## Exit codes for scheduled runs

- 0: no FAIL at or above `--fail-on` (default: no FAIL at all). 1: at least one. 2: bad input.
- Excepted and refuted FAILs never set the exit code. `--fail-on P1` makes a weekly run fail only on critical findings.

## Worked calculation (fictional Example Co container)

Findings: R01 FAIL P1 on two tags and WARN P2 on one; R02 WARN P2; R06 WARN P2; R12 FAIL P2 on a GA4 purchase tag; R03 FAIL P2; R11 WARN P3 twice; R10 WARN P4 three times; R31 WARN P4 once.

- Consent: R01 worst 60, three findings, 60 x 1.2 = 72, keeps 1 - 72/200 = 0.64; R02 WARN P2 = 20, keeps 0.90. Area 100 x 0.64 x 0.90 = 57.6%.
- Conversions: R06 WARN P2 = 20, keeps 0.90; R12 FAIL P2 = 40, keeps 0.80. Area 72%.
- Google tag: R03 FAIL P2 = 40, keeps 0.80. Area 80%.
- Destinations: R11 worst 10, two findings, 11, keeps 0.945. Area 94.5%.
- Custom code: nothing. Area 100%.
- Triggers: R10 worst 5, three findings, 6, keeps 0.97. Area 97%.
- Governance: R31 = 5, keeps 0.975. Area 97.5%.
- Score: 25 x 0.576 + 25 x 0.72 + 15 x 0.80 + 10 x 0.945 + 10 x 1.00 + 10 x 0.97 + 5 x 0.975 = 78.4, so 78/100.
- Status: RED, because of the P1 FAILs (and the R12 P2 FAIL is on a biddable purchase). Label: static until both R01 FAILs and the R03 and R12 FAILs have evidence entries.
- Read together: 78/100 says most areas are in reasonable shape; RED says the two consent failures come first. That is why the status, not the score, decides what happens next.

## Reading the score

- Every cleared finding raises its area, so the score tracks progress release by release. The Acme example scores 37 before and 43 after its first three fixes (CR-1 to CR-3), while its P1 FAILs fall from 11 to 8 and its status stays RED. Report the P1 and P2 counts beside the score.
- A high score can still be RED: one P1 FAIL is enough. Never present the score without the status.
- Compare scores only between runs with the same config: adding key events, plan events or an Ads export adds checks and can lower the score of an unchanged container.
- The score is not a privacy or legal verdict. Consent choices belong to the privacy owner; the audit checks configuration against the documented decision.

## Scoring by hand

1. List FAIL and WARN findings with rule, priority and area; drop excepted and refuted ones.
2. Per rule: take the worst deduction (P1 60, P2 40, P3 20, P4 10, halved for WARN), add 10% of it per extra finding, cap at twice.
3. Per area: multiply (1 - rule deduction / 200) over its rules and multiply by 100. Multiply each area by its weight, add the areas, divide by 100, round.
4. Apply the status rule, then the label rule. Write "scored by hand" next to the result.
