Skip to content

refactor(ui): move user-message layout onto Astryx primitives - #5848

Merged
Colafornia merged 2 commits into
apache:mainfrom
Colafornia:refactor/5795-user-message-stack
Sep 30, 2026
Merged

Colafornia merged 2 commits into
apache:mainfrom
Colafornia:refactor/5795-user-message-stack

Conversation

@Colafornia

Copy link
Copy Markdown
Member
English

Summary

First slice of the #5795 area split — the user-message surface (bubble, attachments, quote chips, meta row). Hand-written flex moves onto Astryx primitives: the quotes row and attachment rows are HStacks, the quote chip's width/max-width/align-items/padding-block become HStack props, the meta row's redundant display/align-items declarations are dropped (ChatMessageMetadata already owns them), and the transient-message wrapper div is deleted by moving data-transient-message-id onto ChatMessage itself. Marker classes consumed by tests and WorkHub CSS (.maka-user-message, .maka-user-quotes, .maka-message-meta, .maka-quote-chip*) are preserved.

Verified with the pixel-diff tool from #5794 (not yet merged — run from that branch).

Refs #5795

Verification

  • shots:storybook compare against the ec324da4f baseline → 0 changed, 40 identical, 0 skipped (exit 0)
  • storybook-visual-smoke.mjs on the rebuilt catalog → 439 stories / 479 theme renders pass, play functions included
  • tsc --noEmit on @maka/ui clean; 45 focused unit tests pass (quote-ref-chip, chat-turn-answer-identity, chat-turn-steering-order)
  • npx biome check clean on touched files

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Devin — refactor authored by the agent; pixel comparison, smoke, and unit tests run locally.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
中文

Summary

#5795 分区拆分的第一片——用户消息面(气泡、附件、引用 chips、meta 行)。手写 flex 迁到 Astryx 原语上:引用行和附件行改为 HStack,quote chip 的 width/max-width/align-items/padding-block 改为 HStack props,meta 行中冗余的 display/align-items 声明被删除(ChatMessageMetadata 本就自带),transient 消息外层的 div 也通过把 data-transient-message-id 挪到 ChatMessage 本体上而删除。测试和 WorkHub CSS 消费的标记类(.maka-user-message、.maka-user-quotes、.maka-message-meta、.maka-quote-chip*)全部保留。

使用 #5794 的像素对比脚本验证(该工具尚未合入——在其分支上运行)。

Refs #5795

Verification

  • shots:storybook compare 对照 ec324da4f 基线 → 0 changed, 40 identical, 0 skipped(退出码 0)
  • storybook-visual-smoke.mjs 跑重建后的 catalog → 439 个 story / 479 个主题渲染全部通过,含 play 函数
  • @maka/ui 的 tsc --noEmit 干净;45 个相关单测通过(quote-ref-chip、chat-turn-answer-identity、chat-turn-steering-order)
  • npx biome check 对改动文件无告警

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Devin —— 重构由 agent 编写;像素对比、smoke 和单测均在本地运行。

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Replaces hand-written flex rules in the user-message surface with HStack/ChatMessageMetadata props: the quotes row, attachment rows, quote chips, and the meta row's redundant flex declarations. Product CSS keeps only appearance and the deliberate 6px spacing nudge; marker classes queried by tests and WorkHub stay in place.

Verified lossless: 40/40 storybook pixel shots identical to the ec324da baseline, 479-render smoke all passing.

Part of apache#5795.

Generated-by: Devin

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 29, 2026
Moves data-transient-message-id onto ChatMessage itself (BaseProps forwards data-*), deleting the native wrapper div entirely. Quote chip width/max-width/align/padding-block move to HStack props, leaving the variant classes with only radius and the documented 24px height pin.

Verified lossless again: 40/40 pixel-identical to baseline, 45 focused tests pass.

Part of apache#5795.

Generated-by: Devin

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Colafornia
Colafornia force-pushed the refactor/5795-user-message-stack branch from de5596f to a86cf89 Compare September 29, 2026 16:34

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed head a86cf899aafda9f031a07ccb9d7013a89c3d41bd. No P0–P3.

  • The layout moves onto HStack props with equivalent values: gap 1 = 4px, paddingInline 2 = 8px, paddingBlock 1 / 0.5 = 4px / 2px, the collapsed maxWidth of 240px, and align start/center. The CSS keeps only paint (background, inset border, radius) and the collapsed height pin that #1879 documents.
  • Deleting the transient wrapper is safe:
    • LocalizedChatMessage spreads the remaining props into ChatMessage, so data-transient-message-id still reaches the DOM.
    • The only CSS consumer (chat-message.css:86, overflow-anchor: none) excludes the element and its subtree either way.
    • The tests and stories that query the attribute look for the element itself, not a descendant of it.
  • The dropped class names maka-user-attachment-tokens and maka-user-attachments have no remaining references anywhere in the repo. The marker classes WorkHub and tests rely on are kept.
  • The Astryx surface inventory is updated for the new HStack import in quote-ref-chip.tsx.

The PR reports a zero-diff pixel compare (40/40 identical) and a green Storybook smoke. CI test was still running when I posted.

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

No actionable findings on this head. The user-message quote and attachment rows move to Astryx HStack props with the prior gap, wrapping, alignment, and width constraints; the quote chip keeps its visual paint and collapsed height. Removing the transient wrapper preserves data-transient-message-id on ChatMessage itself, which forwards it to the article DOM node, so the existing scroll-anchor exclusion and query selectors still apply. The Astryx inventory is updated for the new primitive.

I ran a clean Node 24 build, the three focused UI suites (45/45), the Astryx surface inventory, and git diff --check. Desktop Storybook built, and I rendered the sent-quote interaction in Chromium: the expanded chip, quotes row, metadata alignment, and hover card were present without page errors. The exact-head hosted test check is green; the PR base matches current main. I did not independently reproduce the author’s 40-image baseline pixel comparison or run the full Storybook smoke catalog.

Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving at a86cf899aafda9f031a07ccb9d7013a89c3d41bd: no P0–P3, CI green on this head. Details in #5848 (review).

@Colafornia
Colafornia merged commit 4c79e39 into apache:main Sep 30, 2026
1 check passed
@Colafornia
Colafornia deleted the refactor/5795-user-message-stack branch September 30, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants