Files
open-design-crew[bot] 98f2fd1a46 fix(chat): hide undesigned cards and auxiliary message panels (#7956)
* fix(chat): render cards inside execution records

Render supported od-card payloads inside execution records with the existing
card components, instance scopes, and browser-assistance callback. Preserve
Markdown code examples and isolate card payloads from later Markdown parsing.

* test(web): await writable scope before deleting a conversation

* fix(web): buffer streamed card opener prefixes

* fix(web): remove undesigned ChatPanel cards (OPEND-2971)

Remove task-brief and rule-proposal presentation and their exclusive UI,
styles, and translations following the explicit product decision.
Preserve quoted card examples, neighboring prose, and the three retained
card kinds, including browser-assist callbacks.

* fix(chat): stop generating undesigned brief and rule cards

* test(web): use supported role query options for removed cards

* fix(chat): hide retired brand browser assistance cards

* fix(web): hide undesigned assistant message panels

* test(web): specify the brand project kind in hidden UI fixture

* style(web): remove trailing blank line after panel styles

* fix(web): hide verification scorecards in ChatPanel

* test(chat): align retired UI expectations with approved hiding

* fix(chat): keep card payloads opaque to question form parsing

* fix(web): preserve card parsing across replay metadata

Keep marker masking aligned with physical run boundaries, and replace repeated
Markdown tail scans with a forward indexed walk. Preserve actual forms and raw
code examples with replay and paragraph-boundary regression coverage.

* fix(web): keep form field syntax inside its payload

Recognize complete forms through the existing parser before scanning their
fields for card or code markers. Preserve sibling form actions and keep outer
card/code ownership with callback-based parsing that avoids an import cycle.

* fix(chat): share question form protocol context with host detection

---------

Co-authored-by: lefarcen <935902669@qq.com>
2026-09-10 10:24:07 +00:00

43 lines
2.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { splitOnQuestionForms } from '../../src/artifacts/question-form';
const NESTED_FORM = "<question-form id='card-owned'><question-text id='hidden' label='Card-owned question'/></question-form>";
const REAL_FORM = `<question-form id='actual-prose'>${JSON.stringify({
questions: [{ id: 'audience', type: 'text', label: 'Actual prose question' }],
})}</question-form>`;
function card(index: number): string {
return `<od-card type="rule-proposal">${JSON.stringify({
kind: 'rule-proposal', name: `Rule ${index}`,
assertion: `${NESTED_FORM} unmatched payload backtick: \``, check: 'Existing rule check',
}, null, 2)}</od-card>`;
}
function expectOnlyActualForm(input: string) {
const segments = splitOnQuestionForms(input);
const forms = segments.filter((segment) => segment.kind === 'form');
expect(forms).toHaveLength(1);
expect(forms[0]?.form).toMatchObject({
id: 'actual-prose',
questions: [{ id: 'audience', type: 'text', label: 'Actual prose question' }],
});
expect(segments.map((segment) => segment.kind === 'form' ? segment.raw : segment.text).join('')).toBe(input);
}
describe('card-separated Markdown boundaries for real question forms', () => {
it('keeps adjacent card payload backticks opaque and preserves following literal code and a real form', () => {
// Behavioral sequence coverage, not a wall-clock benchmark or a call-count
// assertion about the scanner's implementation.
const cards = Array.from({ length: 64 }, (_, index) => card(index)).join('');
const input = `${cards}\n\n\`${NESTED_FORM}\`\n\n${REAL_FORM}`;
expectOnlyActualForm(input);
});
it.each(['# ', '- ', '1. '])('starts fresh Markdown after a card on a %s line', (prefix) => {
// The complete card ends the old heading/list render. The new paragraph's
// inline-code pair can cross a newline, and its quoted form is not real.
const input = `${prefix}${card(1)}\`literal example\n${NESTED_FORM}\`\n\n${REAL_FORM}`;
expectOnlyActualForm(input);
});
});