Skip to content

feat(ingestion): bootstrap-db — generate connectors-ddl snapshot [WIP] - #1876

Closed
mitasovr wants to merge 3 commits into
mainfrom
claude/connectors-ddl-1831
Closed

feat(ingestion): bootstrap-db — generate connectors-ddl snapshot [WIP]#1876
mitasovr wants to merge 3 commits into
mainfrom
claude/connectors-ddl-1831

Conversation

@mitasovr

@mitasovr mitasovr commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What & why

Replaces the hand-written create-bronze-placeholders.sh (ADR-0007) with a
generated DDL snapshot in scripts/connectors-ddl/*.sql, dumped by
bootstrap-db from real connectors + dbt + migrations. create-bronze-placeholders.sh
is now a thin applicator of that snapshot, so a fresh cluster type-checks every
gold view without a hand-maintained placeholder list (#1831), and a fresh cluster
builds end-to-end (#1763). All environments are on ClickHouse 25.7.5 (test/compose
pins bumped to match).

Merges upstream/main, including the bitbucket-cloud dbt fix (#1880).

Generation pipeline / prod

  • Order fix: person/identity (init-identity) are created before dbt so the
    identity seed models' ANTI JOIN person.persons resolves; gold-view migrations run
    after dbt.
  • CH 25.7 identity fixes (also fixes identity on dev/virtuozzo):
    • allow_experimental_correlated_subqueries set at profile level in all four dbt
      profile generators — a model config() setting does not reach the SELECT plan.
    • identity seed join key cast to toUUID(...) (String vs UUID NO_COMMON_TYPE).
  • dump-ddl also emits person/identity and only the gold-referenced staging
    tables (today just m365__collab_email_activity) — deliberately not all of staging:
    pre-creating an incremental staging model empty poisons its first is_incremental
    build (max(date) FROM {{ this }} over an empty MergeTree reads the Date type-max on
    25.7 and excludes every row).
  • SKIP_DBT_GOLD lets generation skip apply-ch-migrations' own gold build (gold is
    already built by the pinned dbt venv; avoids requiring dbt on PATH — absent /
    dbt-fusion outside the prod toolbox). Prod deploy leaves it unset.
  • The warm-cluster Bitbucket bronze reconcile from fix(git): de-shadow completed_at alias in Bitbucket staging models (ILLEGAL_AGGREGATION) #1880 is relocated into the
    apply-ch-migrations heal section (create-bronze-placeholders is now the applicator).

e2e rig (unified metrics)

  • _ensure_table accepts the real table being a superset of the fixture schema
    (connectors emit raw API columns the dbt models never read); seeder Decimal coercion +
    jira fixture schema/value alignment to the real bronze.
  • Declarative skip: in *.test.yaml.

Testing

Follow-ups

  • git_metrics e2e is skipped: its fixtures predate the github-v2 connector rewrite
    (oid/commit_hashsha, envelope columns). The git silver/gold pipeline itself
    builds fine now that fix(git): de-shadow completed_at alias in Bitbucket staging models (ILLEGAL_AGGREGATION) #1880 is merged — only the fixtures need refreshing. Tracking
    separately.
  • The CI workflow .github/workflows/connectors-ddl.yml is committed on the branch but
    must be pushed with a workflow-scope token.

Replaces the hand-written scripts/create-bronze-placeholders.sh with a
CI-generated DDL snapshot (scripts/connectors-ddl/*.sql) dumped from a real
bootstrap-db run: connector discover -> destination-clickhouse write ->
dbt -> SHOW CREATE. Unlike the hand-written placeholders the schemas come
from the same source of truth as a real sync, so they cannot drift.

Includes:
- scripts/bootstrap-db/ tooling (generate config, discover->write, dump-ddl,
  pinned CH/destination/dbt versions in pins.env)
- .github/workflows/connectors-ddl.yml — regenerates + auto-commits the
  snapshot on PRs (drift guard)
- create-bronze-placeholders.sh rewritten as a snapshot applier
- dev/test/CI ClickHouse bumped 24.8 -> 25.7.5 (prod parity; dev, virtuozzo
  and new instances all run 25.7.5)
- ch_seeder string->numeric coercion; e2e migration_applier reads the snapshot
- dbt contract fixes exposed by the real-schema snapshot (salesforce crm_deals
  Decimal->Float, m365 chat Decimal->Int, missing depends_on hints, etc.)

WIP — snapshot is not yet complete on 25.7.5: see PR description for the two
blocking dbt-model incompatibilities (bitbucket #1843 nested aggregates;
identity seed correlated subqueries) and the pipeline ordering fix still
needed. Closes #1831 once those land.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Roman Mitasov <Roman.Mitasov@constructor.tech>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0dcb3e9b-d674-401c-9c84-fe7a3334aed2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/connectors-ddl-1831

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Roman Mitasov added 2 commits July 24, 2026 00:02
Bring in the bitbucket-cloud dbt illegal-aggregation fix (#1880) and other
main changes. Resolved create-bronze-placeholders.sh in favour of the
snapshot applicator (this PR's core change, #1831); upstream's warm-cluster
legacy-bitbucket bronze reconcile is relocated to apply-ch-migrations heals
in a follow-up change on this branch.

Signed-off-by: Roman Mitasov <Roman.Mitasov@constructor.tech>
….7.5

Regenerate the full snapshot and fix the generation pipeline so a fresh
cluster builds end-to-end (#1831, #1763).

Generation / prod:
- Order: create person/identity (init-identity) BEFORE dbt so the identity
  seed models' ANTI JOIN person.persons resolves; gold-view migrations after.
- CH 25.7: set allow_experimental_correlated_subqueries at PROFILE level in all
  four dbt profile generators (config()-level does not reach the SELECT plan);
  cast the identity seed join key to UUID (String vs UUID NO_COMMON_TYPE).
- dump-ddl also emits person/identity and the gold-referenced staging tables
  (only m365__collab_email_activity today) — NOT all of staging: pre-creating an
  incremental staging model empty poisons its first is_incremental build
  (max(date) FROM this over an empty MergeTree reads the Date type-max on 25.7).
- SKIP_DBT_GOLD skips apply-ch-migrations' own gold build during generation
  (gold already built by the pinned dbt venv; avoids needing dbt on PATH).
- Relocate the warm-cluster Bitbucket bronze reconcile (#1880) into the
  apply-ch-migrations heal section, now that create-bronze-placeholders is the
  snapshot applicator.

e2e rig:
- _ensure_table allows the real table to be a superset of the fixture schema;
  Decimal coercion + jira fixture schema/value alignment to the real bronze.
- declarative `skip:`; git_metrics skipped pending a github-v2 fixture refresh.

Snapshot: 53 gold views (incl git_metric_observations), all class_* incl git,
person.persons. e2e green: metrics 34 passed/1 skipped, api 64 passed/12 xfail.

The .github/workflows/connectors-ddl.yml that regenerates this snapshot in CI
is committed separately (needs a token with `workflow` scope to push).

Signed-off-by: Roman Mitasov <Roman.Mitasov@constructor.tech>
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.

1 participant