fix(brain): collapsed-run time range rendered HTML as literal text#1215
Merged
Conversation
E2E playwright test against the Brain tab caught literal `<span style="opacity:0.45;font-size:10px;margin-right:3px;">13 May</span>` text appearing in the collapsed-outbound row's time range. `formatBrainTime()` returns trusted HTML (wraps the date prefix in a styled span), so wrapping `rangeLabel` in `escHtml()` turned that markup into visible text. Drop the escape — the helper output is trusted and the literal " → " separator carries no user input. Caught during full E2E verification of #1212 + #1213.
This was referenced May 14, 2026
Owner
Author
UX review
|
Owner
Author
Product review
|
This was referenced May 14, 2026
vivekchand
added a commit
that referenced
this pull request
May 16, 2026
formatBrainTime() returns HTML (a <span> wrapping the date prefix for opacity styling), making rangeLabel an HTML string that must NOT be passed through escHtml() — a fragile invariant that already caused one regression (PR #1215 double-escaped it). Add _formatBrainTimePlain() that returns "Today 14:23:45" as plain text. Switch the two formatBrainTime() calls in the collapsed-run rangeLabel path to use it; the range label can now be safely escaped with escHtml() and the warning comment explaining why not to escape is gone. No change to existing formatBrainTime() callers — the styled brain-time spans are unaffected. Minor visual: date prefix in collapsed-range badge no longer has reduced opacity, which is acceptable in a summary badge. Closes #1222 Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<span style=\"opacity:0.45;...\">13 May</span>text appearing in the Brain tab's collapsed-outbound row.formatBrainTime()returns trusted HTML; wrappingrangeLabelinescHtml()turned that markup into visible text.escHtmlcall (the literal→separator carries no user input, the helper output is trusted).Test plan
13 May 22:54:19 → 13 May 19:54:45instead of escaped<span>.🤖 Generated with Claude Code