Skip to content

🔨🤖 Store ETL chart config as a separate config row (rows model) + catalogPath#6599

Merged
pabloarosado merged 3 commits into
etl-chart-configfrom
etl-chart-config-row-model
Jun 5, 2026
Merged

🔨🤖 Store ETL chart config as a separate config row (rows model) + catalogPath#6599
pabloarosado merged 3 commits into
etl-chart-configfrom
etl-chart-config-row-model

Conversation

@pabloarosado

@pabloarosado pabloarosado commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Written by Claude Code — @pabloarosado at the wheel.

Subbranch PR into etl-chart-config. Reworks how a chart's ETL-authored config is stored, from a column on chart_configs to a separate config row reached by a pointer — and folds in the catalogPath change (supersedes #6590).

Why

Following Sophia's feedback on #6553: keep chart_configs a generic config store, and let each owner declare its own layers via pointers (exactly how variables.grapherConfigIdETL already works). This preserves "one row = one layer", reuses the existing config-row machinery (validation, R2, merge), and avoids baking a chart-specific concept into the shared chart_configs table.

What changes vs the column approach

  • Schema: drop the chart_configs.etlConfig column; add charts.configIdETL char(36) UNIQUE NULL → FK to chart_configs(id), mirroring variables.grapherConfigIdETL. The chart's ETL config lives in its own chart_configs row (patch == full, absolute).
  • Merge (unchanged result): the rendered full is still merge(variableETL, etlConfig, patch). The middle layer is now read through the pointer (LEFT JOIN chart_configs cc_etl ON cc_etl.id = c.configIdETL) — in the admin-save path, parent.json, and the variable cascade (updateAllChartsThatInheritFromIndicator).
  • Endpoints: PUT /charts/:id/etlConfig upserts the separate ETL config row and sets the pointer; DELETE clears the pointer then deletes the row. deleteChart also drops the orphaned ETL row. API request/response shapes are unchanged, so the admin editor needs no changes.
  • R2: the ETL config row is an intermediate layer — MySQL-only, never uploaded (same as the variable-ETL rows).
  • MDIM views: their ETL layer is dropped from the merge here; they get it via the link table in Phase 3.

Folded in: catalogPath (was #6590)

Adds charts.catalogPath (ETL's stable identity, mirrors multi_dim_data_pages.catalogPath) and wires it into the ETL-config endpoint. Brought in here so the whole charts-table reshape is one reviewable PR; #6590 is superseded.

Testing

  • yarn typecheck passes.
  • DB-backed tests (adminSiteServer/tests/charts.test.ts) and the migrations need a MySQL test DB — to be validated in CI (make dbtest). The two storage-specific assertions were updated to check the separate row via configIdETL. Logic closely mirrors the existing, tested variable-ETL pattern.
  • ETL side (🎉 Charts as first-class citizens in ETL: layered approach with grapher etl#6174) is unaffected — the endpoint contract is identical.

🤖 Generated with Claude Code

pabloarosado and others added 2 commits June 5, 2026 13:36
Replaces the chart_configs.etlConfig column with a charts.configIdETL
pointer to a dedicated chart_configs row, mirroring
variables.grapherConfigIdETL. Keeps chart_configs a generic config store
and lets each owner declare its own layers via pointers (per Sophia's
feedback). The rendered full is still merge(variableETL, etlConfig, patch);
the ETL config row is MySQL-only and never uploaded to R2.

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

Adds a nullable, unique catalogPath column to the charts table linking an
ETL-authored chart to its ETL step (e.g. animal_welfare/latest/banning_of_chick_culling#banning_of_chick_culling),
mirroring multi_dim_data_pages.catalogPath. Persisted via the etlConfig endpoint
(COALESCE so non-ETL callers don't clobber it). NULL for hand-authored charts.

Pairs with the ETL-side change. Targets the chart-config feature branch.

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

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c12779bfc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread db/migration/1779983981061-AddConfigIdEtlToCharts.ts
@pabloarosado pabloarosado self-assigned this Jun 5, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pabloarosado pabloarosado marked this pull request as ready for review June 5, 2026 13:10

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88570ec992

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread db/migration/1779983981061-AddConfigIdEtlToCharts.ts
@pabloarosado pabloarosado merged commit 9b320cf into etl-chart-config Jun 5, 2026
21 of 23 checks passed
@pabloarosado pabloarosado deleted the etl-chart-config-row-model branch June 5, 2026 13:17
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