Skip to content

Revert "fix: upload chat-message markup as MarkupBlobRef instead of raw HTML (HULY-20)" - #45

Merged
IamCoder18 merged 1 commit into
mainfrom
revert-44-fix/huly-20-markup-content-for-chat-messages
Aug 11, 2026
Merged

Revert "fix: upload chat-message markup as MarkupBlobRef instead of raw HTML (HULY-20)"#45
IamCoder18 merged 1 commit into
mainfrom
revert-44-fix/huly-20-markup-content-for-chat-messages

Conversation

@IamCoder18

Copy link
Copy Markdown
Owner

Reverts #44

@IamCoder18
IamCoder18 merged commit 0107d56 into main Aug 11, 2026
2 checks passed
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 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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() }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@kilo-code-bot

kilo-code-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 10 Issues Found | Recommendation: Address before next release

Overview

Severity Count
CRITICAL 10
WARNING 0
SUGGESTION 0

This PR is a pure revert of #44 (the HULY-20 markup fix). Every + line storing message reintroduces the original bug: raw HTML is written to the message field instead of a MarkupBlobRef pointing at a prosemirror-JSON blob in MinIO. The Huly platform keys markup by ${class}:${id}:${attribute} and expects message to reference that blob; raw HTML breaks prosemirror rendering, search/index alignment, and cross-client consistency (web/desktop) for the affected surfaces.

The revert also silently drops two useful behaviours from #44:

  • The wouldUploadMarkup block in --dry-run previews for sendChannelMessage and sendDmMessage (users can no longer see that a markup upload would occur).
  • All HULY-20 explanatory comments that documented why the markup blob pre-upload is required.

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

File Line Issue
packages/cli/src/resources/activity.ts 374 addReply stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/activity.ts 415 updateReply stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/approvals.ts 300 commentOnApproval stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/channel.ts 550 sendChannelMessage stores raw HTML in message (HULY-20 regression; wouldUploadMarkup dry-run hint also dropped).
packages/cli/src/resources/channel.ts 614 updateChannelMessage stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/channel.ts 741 addThreadReply stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/channel.ts 794 updateThreadReply stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/channel.ts 1042 sendDmMessage stores raw HTML in message (HULY-20 regression; wouldUploadMarkup dry-run hint also dropped).
packages/cli/src/resources/comment.ts 97 addComment stores raw HTML in message (HULY-20 regression).
packages/cli/src/resources/comment.ts 140 updateComment stores raw HTML in message (HULY-20 regression).
Files Reviewed (4 files)
  • packages/cli/src/resources/activity.ts - 2 issues
  • packages/cli/src/resources/approvals.ts - 1 issue
  • packages/cli/src/resources/channel.ts - 5 issues
  • packages/cli/src/resources/comment.ts - 2 issues

Fix these issues in Kilo Cloud


Reviewed by minimax-m3 · Input: 39.2K · Output: 16.3K · Cached: 185.5K

IamCoder18 added a commit that referenced this pull request Aug 11, 2026
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.
IamCoder18 added a commit that referenced this pull request Aug 11, 2026
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.
IamCoder18 added a commit that referenced this pull request Aug 11, 2026
)

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

1 participant