Skip to content

fix(seed): add placeholder tables/columns drifted from gold-view migr… - #1451

Merged
cyberantonz merged 1 commit into
constructorfabric:mainfrom
cyberantonz:fix/seed-placeholder-drift
Jun 23, 2026
Merged

fix(seed): add placeholder tables/columns drifted from gold-view migr…#1451
cyberantonz merged 1 commit into
constructorfabric:mainfrom
cyberantonz:fix/seed-placeholder-drift

Conversation

@cyberantonz

@cyberantonz cyberantonz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

…ations

The dev-compose seed (compose/seed/silver.py) applies sql/placeholders.sql then the gold-view migrations in src/ingestion/scripts/migrations/. Three newer migrations referenced silver objects the placeholder script never mirrored, so seed silver (and the first-run dev-compose.sh up auto-seed) crashed:

  • g.code_loc on silver.mtr_git_person_weekly → UNKNOWN_IDENTIFIER (20260605000001_ic-kpis-git-fanout-fix)
  • silver.class_ai_overage → UNKNOWN_TABLE (20260618000000_ai-claude-team-overage-gold)
  • silver.class_wiki_pages / silver.class_wiki_engagement → UNKNOWN_TABLE (20260620000000_wiki-bullet-rows)

Add the missing column and tables, tracking the subset of columns the consuming migrations read (the real silver models carry the full contracts). The wiki classes key on tenant_id (not insight_tenant_id) to match the view's engagement→pages join.

Verified: dev-compose.sh seed all completes (27 migrations, 204 statements, 28,181 rows) and analytics-api re-validates 95/95 metrics OK (previously erroring on table_not_found). Unblocks the #1419 smoke test.

Part of #1414

Summary by CodeRabbit

  • Chores
    • Updated database infrastructure tables to support downstream processing pipelines
    • Added new data structures to accommodate expanded analytics capabilities

…ations

The dev-compose seed (`compose/seed/silver.py`) applies
`sql/placeholders.sql` then the gold-view migrations in
`src/ingestion/scripts/migrations/`. Three newer migrations referenced
silver objects the placeholder script never mirrored, so `seed silver`
(and the first-run `dev-compose.sh up` auto-seed) crashed:

- `g.code_loc` on silver.mtr_git_person_weekly
  → UNKNOWN_IDENTIFIER (20260605000001_ic-kpis-git-fanout-fix)
- silver.class_ai_overage
  → UNKNOWN_TABLE (20260618000000_ai-claude-team-overage-gold)
- silver.class_wiki_pages / silver.class_wiki_engagement
  → UNKNOWN_TABLE (20260620000000_wiki-bullet-rows)

Add the missing column and tables, tracking the subset of columns the
consuming migrations read (the real silver models carry the full
contracts). The wiki classes key on `tenant_id` (not
`insight_tenant_id`) to match the view's engagement→pages join.

Verified: `dev-compose.sh seed all` completes (27 migrations, 204
statements, 28,181 rows) and analytics-api re-validates 95/95 metrics OK
(previously erroring on table_not_found). Unblocks the constructorfabric#1419 smoke test.

Part of constructorfabric#1414

Signed-off-by: Anton Zelenov <antonz@constructor.tech>
@cyberantonz
cyberantonz requested a review from a team as a code owner June 23, 2026 15:37
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 86738c49-e846-44df-a271-e2723ffaca75

📥 Commits

Reviewing files that changed from the base of the PR and between 667931a and a68122f.

📒 Files selected for processing (1)
  • compose/seed/sql/placeholders.sql

📝 Walkthrough

Walkthrough

The seed SQL script adds three new silver schema placeholder tables — class_ai_overage, class_wiki_pages, and class_wiki_engagement — each using ReplacingMergeTree ordered by unique_key. It also adds a non-null code_loc Float64 column to the existing silver.mtr_git_person_weekly table.

Changes

Silver Placeholder Schema Additions

Layer / File(s) Summary
New silver placeholder tables: AI overage and wiki
compose/seed/sql/placeholders.sql
Adds silver.class_ai_overage (tenant/source identifiers, overage_cents, used_amount_cents, credit_limit_cents, collected_at, _version) and silver.class_wiki_pages / silver.class_wiki_engagement (page metadata, author fields, engagement metrics by day, _version), all as ReplacingMergeTree ordered by unique_key.
Add code_loc column to silver.mtr_git_person_weekly
compose/seed/sql/placeholders.sql
Inserts a non-null code_loc Float64 column between the existing week-level metrics and the nullable spec_lines column, with updated column-mirroring comments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • constructorfabric/insight#1371: Introduces the Claude Team overage pipeline with gold/analytics views that read from silver.class_ai_overage, which this PR seeds as a placeholder table.

Poem

🐇 Hippity hop, new tables appear,
Silver schemas growing through the year!
Wiki pages, overage, code_loc too,
Placeholder seeds for gold views to stew.
The rabbit plants rows, and migrations cheer! 🌱

🚥 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 identifies the main change: adding missing placeholder tables and columns to fix downstream migration failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

@cyberantonz
cyberantonz merged commit 5f3df70 into constructorfabric:main Jun 23, 2026
3 checks passed
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