Skip to content

fix(dv2): ClickHouse customer MDM views admit all source conventions (audit #M1)#108

Merged
brownjuly2003-code merged 1 commit into
mainfrom
fix/ch-customer-mdm-source-agnostic
Jun 29, 2026
Merged

fix(dv2): ClickHouse customer MDM views admit all source conventions (audit #M1)#108
brownjuly2003-code merged 1 commit into
mainfrom
fix/ch-customer-mdm-source-agnostic

Conversation

@brownjuly2003-code

Copy link
Copy Markdown
Owner

What

The five ClickHouse bv_customer_mdm__<branch> views filtered hub rows by a
hard-coded record_source = '1c__<branch>', silently dropping every OLTP- and
X5-promoted customer (record_source pg_ops__ / x5__) from the MDM result.

The PostgreSQL port fixed this in #99 (split_part); the ClickHouse half was
left behind — a CH/PG split-brain (audit_28_06_26 #M1). The postgres_oltp
README already documented the splitByString('__', record_source)[2] admission
that the views did not actually implement.

Change

  • 5 views (bv_customer_mdm__{msk,spb,ekb,dxb,ala}.sql): swap the hub
    admission filter to splitByString('__', record_source)[2] = '<branch>' (the
    ClickHouse equivalent of the PG split_part fix). View DDL only —
    customer_hk = md5(business_key) is identical across loaders, so no data
    migration. Per-branch PII jurisdiction (RBAC on the view) is preserved.
  • New tests/unit/test_dv2_business_vault_ddl.py: the CH business-vault
    views had no parse or coverage at all. Pins that every view parses under
    sqlglot's ClickHouse dialect and that all five MDM views admit by branch,
    never by 1c__ again — symmetric to the PG regression test.

Verification

  • no-Docker: ruff check + format clean; 28 tests pass (3 new CH + 25 PG
    DDL); sqlglot parses all 7 CH business-vault views.
  • live ClickHouse (clickhouse local, no Docker): seeded CUST-A via
    1c__msk and CUST-B via pg_ops__msk; the fixed view returns both
    (2 rows), the old hard-coded filter returns only CUST-A (1 row). The
    counterfactual confirms the fix admits the OLTP-promoted customer the bug
    dropped — the ClickHouse mirror of the live-PG proof in fix(dv2): port customer MDM views to PostgreSQL with branch-agnostic hub filter (audit #12) #99.

…(audit #12)

The five ClickHouse bv_customer_mdm__<branch> views filtered hub rows by a
hard-coded record_source = '1c__<branch>', silently dropping every OLTP- and
X5-promoted customer (record_source pg_ops__/x5__) from the MDM result. The
PostgreSQL port fixed this in #99 (split_part); the ClickHouse half was left
behind as a CH/PG split-brain (audit_28_06_26 #M1), and the postgres_oltp README
already documented the splitByString admission the views did not implement.

Swap the hub admission filter to splitByString('__', record_source)[2] =
'<branch>' (the ClickHouse equivalent of the PG split_part fix), so a customer
promoted under any source convention is integrated. View DDL only - customer_hk
= md5(business_key) is identical across loaders, so no data migration.

Add tests/unit/test_dv2_business_vault_ddl.py: the CH business-vault views had no
parse or coverage at all. Pins that every view parses under sqlglot's ClickHouse
dialect and that all five MDM views admit by branch, never by '1c__' again.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

DORA Metrics

  • Window: last 30 days
  • Branch: main
  • Deployment frequency: 162 total / 37.8 per week
  • Lead time for changes: avg 0.27h / median 0.0h
  • Change failure rate: 56.79% (92/162)
  • MTTR: 0.25h across 3 incident(s)

@brownjuly2003-code brownjuly2003-code merged commit 9953849 into main Jun 29, 2026
19 checks passed
@brownjuly2003-code brownjuly2003-code deleted the fix/ch-customer-mdm-source-agnostic branch June 29, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants