Skip to content

chart(insight): drop L2 subchart bundling (clickhouse/mariadb/redis/redpanda) - #1428

Merged
cyberantonz merged 2 commits into
constructorfabric:mainfrom
cyberantonz:cleanup/chart-drop-l2-subcharts
Jun 22, 2026
Merged

chart(insight): drop L2 subchart bundling (clickhouse/mariadb/redis/redpanda)#1428
cyberantonz merged 2 commits into
constructorfabric:mainfrom
cyberantonz:cleanup/chart-drop-l2-subcharts

Conversation

@cyberantonz

@cyberantonz cyberantonz commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Part of #1414. Closes #1417.

Phase 2 of the legacy dev-up.sh retirement. Makes charts/insight a pure application bundle by dropping the four L2 infrastructure subchart dependencies.

What changed

The umbrella previously bundled clickhouse / mariadb / redis / redpanda as subcharts, each gated by a <svc>.deploy boolean. In gitops those are always deploy: false — the L2 infra runs as separate releases in insight-infra and the umbrella dials it via <dep>.host. The deploy: true bundled path was used only by the now-retired dev-up.sh flow, so it's dead code.

  • Chart.yaml — removed the four dependencies blocks; version bumped 0.1.840.2.0 (breaking chart-API change); header comment realigned.
  • Chart.lock — regenerated; only the four file:// app-service subcharts remain (api-gateway, analytics-api, identity, frontend).
  • values.yaml — each infra block trimmed to wiring fields only (host/port/protocol/database/username/passwordSecret, redpanda.brokers). Dropped deploy/image/persistence/resources/auth/architecture/statefulset/storage/etc. Stripped stale install-argo.sh / deploy/argo/rbac.yaml / install-airbyte.sh comment refs.
  • templates/_helpers.tpl — collapsed the host/fqdn/brokers helpers to the external-only path; removed the dead mariadb.deploy drift validator (it referenced the now-removed mariadb.auth.*).
  • templates/{NOTES.txt,clickhouse-init-svcdbs-job,mariadb-init-svcdbs-job,secrets,ingestion/dbt-run}.yaml + README.md — comments/docs realigned to the external-L2 model (dropped bundled-mode docs, the Bitnami-legacy section, and the helmfile-relationship section).

Deliberate deviation from the issue checklist

clickhouse.initDatabases: [insight] was kept (the issue said delete it). It drives the clickhouse-init-svcdbs-job pre-install Hook Job, which provisions databases against the external ClickHouse too — deleting it would drop that Job from the render. Confirmed present in the rendered output.

Verification

  • helm dependency updateChart.lock with only the 4 app-service entries. ✅
  • helm template charts/insight --values deploy/gitops/environments/local/values.yaml.template diffed against the Phase 0 baseline → only the chart-version label (0.1.820.2.0) and a pre-existing analytics-api image-tag drift; no structural manifest changes (the bundled subcharts never rendered under deploy: false). ✅
  • helm lint (gitops local values) → passes. ✅
  • helm install --dry-run=server against a live cluster → passes (14 resources, API-server validated). ✅
  • Independent code-review agent on the diff → no blockers; confirmed no template reads a removed values field and no stray infra .deploy reference remains.

The full make deploy ENV=local smoke test is deferred to Phase 4 (#1419) inside the Phase 3 PR (per the EPIC plan) — it requires a full L2 bootstrap.

⚠️ Breaking change — coordination required

This bumps the chart's version to 0.2.0 with a removed chart-API surface (the <dep>.deploy: true bundled mode no longer exists). CI's patch-only auto-bump will publish 0.2.1 on merge.

  • insight-gitops (read-only sibling repo) pins the chart via .insight-version. After this PR's OCI publish lands, that pin must be bumped to the 0.2.x line. No action needed in this repo.
  • Any downstream consumer relying on <dep>.deploy: true to bundle infra must migrate to external L2 + <dep>.host wiring.

Follow-up (not in this PR)

  • The gitops deploy/gitops/environments/local/values.yaml.template still carries inert <dep>.deploy: false lines — harmless no-op overrides now; can be cleaned in Phase 3.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Separated infrastructure dependencies from the application chart; ClickHouse, MariaDB, Redis, and Redpanda are now always treated as external and wired via required connection settings
    • Updated URL/endpoint resolution to reflect external L2 targets (and always display external endpoints)
    • Added support for configuring the ClickHouse protocol
  • Documentation

    • Updated umbrella chart docs and installation checklist to match the external-infra model and revised release naming guidance
    • Refreshed values and notes to clarify required host/credential wiring and remove outdated bundled-mode explanations
  • Chores

    • Bumped chart version to 0.2.0

…edpanda)

The umbrella previously bundled four L2 infra subcharts, each gated by a
`<svc>.deploy` flag. In gitops those are always `deploy: false` (infra
runs as separate releases in `insight-infra`, dialed via `<dep>.host`);
the `deploy: true` path was used only by the now-retired `dev-up.sh`
flow. Make the umbrella a pure app-bundle.

- Chart.yaml: remove the clickhouse/mariadb/redis/redpanda dependency
  blocks; bump version 0.1.84 -> 0.2.0 (breaking chart-API change).
- Chart.lock: regenerated — only the 4 file:// app-service subcharts
  remain.
- values.yaml: trim each infra block to wiring fields only (host/port/
  protocol/database/username/passwordSecret, redpanda.brokers). Keep
  clickhouse.initDatabases — it drives the external-CH init Hook Job.
  Drop deploy/image/persistence/resources/auth/subchart-only fields and
  stale install-script comment refs.
- _helpers.tpl: collapse the host/fqdn/brokers helpers to the external-
  only path; drop the dead mariadb.deploy drift validator.
- NOTES.txt / init-job / secrets / dbt-run comments + README: realign to
  the external-L2 model (drop bundled-mode docs, Bitnami-legacy section,
  helmfile relationship).

Render against the gitops local values is unchanged vs the Phase 0
baseline except the chart-version label (the bundled subcharts never
rendered under deploy:false). helm lint + server-side dry-run pass.

Part of constructorfabric#1414.
Closes constructorfabric#1417.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Anton Zelenov <antonz@constructor.tech>
@cyberantonz
cyberantonz requested a review from a team as a code owner June 22, 2026 12:14
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The charts/insight umbrella chart is restructured as a breaking change (v0.1.84 → v0.2.0): ClickHouse, MariaDB, Redis, and Redpanda are removed from the dependencies list in Chart.yaml. All infra helper templates in _helpers.tpl are converted to unconditional fail-fast required calls on operator-supplied host/broker values. The values.yaml INFRA section is stripped to minimal external-wiring stanzas. Templates and README are updated throughout to reflect the always-external L2 model.

Changes

Drop L2 Subchart Bundling — insight umbrella v0.2.0

Layer / File(s) Summary
Chart version bump and dependency removal
charts/insight/Chart.yaml, charts/insight/values.yaml
Bumps chart version to 0.2.0, removes clickhouse, mariadb, redis, and redpanda from the dependencies list, and replaces the full bundled-subchart INFRA configuration (deploy flags, images, persistence, resources, auth blocks) in values.yaml with minimal external-wiring stanzas (host/port/passwordSecret, ClickHouse protocol/initDatabases, Redpanda brokers).
Infra helper resolution converted to external-only fail-fast
charts/insight/templates/_helpers.tpl
Removes all deploy-based conditional defaulting from ClickHouse, MariaDB, Redis, and Redpanda host/broker helpers. Each now unconditionally required-fails when the operator-supplied value is empty. Adds insight.clickhouse.protocol helper (default http). Simplifies insight.validate comments accordingly.
Template and init-job documentation updates
charts/insight/templates/NOTES.txt, charts/insight/templates/clickhouse-init-svcdbs-job.yaml, charts/insight/templates/mariadb-init-svcdbs-job.yaml, charts/insight/templates/secrets.yaml, charts/insight/templates/ingestion/dbt-run.yaml
Updates NOTES.txt to remove [external] conditional markers. Rewrites init-job and secrets comments to describe direct external-host dialing, removes bundled-path references, and updates MariaDB client image pinning guidance. Updates dbt-run.yaml comment to reflect external host resolution at chart-render time.
README rewritten for external-infra-only model
charts/insight/README.md
Removes L2 infra rows from the component table, rewrites the release name convention and install checklist sections for always-external provisioning, updates the values reference to document dep.host/dep.passwordSecret wiring fields, removes the helmfile relationship section, and adds a Publishing section with OCI registry packaging instructions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

  • constructorfabric/insight#1361: Adds MariaDB host/port wiring support for identity.waitForMariadb, directly related to the always-external MariaDB host resolution and fail-fast helper contract introduced here.
  • constructorfabric/insight#1315: Touches charts/insight/templates/ingestion/dbt-run.yaml — this PR updates host-resolution comments while that PR modifies template logging output.

Suggested reviewers

  • mitasovr

Poem

🐇 Hop hop, the bundles are gone!
No more ClickHouse packed along,
MariaDB flies free outside,
Redis and Redpanda — untied!
The umbrella holds only our apps,
External infra fills the gaps. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: removing four L2 infrastructure subcharts from the insight chart, which is the primary objective of the PR.
Linked Issues check ✅ Passed The PR fully satisfies all coding requirements from issue #1417: removed four infrastructure dependencies, bumped chart version to 0.2.0, regenerated Chart.lock, trimmed infrastructure values to wiring-only fields, removed deploy guards, and updated all templates and documentation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to #1417 objectives: removing L2 subcharts, updating documentation, and adjusting values/templates accordingly. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@charts/insight/templates/_helpers.tpl`:
- Around line 66-71: The insight.clickhouse.protocol helper template correctly
allows for protocol override, but the insight.clickhouse.url definition still
uses a hardcoded http:// prefix, causing TLS configurations to be ignored.
Update the insight.clickhouse.url template to dynamically compose the URL by
using the insight.clickhouse.protocol helper template instead of hardcoding the
http:// scheme, ensuring that protocol overrides are properly reflected in the
final endpoint URL.

In `@charts/insight/templates/clickhouse-init-svcdbs-job.yaml`:
- Around line 12-15: The comment describing the ClickHouse authentication model
(lines 12-15) currently states that clickhouse.username defaults to `insight`,
but the values contract actually requires an explicit operator-provided value
with no default. Update the comment to clarify that the operator must explicitly
provide the clickhouse.username value when configuring this chart, removing any
mention of a default value to prevent misconfiguration during rollout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: adf58bf9-5005-4664-af84-5b153c339719

📥 Commits

Reviewing files that changed from the base of the PR and between 3b6d954 and 3645837.

⛔ Files ignored due to path filters (1)
  • charts/insight/Chart.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • charts/insight/Chart.yaml
  • charts/insight/README.md
  • charts/insight/templates/NOTES.txt
  • charts/insight/templates/_helpers.tpl
  • charts/insight/templates/clickhouse-init-svcdbs-job.yaml
  • charts/insight/templates/ingestion/dbt-run.yaml
  • charts/insight/templates/mariadb-init-svcdbs-job.yaml
  • charts/insight/templates/secrets.yaml
  • charts/insight/values.yaml

Comment thread charts/insight/templates/_helpers.tpl
Comment thread charts/insight/templates/clickhouse-init-svcdbs-job.yaml Outdated
Comment thread charts/insight/values.yaml
- _helpers.tpl: insight.clickhouse.url now composes the scheme from
  insight.clickhouse.protocol instead of a hardcoded http:// — so a TLS
  ClickHouse (clickhouse.protocol: https) renders the correct endpoint.
  Default protocol is http, so the rendered output is unchanged for the
  existing (plain-HTTP) case.
- clickhouse-init-svcdbs-job.yaml: drop the misleading "default `insight`"
  from the auth-model comment — clickhouse.username has no default and the
  operator MUST set it.
- values.yaml: point the INFRASTRUCTURE section at CONTRIBUTING.md and the
  deployment DESIGN spec for the layered L0/L2/L3 model.

Part of constructorfabric#1414.
Closes constructorfabric#1417.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Anton Zelenov <antonz@constructor.tech>
@cyberantonz

Copy link
Copy Markdown
Contributor Author

Addressed the review in b557e180:

  • _helpers.tpl — protocol-aware ClickHouse URL (@coderabbitai): insight.clickhouse.url now composes the scheme via insight.clickhouse.protocol instead of a hardcoded http://, so a TLS ClickHouse (clickhouse.protocol: https) renders the correct endpoint. Default is http, so the rendered output is unchanged for the existing plain-HTTP case (verified: CLICKHOUSE_URL still renders http://… against the gitops local values).
  • clickhouse-init-svcdbs-job.yaml — auth-model comment (@coderabbitai): dropped the misleading "default insight"; clickhouse.username has no default and the operator MUST set it.
  • values.yaml — doc references (@cyberantonz): the INFRASTRUCTURE section now points at CONTRIBUTING.md ("Deployment paths" → Kubernetes) and docs/components/deployment/specs/DESIGN.md for the layered L0/L2/L3 model.

Local deploy validation (OrbStack)

Brought the full stack up against a local cluster to exercise this chart end-to-end (substituting a locally-packaged 0.2.0 for the published OCI pin):

  • L2 infra (mariadb / clickhouse / redis / redpanda) deployed into insight-infra; service names match the chart's <dep>.host wiring exactly.
  • Pre-install hooks clickhouse-init-svcdbs + mariadb-init-svcdbs ran against the external L2 and succeeded (the insight CH DB + identity MariaDB DB were created before the app pods).
  • App pods: api-gateway, frontend, identityRunning/Ready. analytics-api connects cleanly to external MariaDB + ClickHouse + Redis (logs: connected to database, Redis backend connected, listening); it stays NotReady only because ClickHouse has no seed data yet (91 schema-validator errors → liveness 400) — the documented manual-seed condition, identical with the old chart and unrelated to the de-bundling.

So the de-bundled umbrella deploys as a pure app-bundle and wires correctly to external L2.

Note (separate, pre-existing gitops issue — not this PR): the L2 redis pin REDIS_VERSION=25.5.2 in deploy/gitops/Makefile 404s on Docker Hub (Bitnami free-image removal); I used 21.2.6 locally as a workaround. Worth a follow-up to repin redis.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@cyberantonz Thanks for the thorough follow-up! All three items look great:

  • Protocol-aware ClickHouse URL — composing the scheme through insight.clickhouse.protocol is the right approach; TLS deployments will now render correctly without any change to the default HTTP path.
  • Auth-model comment — removing the misleading default is important for operator clarity; clickhouse.username being required-with-no-default is now unambiguous.
  • Doc references — pointing at CONTRIBUTING.md ("Deployment paths → Kubernetes") and DESIGN.md for the layered model gives operators a clear trail to follow.

The OrbStack end-to-end validation is particularly reassuring — pre-install hooks provisioning databases against the external L2 before app pods start is exactly the critical path this PR touches, and seeing it work cleanly confirms the de-bundling is sound.


Regarding the Redis version pin issue you noted (REDIS_VERSION=25.5.2 404ing on Docker Hub due to Bitnami's free-image removal) — would you like me to open a follow-up GitHub issue to track that repin? I can assign it to you and backlink this PR.

🐇 ✨


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
charts/insight/templates/clickhouse-init-svcdbs-job.yaml (1)

87-87: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

The curl ping command hardcodes http:// but should respect clickhouse.protocol for TLS endpoints.

Line 87 uses a hardcoded http:// scheme in the curl ping endpoint, but the PR objectives document that the ClickHouse URL helper now composes the scheme dynamically from insight.clickhouse.protocol to support TLS instances. If an operator configures clickhouse.protocol: https, the ping check will still attempt http://, which will hang or fail silently.

Replace the hardcoded scheme with a dynamically composed URL that respects the configured protocol:

- if curl -sS -o /dev/null --fail "http://${CH_HOST}:${CH_PORT}/ping" 2>/dev/null; then
+ if curl -sS -o /dev/null --fail "{{ include "insight.clickhouse.protocol" . }}://${CH_HOST}:${CH_PORT}/ping" 2>/dev/null; then

Alternatively, if composing the URL directly in the shell command is preferred, export the protocol as an environment variable alongside CH_HOST and CH_PORT:

            - name: CH_PORT
              value: {{ include "insight.clickhouse.port" . | quote }}
+           - name: CH_PROTOCOL
+             value: {{ include "insight.clickhouse.protocol" . | quote }}

Then update the curl command to use it:

- if curl -sS -o /dev/null --fail "http://${CH_HOST}:${CH_PORT}/ping" 2>/dev/null; then
+ if curl -sS -o /dev/null --fail "${CH_PROTOCOL}://${CH_HOST}:${CH_PORT}/ping" 2>/dev/null; then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@charts/insight/templates/clickhouse-init-svcdbs-job.yaml` at line 87, The
curl ping command hardcodes the http:// scheme in the URL, but this should be
dynamic based on the configured clickhouse.protocol setting to support HTTPS
endpoints. Modify the curl command by either composing the full URL dynamically
to respect the configured protocol scheme instead of the hardcoded http://, or
export the clickhouse.protocol as an environment variable (similar to how
CH_HOST and CH_PORT are exported) and reference that variable in the curl
command to construct the proper endpoint URL that respects TLS configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@charts/insight/templates/clickhouse-init-svcdbs-job.yaml`:
- Line 87: The curl ping command hardcodes the http:// scheme in the URL, but
this should be dynamic based on the configured clickhouse.protocol setting to
support HTTPS endpoints. Modify the curl command by either composing the full
URL dynamically to respect the configured protocol scheme instead of the
hardcoded http://, or export the clickhouse.protocol as an environment variable
(similar to how CH_HOST and CH_PORT are exported) and reference that variable in
the curl command to construct the proper endpoint URL that respects TLS
configuration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f21ad260-a005-49ce-85d4-dd4536aa26bf

📥 Commits

Reviewing files that changed from the base of the PR and between 3645837 and b557e18.

📒 Files selected for processing (3)
  • charts/insight/templates/_helpers.tpl
  • charts/insight/templates/clickhouse-init-svcdbs-job.yaml
  • charts/insight/values.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • charts/insight/templates/_helpers.tpl
  • charts/insight/values.yaml

@cyberantonz
cyberantonz merged commit 7120c88 into constructorfabric:main Jun 22, 2026
17 checks passed
@cyberantonz
cyberantonz deleted the cleanup/chart-drop-l2-subcharts branch June 23, 2026 14:43
cyberantonz added a commit to cyberantonz/insight that referenced this pull request Jun 24, 2026
…ook Job

Since constructorfabric#1428 dropped the bundled ClickHouse StatefulSet (CH is now always
external L2), nothing applied the gold-view migrations: the host
init.sh path `kubectl exec`'d into a pod that no longer exists, and the
clickhouse-init-svcdbs Hook only runs CREATE DATABASE. Both clusters lost
their migrations.

Add a `clickhouse-migrate` Helm Hook Job (post-install,post-upgrade) that
runs apply-ch-migrations.sh in the toolbox image (which already bundles the
SQL) and dials the external ClickHouse over its HTTP interface — no new
image/CI needed. It creates the staging/silver/app databases + ADR-0007
placeholders, then applies scripts/migrations/*.sql in glob order. A failed
migration fails (and, under gitops --rollback-on-failure, rolls back) the
release — intentional; backoffLimit is low since SQL errors are deterministic.

- lib/ch-exec.sh: HTTP-only run_ch/ch_table_exists (password via the
  X-ClickHouse-Key header, never on the command line).
- create-bronze-placeholders.sh: sourced from the lib; DDL untouched.
- init.sh / run-init.sh: strip the now-dead ClickHouse migration section
  (the kubectl-exec-into-bundled-CH path) — it targeted a retired StatefulSet.
- values.yaml: clickhouse.runMigrations gate (default true).
- DESIGN.md: realign the schema-migrations + DB-provisioning + password
  rotation docs to the external-L2 / Hook-Job model.
- e2e migration_applier.py: repoint stale comments (parser logic unchanged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Anton Zelenov <antonz@constructor.tech>
cyberantonz added a commit that referenced this pull request Jun 25, 2026
…ook Job (#1480)

Since #1428 dropped the bundled ClickHouse StatefulSet (CH is now always
external L2), nothing applied the gold-view migrations: the host
init.sh path `kubectl exec`'d into a pod that no longer exists, and the
clickhouse-init-svcdbs Hook only runs CREATE DATABASE. Both clusters lost
their migrations.

Add a `clickhouse-migrate` Helm Hook Job (post-install,post-upgrade) that
runs apply-ch-migrations.sh in the toolbox image (which already bundles the
SQL) and dials the external ClickHouse over its HTTP interface — no new
image/CI needed. It creates the staging/silver/app databases + ADR-0007
placeholders, then applies scripts/migrations/*.sql in glob order. A failed
migration fails (and, under gitops --rollback-on-failure, rolls back) the
release — intentional; backoffLimit is low since SQL errors are deterministic.

- lib/ch-exec.sh: HTTP-only run_ch/ch_table_exists (password via the
  X-ClickHouse-Key header, never on the command line).
- create-bronze-placeholders.sh: sourced from the lib; DDL untouched.
- init.sh / run-init.sh: strip the now-dead ClickHouse migration section
  (the kubectl-exec-into-bundled-CH path) — it targeted a retired StatefulSet.
- values.yaml: clickhouse.runMigrations gate (default true).
- DESIGN.md: realign the schema-migrations + DB-provisioning + password
  rotation docs to the external-L2 / Hook-Job model.
- e2e migration_applier.py: repoint stale comments (parser logic unchanged).

Signed-off-by: Anton Zelenov <antonz@constructor.tech>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cyberantonz added a commit to cyberantonz/insight that referenced this pull request Jul 3, 2026
deploy/seed/sql/placeholders.sql was a hand-maintained copy of
src/ingestion/scripts/create-bronze-placeholders.sh and the two had
drifted badly in both directions: the seed copy was missing 6 bronze
databases / 22 bronze tables added after it was extracted, while the
k8s script was missing silver columns + sort keys the compose seed and
several gold views depend on (latent UNKNOWN_IDENTIFIER on any fresh
cluster, masked on warm ones by ch_table_exists short-circuits).

Reconcile the seed-side fixes into the script and delete the copy:

- class_ai_dev_usage: (email, day, tool) sort key so multi-tool rows
  survive ReplacingMergeTree; Float64 counters (seed inserts floats);
  DEFAULT '' on source/source_id; same types in the reconcile ALTERs.
- class_collab_*_activity: data_source in the sort key so multi-source
  rows survive.
- class_git_commits / _pull_requests / _file_changes: repo_slug,
  file_path, closed_on, non-Nullable lines_added/lines_removed that
  git_bullet_rows' view structure requires under join_use_nulls=1.
- class_support_activity: seed columns/types union'd in, data_source
  in the sort key.
- class_ai_overage: ORDER BY unique_key + Nullable collected_at,
  mirroring the real dbt model.
- mtr_git_person_weekly: add config_loc (referenced by ic_chart_loc
  since migration 20260624 but never mirrored — SELECTing that view
  threw UNKNOWN_IDENTIFIER on every fresh cluster) + a reconcile
  branch for warm placeholders.
- assert CREATE DATABASE insight for compose re-bootstraps.

The seed now runs the script itself: silver.py subprocess-invokes it
(bash + curl over CLICKHOUSE_URL — lib/ch-exec.sh has no k8s coupling
since constructorfabric#1428), and the seed image gains curl. Both schema inputs
(placeholders script + gold-view migrations) are auto-located with no
env knobs: the /ingestion-scripts bind-mount in the container,
repo-relative to deploy/seed on host runs. The PLACEHOLDERS_SQL and
MIGRATIONS_DIR env vars are gone, and the separate /migrations mount
collapsed into /ingestion-scripts.

NB: existing dev environments must rebuild the seed image once
(docker compose --profile seed build seed-sample) to pick up curl;
the bind-mounted code otherwise runs inside the stale image and the
placeholders script fails with exit 127.

Verified against a throwaway ClickHouse 24.8: fresh bootstrap + warm
re-run (reconcile branches), all 29 migrations / 218 statements apply,
29k seed rows across 18 tables, every insight.* view SELECTable except
the pre-existing dead email_daily (constructorfabric#1595). Tenant-column naming drift
between dbt models and seed/placeholders is tracked in constructorfabric#1596.

Signed-off-by: Anton Zelenov <antonz@constructor.tech>
cyberantonz added a commit that referenced this pull request Jul 3, 2026
deploy/seed/sql/placeholders.sql was a hand-maintained copy of
src/ingestion/scripts/create-bronze-placeholders.sh and the two had
drifted badly in both directions: the seed copy was missing 6 bronze
databases / 22 bronze tables added after it was extracted, while the
k8s script was missing silver columns + sort keys the compose seed and
several gold views depend on (latent UNKNOWN_IDENTIFIER on any fresh
cluster, masked on warm ones by ch_table_exists short-circuits).

Reconcile the seed-side fixes into the script and delete the copy:

- class_ai_dev_usage: (email, day, tool) sort key so multi-tool rows
  survive ReplacingMergeTree; Float64 counters (seed inserts floats);
  DEFAULT '' on source/source_id; same types in the reconcile ALTERs.
- class_collab_*_activity: data_source in the sort key so multi-source
  rows survive.
- class_git_commits / _pull_requests / _file_changes: repo_slug,
  file_path, closed_on, non-Nullable lines_added/lines_removed that
  git_bullet_rows' view structure requires under join_use_nulls=1.
- class_support_activity: seed columns/types union'd in, data_source
  in the sort key.
- class_ai_overage: ORDER BY unique_key + Nullable collected_at,
  mirroring the real dbt model.
- mtr_git_person_weekly: add config_loc (referenced by ic_chart_loc
  since migration 20260624 but never mirrored — SELECTing that view
  threw UNKNOWN_IDENTIFIER on every fresh cluster) + a reconcile
  branch for warm placeholders.
- assert CREATE DATABASE insight for compose re-bootstraps.

The seed now runs the script itself: silver.py subprocess-invokes it
(bash + curl over CLICKHOUSE_URL — lib/ch-exec.sh has no k8s coupling
since #1428), and the seed image gains curl. Both schema inputs
(placeholders script + gold-view migrations) are auto-located with no
env knobs: the /ingestion-scripts bind-mount in the container,
repo-relative to deploy/seed on host runs. The PLACEHOLDERS_SQL and
MIGRATIONS_DIR env vars are gone, and the separate /migrations mount
collapsed into /ingestion-scripts.

NB: existing dev environments must rebuild the seed image once
(docker compose --profile seed build seed-sample) to pick up curl;
the bind-mounted code otherwise runs inside the stale image and the
placeholders script fails with exit 127.

Verified against a throwaway ClickHouse 24.8: fresh bootstrap + warm
re-run (reconcile branches), all 29 migrations / 218 statements apply,
29k seed rows across 18 tables, every insight.* view SELECTable except
the pre-existing dead email_daily (#1595). Tenant-column naming drift
between dbt models and seed/placeholders is tracked in #1596.

Signed-off-by: Anton Zelenov <antonz@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.

Phase 2 — Drop L2 subchart bundling from charts/insight (BREAKING — 0.2.0)

2 participants