fix(brain): use plain-text time in collapsed-run range label#1388
Merged
Conversation
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]>
Owner
Author
UX review
|
Owner
Author
Product review
|
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.
Closes #1222
Summary
formatBrainTime()returns HTML (a<span>wrapping the date prefix for opacity styling), makingrangeLabelin the collapsed-run path an HTML string that must not be passed throughescHtml()— a fragile invariant that already caused one regression (PR fix(brain): collapsed-run time range rendered HTML as literal text #1215 double-escaped it, rendering markup as literal text)._formatBrainTimePlain(isoStr)returning plain text ("Today 14:23:45"), no HTML tags.formatBrainTime()calls in the collapsed-runrangeLabelpath to_formatBrainTimePlain;rangeLabelis now a plain string safely wrapped withescHtml(), and the "do NOT escHtml or the markup renders as text" warning comment is gone.All existing
formatBrainTime()callers (the<span class="brain-time">rows) are unchanged. Minor visual: date prefix in the collapsed-range badge loses its reduced-opacity span — acceptable in a summary badge.Test plan
node tests/test_appjs_units.js— 89 passed, 0 failednode --check clawmetry/static/js/app.js— JS syntax OKmake lint— Python syntax OK (pre-existing ruff warnings in other files, none introduced by this change)Generated by Claude Code