fix: wrap rich-text fields in <p> so TM renders special characters correctly - #356
Conversation
…al chars TM's v2 API entity-encodes <, > and & in step/result, preconditions and description on write, and the TM UI renders those fields as rich text only when the value is HTML-wrapped — bare text is displayed literally, so a plain ">" surfaced to users as ">" (PMAA-185, FD 1709260, TM-26634). Per the TM team, external API content must be wrapped in <p> tags. Wrap those fields on createTestCase and updateTestCase when the value is not already HTML and contains an encodable character; all other payloads are sent unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SavioBS629
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 3 inline finding(s). Full report in the PR comment below. Verdict: Failed - see PR comment.
Claude Code PR ReviewPR: #356 • Head: cc3a498 • Reviewers: review (built-in fallback; no in-scope project reviewers discovered) SummaryWraps TM rich-text fields (step/result, preconditions, description) in Review Table
Findings
Verdict: FAIL — one High data-loss finding; fix is a two-line escape before wrapping, verified against the live TM API. |
…own editor TM's sanitizer (Sanitize.fragment with RTE_ALLOWED_CONTENT) strips unknown tag-like tokens inside HTML values, so wrapping unescaped text lost content like "<Enter>" or "List<String>". TM's own Lexical editor and import paths escape text then wrap in <p>; do the same, and pass through only values that start with a tag from TM's allowed-elements list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude Code PR ReviewContinues the previous review — changes since PR: #356 • Head: aca16d4 • Reviewers: review (built-in fallback; no in-scope project reviewers discovered) SummaryDelta adds entity-escaping before the Review Table
Findings
Note (informational, not a finding): bare text is now treated strictly as literal text — a client that pre-encodes Verdict: PASS — all three prior findings resolved and verified against the live TM API; no new findings in the delta. |
Summary
Fixes PMAA-185 (FD 1709260, originally TM-26634): test cases created/updated via MCP displayed
>as the literal text>in the TM UI.Root cause
TM's v2 API entity-encodes
<,>and&in step/result, preconditions and description on write, and the TM UI renders those fields as rich text only when the value is HTML-wrapped — bare text is displayed literally. The MCP server sent bare text, so a plain>surfaced to users as>. Confirmed with the TM team: external API content must be wrapped in<p>tags (their supported contract).Fix
New
rich-text.tshelper wraps a value in<p>…</p>when it is not already HTML and contains an encodable character (<,>,&). Applied totest_case_steps(step + result),preconditionsanddescriptionincreateTestCase(v1 and v2 paths) andupdateTestCase. Payloads without encodable characters, and values that are already HTML, are sent unchanged.Verification
Settings > Users→ storedSettings > Users→ UI shows literal>(bug, repro TC-5315740 / TC-5352932 via plain curl, no MCP involved)<p>Settings > Users</p>→ stored<p>Settings > Users</p>→ UI rendersSettings > Userscorrectly (TC-5358753, confirmed by TM team screenshot)tscand eslint clean.🤖 Generated with Claude Code