Skip to content

Conversation

@ivov
Copy link
Member

@ivov ivov commented Nov 24, 2025

ChatHubMessage has self-referencing bidirectional relations and, depending on the cache state, typechecking it may lead to TS2589. This fails specifically on entityManager.insert whose arg type was fixed to break cycles, which indeed stopped them until now, so one theory is that TS is expanding self-references on checking assignability of Partial<ChatHubMessage> (feature type) to QueryDeepPartialEntity<ChatHubMessage> (typeorm type).

Let's validate the theory by aligning the types.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Nov 24, 2025
async createChatMessage(message: Partial<ChatHubMessage>, trx?: EntityManager) {
async createChatMessage(message: QueryDeepPartialEntity<ChatHubMessage>, trx?: EntityManager) {
const messageId = message.id;
if (typeof messageId === 'function') {
Copy link
Member Author

Choose a reason for hiding this comment

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

The check is needed because QueryDeepPartialEntity allows every property to be either a value or (() => string) for SQL functions like NOW().

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...li/src/modules/chat-hub/chat-message.repository.ts 60.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@blacksmith-sh

This comment has been minimized.

@currents-bot
Copy link

currents-bot bot commented Nov 24, 2025

E2E Tests: n8n tests passed after 9m 16s

🟢 588 · 🔴 0 · ⚪️ 12 · 🟣 4

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 1aa6cfa

  • Spec files: 96

  • Overall tests: 600

  • Duration: 9m 16s

  • Parallelization: 9

Groups

GroupId Results Spec Files Progress
ui 🟢 539 · 🔴 0 · ⚪️ 12 · 🟣 4 90 / 90
ui:isolated 🟢 49 · 🔴 0 · ⚪️ 0 6 / 6


This message was posted automatically by currents.dev | Integration Settings

Copy link
Contributor

@mike12345567 mike12345567 left a comment

Choose a reason for hiding this comment

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

LGTM - fixes the issue for me locally!

@ivov ivov merged commit 6a36905 into master Nov 24, 2025
65 of 68 checks passed
@ivov ivov deleted the ci-fix-TypeScript-excessively-deep-type-instantiation-in-chat-hub-repository branch November 24, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants