Skip to content

fix(clickhouse): drop obsolete task event index variants - #4880

Merged
carderne merged 5 commits into
mainfrom
fix/clickhouse-atomic-storage-alter-tri-13550
Sep 2, 2026
Merged

fix(clickhouse): drop obsolete task event index variants#4880
carderne merged 5 commits into
mainfrom
fix/clickhouse-atomic-storage-alter-tri-13550

Conversation

@carderne

@carderne carderne commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Removes the obsolete task event full-text indexes in one ALTER TABLE, accounting for both known index naming variants.

Fix

The original migration issued back-to-back alters while ClickHouse could still be processing the preceding index mutation. Combining the index removals avoids scheduling a subsequent alter against an unfinished mutation.

The native JSON storage change is deferred until it can be performed without rewriting populated parts.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8d31ef4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The ClickHouse migration now drops four text-search indexes in one ALTER TABLE statement. It no longer modifies the attributes column or sets synchronization settings. The Down section is empty. The task-events test now validates the materialized span identifier, non-ephemeral attributes metadata, and removal of all four indexes.

Merge Risk: ⚪ Minimal · up to 8d31e

This localized migration now removes the obsolete indexes without changing the attributes column or introducing a new production behavior risk. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the index removal and the deferred JSON storage change, but it omits the required issue reference, checklist, testing steps, changelog, and screenshots sections. Add the required template sections. Include the issue reference, completed checklist, specific testing steps, a short changelog entry, and screenshots or an explicit statement that screenshots are not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: removing obsolete ClickHouse task event index variants.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/clickhouse-atomic-storage-alter-tri-13550

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

coderabbitai[bot]

This comment was marked as resolved.

@carderne carderne changed the title fix(clickhouse): combine task event storage alters fix(clickhouse): safely drop obsolete task event indexes Sep 2, 2026
@carderne carderne changed the title fix(clickhouse): safely drop obsolete task event indexes fix(clickhouse): drop obsolete task event index variants Sep 2, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@carderne
carderne enabled auto-merge September 2, 2026 16:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql (1)

11-12: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Define the rollback behavior for migration 042. The empty Down section can leave trigger_dev.task_events_v2 without the search indexes added by migrations 015 and 016. idx_attributes_text was already removed by migration 018, and message_text_search has no definition in the schema files, so do not restore all four blindly. If this migration is intentionally irreversible, make the Down section fail explicitly; otherwise restore only indexes present before migration 042.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 706868ba-7698-498b-9043-b0c91d354c38

📥 Commits

Reviewing files that changed from the base of the PR and between b759825 and 6050b80.

📒 Files selected for processing (1)
  • internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (32)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (22, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (24, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (23, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (20, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (21, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (17, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (14, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (16, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (19, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (15, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (18, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (13, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 24)
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (2, 2)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (1, 2)
  • GitHub Check: internal / 🧪 Unit Tests: Internal
  • GitHub Check: fk-cascade-guard / fk-cascade-guard
  • GitHub Check: typecheck / typecheck
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (2)
Add crumbs as you write code — not just when debugging.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql
Migration file numbering: name files as `0(N+1)_descriptive_name.sql` where N is the largest existing migration number in `schema/`; rebase and renumber if main adds migrations before opening a PR DDL in migrations must be idempotent: use `...

📄 CodeRabbit inference engine (internal-packages/clickhouse/CLAUDE.md)

Files:

  • internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql
🔇 Additional comments (1)
internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql (1)

9-9: Add the required crumb marker.

The previous review comment still applies. Add a SQL-safe // @crumbs`` marker near this changed DDL block. Remove it with agentcrumbs strip before merge.

Proposed change
 ALTER TABLE trigger_dev.task_events_v2
+-- // `@crumbs`
     DROP INDEX IF EXISTS idx_attributes_text_search,

As per coding guidelines, files matching **/* must add crumbs as code is written, using // @Crumbs or `// `#region` `@crumbs; agentcrumbs strip removes them before merge.

Source: Coding guidelines

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal-packages/clickhouse/src/taskEvents.test.ts (1)

16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add crumbs to the changed test paths.

Add a // @Crumbs marker or a `// `#region` `@crumbs block around the changed test paths before merge. agentcrumbs strip will remove this instrumentation.

As per coding guidelines, add crumbs as you write code and mark lines with // @Crumbs or wrap blocks in `// `#region` `@crumbs.

Also applies to: 45-45, 85-86, 101-106

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: c3ed8d80-7ddd-4f56-9913-28471456108c

📥 Commits

Reviewing files that changed from the base of the PR and between 6050b80 and 8d31ef4.

📒 Files selected for processing (1)
  • internal-packages/clickhouse/src/taskEvents.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (32)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (22, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (15, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (12, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (21, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (18, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (16, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (10, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (8, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (6, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (19, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (20, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (9, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (23, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (17, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (14, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (11, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (3, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (24, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (13, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (7, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (2, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (4, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (5, 24)
  • GitHub Check: webapp / 🧪 Unit Tests: Webapp (1, 24)
  • GitHub Check: internal / 🧪 Unit Tests: Internal
  • GitHub Check: typecheck / typecheck
  • GitHub Check: fk-cascade-guard / fk-cascade-guard
  • GitHub Check: runops-guard / runops-guard
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (2, 2)
  • GitHub Check: e2e-webapp / 🧪 E2E Tests: Webapp (1, 2)
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (7)
We use vitest exclusively.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts
**Prefer static imports over dynamic imports.**

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts
Add crumbs as you write code — not just when debugging.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts
Use vitest for all tests in the Trigger.dev repository

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts
Use function declarations instead of default exports

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts
Use types over interfaces for TypeScript Avoid using enums; prefer string unions or const objects instead

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts
When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs Do not use high-cardinality attributes in OTEL metr...

📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)

Files:

  • internal-packages/clickhouse/src/taskEvents.test.ts

@carderne
carderne added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@carderne
carderne added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
@carderne
carderne added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit d743473 Sep 2, 2026
51 checks passed
@carderne
carderne deleted the fix/clickhouse-atomic-storage-alter-tri-13550 branch September 2, 2026 17:32
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