Acme Marketing Architecture

Architecture Review — Simplicity Grade

Architecture Review — Simplicity Grade

Reviewer: Architecture review of SmallBusinessGrade/ (documents, diagrams, Python reference implementation) Date: 2026-11-06 Scope: README.md, Architecture/01, Architecture/02, Architecture/diagrams/, src/ (adapters, storage, silver/gold, tests) Method: read every document and source file, ran the test suite (3 passed), attempted pip install -e ., and checked the external-API claims against vendor documentation.

The findings below describe v1.0 as reviewed on 2026-11-06. The High and Medium findings were then remediated in v1.1; the outcome is in section 1.1. Each finding names where it was fixed. Severity: High = the claim or design is wrong and would mislead a reader or lose data; Medium = inconsistent or under-specified; Low = polish.


1. Verdict

The design idea is sound and fits a mid-market team: serverless containers, an adapter per source, immutable landing, Delta tables, a Python-first transform. The documents are well written and the trade-offs against the Enterprise grade are clear.

It is not yet defensible as a complete architecture, for four reasons:

  1. The serving story contradicts the thesis (Power BI "Direct Lake" is a Fabric feature) and no serving layer is actually chosen.
  2. The GDPR story overclaims. Plaintext names stay in Silver, Bronze/landing erasure is unspecified, and a global salted hash is pseudonymisation, not anonymisation.
  3. The reference implementation does not implement what the documents promise (no MERGE, no paging loop, no token-bucket, a stub Google Ads adapter) and contains two data-loss bugs.
  4. Cloud, orchestrator hosting and table format are left open ("Azure or AWS or GCP", "Dagster or Prefect", "Delta or Iceberg"), which an architecture document should decide.
# Area Severity Finding
F1 Serving High "Direct Lake" and "DirectQuery from Gold Delta" are not available outside Fabric
F2 GDPR High Silver keeps plaintext names; "zero plaintext identifiers" is false
F3 GDPR High Erasure does not cover Bronze, landing replay, or source-initiated deletes
F4 Code High Salesforce LIMIT 2000 silently truncates extraction
F5 Code High Google Ads Silver de-duplication keeps the oldest value, defeating restatement
F6 Consistency High Retention 14 days vs. replay, 90-day restatement and backfill
F7 Cost Medium Orchestrator is not scale-to-zero; run-time estimate is optimistic
F8 Cost Medium Fabric comparison uses only F8/F16 and ignores pause and smaller SKUs
F9 Code Medium Documented MERGE, token bucket, paging loop and OAuth refresh do not exist
F10 Code Medium Google Ads adapter is a stub on a retired API version
F11 Docs Medium Bronze exists in the prose but not in the C4 view or the code
F12 Docs Medium Open choices: cloud, orchestrator, table format, PySpark vs. delta-rs
F13 Ingestion Medium HubSpot webhook receiver and rate limits are mis-specified
F14 Data model Medium No attribution model; fact_attribution and dim_customer are unspecified
F15 Cross-cutting Medium No environments, CI/CD, IaC, DR, network security or data-quality design
F16 Packaging Low pip install -e . fails; docs inconsistencies and leftovers

v2.0 note (simplification). After v1.1 the client profile was clarified: a marketing company that needs a simple architecture. v2.0 therefore switched the recorded default cloud to Google Cloud and removed the heavier v1.1 additions: the Dagster server and its PostgreSQL database, the webhook receiver and queue, private endpoints, two environments and five of the eleven ADRs. This review is kept as history of v1.0. ADR numbers and mechanisms named in the tables below refer to v1.1; v2.0 has ADR-S01 to S06 (mapping in 02-Architectural-Rationales.md). Several findings are now closed by removing the component rather than by fixing it: F7 (orchestrator cost and scale-to-zero), F11 (Bronze), F13 (webhook receiver), and most of F15 (kept as a short operations section). F1 (serving) is closed by BigQuery instead of Power BI Import. The code fixes (F4, F5, F9, F10 and the two extra defects) and the privacy design (F2, F3, F6) are unchanged.

1.1 Remediation status (v1.1, 2026-11-06)

High and Medium findings (F1 to F15) were addressed in the documents and the reference code; F16 was cleaned up as well. The test suite grew from 3 to 23 tests and passes. "Open" means a confirmation or a live validation is still needed.

# Status What changed Still open
F1 Fixed (design) Direct Lake and DirectQuery claims removed; Power BI Import chosen, SQL engine as an upgrade path (Architecture/01 s10, ADR-S09) Proof of concept for the Delta connector and refresh time
F2 Fixed Names dropped from Silver; keyed HMAC; no default key (fails closed); field classification table; "pseudonymisation, not anonymisation" stated; no routine key rotation DPO sign-off on the classification
F3 Fixed Erasure ledger and erase_subject (code, tested); runbook covers landing, Silver, Gold, vacuum, serving; source-initiated deletes feed the ledger; Bronze removed DPO confirmation of the one-month assumption
F4 Fixed LIMIT removed; nextRecordsUrl followed; regression test with 2,001 records
F5 Fixed Newest ingestion wins, independent of file order; regression test
F6 Fixed (proposed) Landing retention 21 days, vacuum 7 days, worst-case erasure 28 days (ADR-S10) Architect to confirm the 21 days
F7 Fixed (docs) One cost model, about $50 to 100 per month, orchestrator shown as always-on, run profile stated Validate with the Azure Pricing Calculator
F8 Fixed F2/F4/F8/F16 comparison; saving restated as roughly 3 to 10 times; build and run effort stated Confirm current Fabric list prices
F9 Mostly fixed Delta MERGE with newest-wins and tombstones, token bucket, paging loop, retries on network errors, max_retries honoured, 401 refresh, watermark driver, extract_historical Dagster wiring, ADLS sink, Key Vault client and reconciliation job are described, not coded
F10 Partly fixed Real searchStream call, OAuth refresh, configurable API version (default v21), trailing window; Salesforce version configurable Never run against a live account; mocked contract tests only
F11 Fixed Bronze removed from the design; landing is the raw layer
F12 Fixed (proposed) Azure, Dagster self-hosted, Delta with delta-rs, no Spark, no Prefect (ADR-S02, S07, S08) Architect to confirm the Proposed ADRs
F13 Fixed Webhook receiver and queue added to C4; 5 requests per second, page size 200 shared constant; contacts use lastmodifieddate; requested properties list added Verify property names against a live portal
F14 Specified Gold model, keys, campaign_key, attribution rule and join identifiers (Architecture/01 s11); dim_campaign and fact_daily_spend use the composite key fact_attribution not built; needs marketing input on rule and gclid/UTM capture
F15 Fixed (docs) Section 15 and ADR-S11: environments, CI/CD, IaC, identity, network, DR, data quality, drift, monitoring No IaC or pipeline files written yet
F16 Fixed pip install metadata builds; README, placeholder e-mail, deprecated utcnow, LaTeX arrows, diagrams aligned with the code

Two defects were found while fixing and were not in the original review:


2. Findings

F1 — Serving layer contradicts the thesis (High)

F2 — Silver keeps plaintext identifiers (High)

F3 — Erasure is incomplete (High)

F4 — Salesforce extraction truncates silently (High, code)

adapters/salesforce.py appends LIMIT 2000 to the SOQL. The REST query endpoint returns done: true as soon as the limited result set is delivered, so for a window with more than 2,000 changed records the adapter returns the first 2,000, sets has_more = False, and the watermark advances. The rest is lost without an error.

nextRecordsUrl is read but never used. Fix: drop the LIMIT and follow nextRecordsUrl until done, or use Bulk API 2.0 for large windows (as the document claims). Add a test with a 2,001-record fixture.

F5 — Google Ads Silver keeps the oldest row (High, code)

process_google_ads_performance calls drop_duplicates(subset=["campaign_id","metric_date"]), which keeps the first row seen. The architecture exists to absorb restatements (a trailing 30-day pull re-delivers the same day with newer numbers). Which copy wins depends on file read order, so stale metrics can win. process_hubspot_contacts sorts by updated_at before de-duplicating; the ads path has no equivalent, and ad rows carry no source version at all (only _batch_id).

Fix: order by _ingested_at (or batch time) descending and keep the newest, or do the Delta MERGE the document describes with "newest wins". Add a restatement test.

F6 — Retention rules contradict recovery rules (High)

F7 — Cost model is optimistic (Medium)

F8 — The Fabric comparison is a narrow comparison (Medium)

The "capacity trap" argument prices only F8/F16 at "€1,150–2,300". Smaller SKUs (F2, F4) exist, and capacities can be paused or scheduled; also, Fabric includes the SQL endpoint, Power BI Direct Lake, governance and managed Spark that this design has to build or buy separately. Re-check the euro figures against the current Azure pricing page before quoting them, and compare like-for-like (F2/F4 with pause, plus the missing serving layer from F1). The conclusion (serverless is cheaper at this volume) is probably still right, but the document should show that it survives the strongest version of the alternative.

F9 — Documented mechanisms do not exist in the code (Medium)

Claim in documents Reality in src/
Delta Lake MERGE INTO into Silver (01 §5.2) No Delta write anywhere. deltalake is a dependency but never imported. Silver functions return pandas DataFrames.
Token-bucket rate limiting (02 ADR-S04, 01 §8) Only retry with backoff. No limiter.
Full paging loop, extract_historical, _apply_retry_backoff, _write_to_landing_storage, ISourceAdapter (ADR-S04 and diagrams §3) extract_window performs one fetch and returns has_more; nothing loops. The other methods and the interface do not exist.
max_retries constructor parameter Ignored; the decorator hard-codes 5 attempts.
Retry on transient errors Only HTTP 429/5xx. requests.ConnectionError and Timeout are not retried. The 429 path sleeps Retry-After and then also waits the tenacity backoff.
OAuth token refresh Salesforce and Google tokens are static constructor arguments; they expire.
Secrets in Key Vault Tokens are passed as plain strings; no secret provider abstraction.
Watermark store and safety lag Watermark model exists, nothing reads or writes it.
Reconciliation notebook with 0.05 % threshold Not implemented; also hard to apply uniformly (Google Ads has no cheap source-side record count, and source counts differ from Silver counts after de-duplication and deletes). Define the reconciliation per source.

The reference code is described in README.md as "production-grade". It is a good illustration of the adapter pattern; call it a reference skeleton until the above exists. datetime.utcnow() is deprecated (Python 3.12+); use datetime.now(timezone.utc).

F10 — Google Ads adapter is a stub on a retired API (Medium)

GoogleAdsAdapter._fetch_records returns a single hard-coded record regardless of input; test_connection always returns True. The base URL is …/v16. Google retires each API version about a year after release; v16 was scheduled to sunset in early 2025 (Google's schedule was tentative), and v20/v21 are the current versions (Google Ads API sunset dates). The document also repeats "Basic Developer access, 15,000 operations/day"; check the current access-level limits before quoting them. Salesforce is pinned to v60.0 (Spring '24); pin a current version and add the version to the configuration, not the code.

F11 — Bronze exists in prose only (Medium)

01 §2 defines Landing → Bronze Delta → Silver; the C4 container diagram has no Bronze container and the code reads landing JSONL straight into Silver. Decide: either drop Bronze (landing is the raw layer; simpler, and removes one PII store from F3) or keep it and add it to the C4 view and the code. The word "Bronze" in the README's comparison table (Enterprise has Bronze) invites the question. The same sequence diagram in 01 §6 still says "OneLake / S3 Storage", a Fabric leftover.

F12 — Open choices that an architecture should close (Medium)

F13 — HubSpot webhooks and rate limits (Medium)

F14 — No attribution model (Medium)

The Gold layer promises dim_campaign, dim_customer, fact_ad_spend, fact_attribution. Only dim_campaign and a daily-spend fact exist in code. The business value of the platform is joining ad spend to CRM outcomes, and the documents never state the join key: gclid/UTM capture in HubSpot and Salesforce, campaign-ID mapping across Google Ads, HubSpot and Salesforce, the attribution rule (first touch, last touch, windowed), and how restated spend flows through. dim_campaign is keyed by campaign_id alone and will collide across channels; it needs a surrogate key or a (channel, campaign_id) key.

F15 — Cross-cutting concerns not covered (Medium)

Nothing is said about: dev/test/prod environments and promotion; CI/CD for the container image and pipeline code; infrastructure as code; network isolation (private endpoints for storage and Key Vault); identity and RBAC (workload identities, who may read PII-bearing zones); backup and disaster recovery (Delta time travel and VACUUM are not backups; enable object versioning and soft delete); data-quality checks beyond schema (freshness, null rates, row-count bounds); schema-drift handling in practice (what happens to an unknown field); logging, metrics and SLOs; runbooks. The Enterprise grade covers these; a lean architecture may do less, but it should say what it does instead.

F16 — Packaging and polish (Low)


3. What is good (keep)

  1. Correct before showing a client: F1, F2, F3 (text), F6; reconcile the cost figures (F7).
  2. Fix the two data-loss bugs and add tests: F4, F5.
  3. Close the open choices with ADRs: cloud, orchestrator, table format, serving layer, landing retention (F12, F1, F6).
  4. Make the skeleton match the claims or reword the claims: F9, F10, F11, F13, F14.
  5. Add the missing cross-cutting section: F15.
  6. Polish: F16.

5. Open questions for the architect