# Marketing Reporting Automation — Workflow Blueprint

## Trigger and termination

- **Trigger:** reporting cut-off reached with an approved report definition and source manifest.
- **Success:** a named owner approves a report whose tables, definitions, scope notes and exceptions trace to source records.
- **Safe stop:** missing required source, incompatible metric scope, identifier mismatch, unauthorized data, unexplained material variance or unavailable reviewer.

## Data contracts

Input: report ID, period, time zone, campaign register version, metric dictionary version, source file identifier, retrieval time, attribution model and permitted fields. Output: normalized observations, validation results, exception ledger, draft commentary, approval and published version. Do not include personal-level data when aggregate evidence answers the reporting job.

## Ordered steps

1. **Trigger — freeze period:** create one report run and reject duplicate delivery.
2. **Code — validate sources:** check presence, schema, scope, counts, identifiers and freshness.
3. **Code — normalize:** retain raw source values and produce mapped values with rule version.
4. **Code — reconcile:** compare totals only at compatible scope and publish differences.
5. **AI judgment — draft bounded notes:** summarize visible changes and exceptions with source references; abstain from causal claims.
6. **Human approval — interpret:** approve, edit, qualify or reject conclusions and next actions.
7. **Code — publish approved version:** write the immutable report artifact and correction link; no unverified connector is implied.

## Retry, idempotency and recovery

Use report ID plus period as the run key. A repeated source delivery updates source state but does not create a second published report. Reconcile an unknown publish state before retry. Keep the prior approved version available and publish corrections as new versions rather than overwriting evidence.

## Tests and acceptance

Test complete sources, late source, identifier mismatch, incompatible scopes, duplicate delivery, attribution-model change, modeled/unavailable data, reviewer rejection and correction. Acceptance requires traceable source rows, visible scope and attribution notes, zero unsupported causal claims, complete exception ownership and one approved published version.
