You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/27 09:17:49 UTC

(maka) 02/02: test(ui): pin the container as the sole markdown reading measure

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch fix/desktop-transcript-prose-measure
in repository https://gitbox.apache.org/repos/asf/maka.git

commit 1d67f0326e044ff5a27d86d2e06644a37561a1b1
Author: AstroHan <le...@outlook.com>
AuthorDate: Thu Aug 27 16:31:45 2026 +0800

    test(ui): pin the container as the sole markdown reading measure
    
    The prose disclaimer that keeps a turn to one right edge is invisible until
    someone measures a rendered turn, and one Astryx default away from silently
    returning. Pin it where a dropped prop or an upstream default change fails in
    milliseconds, instead of only in the desktop transcript E2E.
    
    Generated-by: Claude Code
---
 .../__tests__/markdown-measure-contract.test.tsx   | 76 ++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/packages/ui/src/__tests__/markdown-measure-contract.test.tsx b/packages/ui/src/__tests__/markdown-measure-contract.test.tsx
new file mode 100644
index 000000000..cfc99d88b
--- /dev/null
+++ b/packages/ui/src/__tests__/markdown-measure-contract.test.tsx
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The reading measure has exactly one owner: the container the caller renders
+ * Markdown into. The transcript column is `--maka-transcript-measure`, Daily
+ * Review is its report column, Artifact Preview is the panel — each already
+ * clamps itself, and prose must inherit whichever one it lands in.
+ *
+ * Astryx disagrees by default: `Markdown` caps prose at 680px and aligns it to
+ * `start`, leaving code and tables to fill the container. Inside the 800px
+ * transcript column that produced a turn with two right edges — paragraphs
+ * stopping 120px short of the tool cards and the user bubble beside them.
+ * `MarkdownBody` therefore passes `contentWidth: 100%`, which is not a width
+ * choice but a disclaimer: Markdown holds no measure of its own.
+ *
+ * That disclaimer is invisible until someone measures a rendered turn, and it
+ * is one Astryx default away from silently coming back — so it is pinned here,
+ * where a prop drop or an upstream default change fails in milliseconds
+ * instead of waiting for the transcript E2E in `apps/desktop`.
+ *
+ * The 680 is deliberately NOT mirrored into a Maka token. A token would make
+ * the cap ours to keep in sync with Astryx's, which is the same two-authority
+ * defect wearing a token's name; and `contentWidth` cannot read the transcript
+ * token either, because `MarkdownBody` is shared with surfaces that are not the
+ * transcript.
+ */
+import assert from 'node:assert/strict';
+import { describe, it } from 'node:test';
+import { renderToStaticMarkup } from 'react-dom/server';
+import { MarkdownBody } from '../markdown-body.js';
+
+/** Astryx emits its resolved prose cap as this custom property. */
+const PROSE_WIDTH = /--x-maxWidth:\s*([^;"]+)/g;
+
+describe('markdown reading measure', () => {
+  it('leaves the prose cap to the container', () => {
+    const markup = renderToStaticMarkup(
+      <MarkdownBody
+        text={['## Heading two', '', 'A paragraph.', '', '- One item'].join('\n')}
+        density="compact"
+      />,
+    );
+
+    const caps = [...markup.matchAll(PROSE_WIDTH)].map(([, value]) => value.trim());
+    assert.ok(
+      caps.length > 0,
+      'no prose width was emitted at all. Astryx stopped resolving `contentWidth`, so this ' +
+        'contract can no longer see whether prose is capped — re-measure a turn before ' +
+        'deleting or rewriting it.',
+    );
+    assert.deepEqual(
+      [...new Set(caps)],
+      ['100%'],
+      'Markdown prose is capped below its container again. The container owns the reading ' +
+        'measure; a prose cap of its own puts a second right edge inside one turn, which is ' +
+        'the defect `contentWidth: 100%` in markdown-body.tsx exists to prevent.',
+    );
+  });
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org