Application Architecture (Phase C)
Application Architecture (Phase C)
Decisions: ADR 3, ADR 7, ADR 8. Diagram: C4 container.
Component catalogue
| # | Component | Responsibility | Technology | Triggered by | Writes to | Failure handling |
|---|---|---|---|---|---|---|
| 1 | Orchestrator | Read registries, schedule per tier, fan out per object, call extractors and jobs, write ledger, reframe models | Fabric Data Factory pipelines | Schedules; Activator (job events, reload requests) | control.* |
Activity retries; failed object does not block siblings; alert on failure |
| 2 | Salesforce copy activity | Incremental and historical extraction of Salesforce objects, landed as files so the Bronze loader applies the same dedupe and provenance as for every other source | Fabric copy activity (Salesforce objects connector, organisational-account consent) writing to Lakehouse Files | Orchestrator | OneLake landing files, then lh_bronze via the Bronze
loader |
Connector retry; run marked failed; next run resumes from the pipeline-managed watermark |
| 3 | Salesforce CDC consumer (phase 2) | Subscribe to change events, persist replay id, land events | Azure Function (.NET, Pub/Sub API gRPC client) | Continuous | bronze.sf_cdc_event,
control.page_cursor |
Reconnect with stored replay id; if the id expired (> 72 h), log a gap and rely on polling |
| 4 | HubSpot adapter | List, search and batch-read CRM objects; associations; events API; count for reconciliation | Azure Function (.NET 10 isolated, Flex Consumption) | Orchestrator (Web activity) | OneLake landing files; page cursors and requests used in adapter state (Table Storage) | Paced per-caller limiter (at most its share of the portal budget in
any rolling 10 s); Retry-After; cursors per page; async
status for long windows |
| 5 | HubSpot webhook receiver | Validate v3 signature, acknowledge, enqueue ids | Azure Function (HTTP) | HubSpot | Service Bus queue ingest-nudges |
Invalid signature → 401 and log; queue unavailable → 503 so HubSpot retries |
| 6 | Nudge worker | Batch-read nudged ids, land them | Azure Function (Service Bus session trigger; one session per portal, so one consumer is in flight) | ingest-nudges (session-enabled) |
OneLake landing; nudge log in adapter state | Dead-letter after retries; missed records caught by polling |
| 7 | Google Ads adapter | Entity snapshots, performance reports with trailing windows,
change_event |
Azure Function (.NET 10 isolated, Flex Consumption, REST
searchStream; runtime pending the WP0b PoCs) |
Orchestrator | OneLake landing | Quota tracking; per-account serialisation; partial account failure isolated |
| 8 | Bronze loader | The anonymisation gate and the only writer of Bronze: manifest check, classification check (unclassified column fails), PII scan, vault tokenisation (batched lookup-or-create), payload rewrite, generalisation, dedupe, provenance, landing purge after 7 days | Fabric notebook (Python; Spark for large runs) | Orchestrator | lh_bronze, control.quarantine; reads and
writes the token vault |
Hard fail before any write on gate violation; idempotent re-run per
run_id; vault outage delays (landing retained) |
| 9 | Silver jobs | Parse, type, conform, MERGE current state, SCD2 history, quality gates | Fabric notebooks, one per object family | Orchestrator | lh_silver, control.quarantine,
control.schema_drift |
Partition-level failure; quarantine |
| 10 | Gold jobs | Tier 1 event job every 15 minutes (rules over the Silver change
feed, insert-if-absent into business_event) and the star
build (hourly for Tier 1 facts, nightly for the rest: dimensions, facts
rebuilt per date with replaceWhere, allow-list, OPTIMIZE).
Both run in the restricted workspace and write across workspaces into
lh_gold |
Fabric notebooks (Python for events, Spark for the star build) | Orchestrator | lh_gold |
Hard fail on an unknown column; deterministic event ids and day-level rebuilds make re-runs no-ops |
| 11 | Reconciler | Source counts vs Silver, hash samples, intra-lake counts; schedule reloads | Fabric notebook calling extractors' count endpoints | Orchestrator (daily, weekly) | control.reconciliation_result,
control.reload_request |
Budget-aware; skips when budget is low and reports |
| 12 | Relay | Read CDF since last version, publish to Service Bus topic, advance cursor | Fabric notebook (Python) | After each event job and star build | Service Bus data-changed,
control.outbox_cursor |
At-least-once; consumers dedupe on event_id |
| 13 | Webhook dispatcher | Deliver events to registered endpoints with signature, retry, DLQ | Azure Function (Service Bus subscription trigger) | data-changed subscription |
Subscriber endpoints; delivery log and subscriber registry in adapter state | Exponential retry; dead-letter; subscriber auto-pause after N failures |
| 14 | Push gateway | Server-Sent Events (and SignalR if needed) for dashboards | ASP.NET Core (.NET 10) on Azure Container Apps or App Service | data-changed subscription |
Browser clients | Reconnect with Last-Event-ID; no durability (bus has
it) |
| 15 | Activator rules | Teams and email notifications; trigger Fabric items on events and job failures | Fabric Activator via eventstream from Service Bus and Fabric job events | Events | Teams, email, pipelines | Fabric-managed |
| 16 | Semantic models | Direct Lake models over Gold | Power BI | Reframe after Gold | — | Guardrail check in release |
| 17 | Operations dashboard | Freshness, reloads, reconciliation, budget, deliveries (ADR 12, Proposed, would replace it with the operations console; unchanged until accepted) | Power BI over control |
— | — | — |
| 18 | Secrets and identity | Credentials, keys, managed identities | Key Vault, Entra ID | — | — | Rotation runbook |
| 19 | State sync | Mirror adapter state (page cursors, nudge log, delivery log,
subscriber registry, requests used) from Table Storage into
control.*; roll requests into api_budget |
Fabric notebook (Python) | Orchestrator (hourly) | control.* |
Idempotent upsert by key |
| 20 | Token vault | token_map and subject_link: lookup hash,
random token, encrypted identifier, subject type, jurisdiction,
erased_at; the only place erasure must succeed (ADR
6) |
Azure SQL Database, TDE with customer-managed key, Entra-only, PIM, auditing | Bronze loader (lookup-or-create), erasure job (delete, reverse lookup), reconciler (lookup only, for the weekly hash samples) | — | S1 at launch, zone-redundant General Purpose serverless if the vault SLA requires it (technology architecture); geo-backup on a short clock; outage delays ingestion, never loses data |
| 21 | Erasure job | Path A: delete the subject's mapping; Path B: rewrite landing files, purge logs if ever needed; verify per store; append the evidence record; write the summary | Fabric pipeline and notebook (Python) | DPO through a pipeline with an approval step | Token vault, landing files, evidence store,
control.erasure_log |
Re-runnable; evidence appended per attempt |
| 22 | Erasure evidence store | Append-only evidence records with a hash chain | Azure Blob Storage, immutable storage (time-based retention) | Erasure job | — | Immutable by policy; DPO read access |
| 23 | Report generator | Render versioned report definitions from Gold at pinned Delta
versions; write files to Files/publications; write the
publication manifest (ADR
11) |
Fabric notebook (Python) | Orchestrator (cadence; metrics.restated) |
lh_gold Files,
control.publication_log |
Deterministic per definition version and pinned versions; re-run reproduces the file |
| 24 | Approval workflow | Route a generated publication to the named approver; record approve or reject with who and when; return the decision | Power Automate approvals in Teams | Orchestrator | control.publication_log via the orchestrator |
Reminders and escalation; no delivery without an approved row |
| 25 | Delivery adapter | Deliver approved files over the recipient's contracted channel (SFTP, HTTPS API, email, Power BI app); flag original or revision; record evidence | Azure Function (.NET 10) | Orchestrator | Recipient endpoints; delivery evidence in adapter state | Retry with backoff; dead-letter; alert |
Source adapter contract (AP-01)
Every extractor, built or bought, exposes the same operations to the orchestrator (HTTP for Functions; parameters for copy activities and dataflows):
describe(object) -> schema, business key, version column, delete detection
extract_full(object, partition) -> landing files + manifest {rows, pages, cursor_end}
extract_incremental(object, window, cursor?) -> landing files + manifest {rows, pages, cursor_end, truncated?}
count(object, window) -> source-side count for reconciliation
receive_change(payload) -> optional; enqueue nudge or land event
truncated? must be true when a source cap was hit that
the adapter could not page around (HubSpot keyset paging never hits the
10,000 cap; Google Ads change_event does at
LIMIT 10000), so where a split is defined (Google Ads
change_event) the adapter halves the window and reruns
inside the same run, down to min_window_seconds, and
records the windows actually used in the manifest; a window that still
truncates at that floor, and any truncated window where no split is
defined (HubSpot offset mode), fails the run with the watermark
unchanged; the orchestrator never splits windows itself, and the run is
not landed while any window is truncated (findings C28,
C36).
Interaction overview
- Schedule fires for a tier → orchestrator reads
object_registryandwatermark, checksapi_budget. - For each object: extractor runs for
(watermark, now − safety_lag); manifest returned; Bronze loader promotes; ledger updated; watermark advanced onlanded. - Silver jobs for the touched objects; the Tier 1 event job every cycle and the star build hourly or nightly; the Gold allow-list enforced in both.
- Relay publishes new CDF versions; dispatcher, push gateway and Activator consume.
- Reconciler runs on its own schedule; discrepancies become
reload_requestrows; the orchestrator picks them up. - Report definitions run on their cadence: generate from pinned Gold
versions, sign-off, delivery, evidence. A
metrics.restatedevent for a published period triggers a superseding revision through the same steps. - A verified erasure request runs the erasure job: vault delete, landing rewrite, per-store verification, evidence record.
Sequences: publish and restate, erasure.
Sequences: HubSpot webhook plus poll, reload and reconcile, downstream notification.