Revert "fix: upload chat-message markup as MarkupBlobRef instead of raw HTML (HULY-20)" - #45
Conversation
…aw HTML …" This reverts commit 0a16ceb.
| const newReplyId = generateId() | ||
| const messageRef = await uploadMarkup(client, ACTIVITY_CLASS, newReplyId, 'message', opts.body, 'markup') | ||
| const data: Record<string, unknown> = { message: messageRef } | ||
| const data: Record<string, unknown> = { message: opts.body } |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for addReply, reintroducing the HULY-20 bug that #44 fixed. The Huly platform expects message to be a MarkupBlobRef (prosemirror-JSON blob in MinIO keyed by ${class}:${id}:${attribute}); storing raw HTML breaks prosemirror rendering, search/indexing, and consistency with the web/desktop clients.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| doc.space as unknown as Ref<Space>, | ||
| id as Ref<Doc>, | ||
| { message: messageRef, modifiedOn: Date.now() } as any, | ||
| { message: opts.body, modifiedOn: Date.now() } as any, |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for updateReply, reintroducing the HULY-20 bug that #44 fixed. Editing a reply will not update its prosemirror markup blob — instead the platform will receive raw HTML, which it cannot render correctly.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| 'markup', | ||
| ) | ||
| const data: Record<string, unknown> = { message: messageRef } | ||
| const data: Record<string, unknown> = { message: opts.body } |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for commentOnApproval, reintroducing the HULY-20 bug that #44 fixed. The ChatMessage doc created here will carry raw HTML rather than a MarkupBlobRef, breaking prosemirror rendering on the approval thread.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| } | ||
| const data: Record<string, unknown> = { | ||
| message: messageRef, | ||
| message: body, |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for sendChannelMessage, reintroducing the HULY-20 bug that #44 fixed. Newly sent channel messages will be stored as raw HTML instead of a MarkupBlobRef, so the web/desktop clients will not be able to render them via prosemirror.
Note: this hunk also silently drops the wouldUploadMarkup block from the dry-run preview, so --dry-run no longer reflects the markup upload side-effect at all.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| } | ||
| const data: Record<string, unknown> = { | ||
| message: messageRef, | ||
| message: body, |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for updateChannelMessage, reintroducing the HULY-20 bug that #44 fixed. Edits will overwrite the existing MarkupBlobRef (if any) with a raw HTML string, breaking prosemirror rendering for the edited message.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| } | ||
| const data: Record<string, unknown> = { | ||
| message: messageRef, | ||
| message: body, |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for addThreadReply, reintroducing the HULY-20 bug that #44 fixed. Thread replies will no longer be stored as MarkupBlobRefs under chunter:class:ThreadMessage, breaking prosemirror rendering of thread replies.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ) | ||
| } | ||
| const data: Record<string, unknown> = { message: messageRef, editedOn: Date.now() } | ||
| const data: Record<string, unknown> = { message: body, editedOn: Date.now() } |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for updateThreadReply, reintroducing the HULY-20 bug that #44 fixed. Thread-reply edits will land as raw HTML rather than updating the prosemirror markup blob.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| messageRef = await uploadMarkup(client, CHAT_MESSAGE_CLASS, newMessageId, 'message', body, 'markup') | ||
| } | ||
| const data: Record<string, unknown> = { message: messageRef } | ||
| const data: Record<string, unknown> = { message: body } |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for sendDmMessage, reintroducing the HULY-20 bug that #44 fixed. DMs will be stored as raw HTML rather than a MarkupBlobRef, breaking prosemirror rendering on the DM surface.
Note: this hunk also silently drops the wouldUploadMarkup block from the dry-run preview, so --dry-run no longer reflects the markup upload side-effect.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| 'comments', | ||
| { message: messageRef } as any, | ||
| newMessageId, | ||
| { message: body } as any, |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for addComment, reintroducing the HULY-20 bug that #44 fixed. New issue comments will be stored as raw HTML instead of a MarkupBlobRef, breaking prosemirror rendering of issue comments and search/index alignment with web/desktop clients.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| (comment as Doc).space as Ref<Doc>, | ||
| commentId as Ref<Doc>, | ||
| { message: messageRef, editedOn: Date.now() } as any, | ||
| { message: body, editedOn: Date.now() } as any, |
There was a problem hiding this comment.
CRITICAL: This revert restores raw HTML in the message field for updateComment, reintroducing the HULY-20 bug that #44 fixed. Comment edits will overwrite the existing MarkupBlobRef with a raw HTML string, breaking prosemirror rendering of the edited comment.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 10 Issues Found | Recommendation: Address before next release Overview
This PR is a pure revert of #44 (the HULY-20 markup fix). Every The revert also silently drops two useful behaviours from #44:
The PR description ("Reverts #44") does not state why the fix is being reverted (e.g. regression, perf, wrong blob key). Without that justification the revert ships a known regression on every chat/comment/reply/approval-comment/DM/thread surface. Issue Details (click to expand)CRITICAL
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Reviewed by minimax-m3 · Input: 39.2K · Output: 16.3K · Cached: 185.5K |
The original attempt (PR #44, reverted in #45) called uploadMarkup and stored a MarkupBlobRef string in `message`. That rendered as literal text in the web UI because the front-end's MessageViewer component does: $: node = markupToJSON(message) with no MarkupBlobRef resolution step. ChatMessage.message is typed `TypeMarkup()` — an inline prosemirror-JSON string (`Markup = string` in @hcengineering/core), not a MarkupBlobRef. Why the same pattern appeared to work for Issue.description: Issue.description is also `TypeMarkup()`, but the web UI renders it through `<CollaborativeTextEditor>`, which DOES resolve MarkupBlobRef via the collaborator service. So `huly issue update --body` accidentally worked. The chat/dm/thread/activity paths render through plain `MessageViewer` and broke. Fix: * Convert HTML → prosemirror JSON locally via the existing `htmlToMarkup()` helper. * Store the resulting prosemirror-JSON string inline in `message` — no blob upload, no MarkupBlobRef. * Same pattern applied to all 10 chat-message write paths: comment add/update, channel message send/update, thread reply add/update, dm message send, activity reply add/update, approval comment. Removed from the previous PR (no longer relevant): * `uploadMarkup` and `generateId` imports — not used anymore. * Deferred-upload pattern for dry-run on channel paths — dry-run preview now shows the converted prosemirror JSON (which is what would be stored). No external IO involved in conversion, so no point deferring. * `wouldUploadMarkup` notes in dry-run output — n/a, no upload. Verified on https://huly.aaravlabs.com (real server): * Posted via the local build: `node dist/index.js comment add --issue HULY-20 --body-file /tmp/kilo/huly20-fix2.html`. * message field stores inline prosemirror JSON starting with `{"type":"doc","content":[{"type":"heading",...}]}`. * Web UI's MessageViewer can render this directly without any collaborator lookup.
The original attempt (PR #44, reverted in #45) called uploadMarkup and stored a MarkupBlobRef string in `message`. That rendered as literal text in the web UI because the front-end's MessageViewer component does: $: node = markupToJSON(message) with no MarkupBlobRef resolution step. ChatMessage.message is typed `TypeMarkup()` — an inline prosemirror-JSON string (`Markup = string` in @hcengineering/core), not a MarkupBlobRef. Why the same pattern appeared to work for Issue.description: Issue.description is also `TypeMarkup()`, but the web UI renders it through `<CollaborativeTextEditor>`, which DOES resolve MarkupBlobRef via the collaborator service. So `huly issue update --body` accidentally worked. The chat/dm/thread/activity paths render through plain `MessageViewer` and broke. Fix: * Convert HTML → prosemirror JSON locally via the existing `htmlToMarkup()` helper. * Store the resulting prosemirror-JSON string inline in `message` — no blob upload, no MarkupBlobRef. * Same pattern applied to all 10 chat-message write paths: comment add/update, channel message send/update, thread reply add/update, dm message send, activity reply add/update, approval comment. Removed from the previous PR (no longer relevant): * `uploadMarkup` and `generateId` imports — not used anymore. * Deferred-upload pattern for dry-run on channel paths — dry-run preview now shows the converted prosemirror JSON (which is what would be stored). No external IO involved in conversion, so no point deferring. * `wouldUploadMarkup` notes in dry-run output — n/a, no upload. Verified on https://huly.aaravlabs.com (real server): * Posted via the local build: `node dist/index.js comment add --issue HULY-20 --body-file /tmp/kilo/huly20-fix2.html`. * message field stores inline prosemirror JSON starting with `{"type":"doc","content":[{"type":"heading",...}]}`. * Web UI's MessageViewer can render this directly without any collaborator lookup.
) The original attempt (PR #44, reverted in #45) called uploadMarkup and stored a MarkupBlobRef string in `message`. That rendered as literal text in the web UI because the front-end's MessageViewer component does: $: node = markupToJSON(message) with no MarkupBlobRef resolution step. ChatMessage.message is typed `TypeMarkup()` — an inline prosemirror-JSON string (`Markup = string` in @hcengineering/core), not a MarkupBlobRef. Why the same pattern appeared to work for Issue.description: Issue.description is also `TypeMarkup()`, but the web UI renders it through `<CollaborativeTextEditor>`, which DOES resolve MarkupBlobRef via the collaborator service. So `huly issue update --body` accidentally worked. The chat/dm/thread/activity paths render through plain `MessageViewer` and broke. Fix: * Convert HTML → prosemirror JSON locally via the existing `htmlToMarkup()` helper. * Store the resulting prosemirror-JSON string inline in `message` — no blob upload, no MarkupBlobRef. * Same pattern applied to all 10 chat-message write paths: comment add/update, channel message send/update, thread reply add/update, dm message send, activity reply add/update, approval comment. Removed from the previous PR (no longer relevant): * `uploadMarkup` and `generateId` imports — not used anymore. * Deferred-upload pattern for dry-run on channel paths — dry-run preview now shows the converted prosemirror JSON (which is what would be stored). No external IO involved in conversion, so no point deferring. * `wouldUploadMarkup` notes in dry-run output — n/a, no upload. Verified on https://huly.aaravlabs.com (real server): * Posted via the local build: `node dist/index.js comment add --issue HULY-20 --body-file /tmp/kilo/huly20-fix2.html`. * message field stores inline prosemirror JSON starting with `{"type":"doc","content":[{"type":"heading",...}]}`. * Web UI's MessageViewer can render this directly without any collaborator lookup.
Reverts #44