fix(ui): show avatar initials for single-segment usernames; tooltip truncated chart names#577
Conversation
Worth fixing before merge1. Docstring contradicts the implementation.
Plus the rule list says "if the local-part contains separators, use the first letter of each segment" — but the code branches on Fix either way: tighten the impl with a final letter-check ( 2. Whitespace bug. 3. The Style nits (same as #579)4. 5. The docstring's last paragraph references Considered but skipping
Net: docstring/impl coherence + whitespace fix can be one commit; twMerge test is its own; ticket-ref cleanup is mechanical. Otherwise the PR is in good shape — twMerge swap was verified to regress nothing, peer-dep call is right, the substantive Tailwind comment is keeper material. |
Address PR-review-toolkit findings on PR #577. The v2 docstring promised: - returns '' for inputs with no usable letters - if local-part contains separators, use the first letter of each segment The v2 implementation didn't honour either: - computeUserInitials('..') → '..' (returned the raw localPart) - computeUserInitials('123') → '12' (digits leaked through) - computeUserInitials('_') → '_' (separator leaked through) - computeUserInitials('.user') → '.U' (separator leaked through) - computeUserInitials('mary.') → 'MA' (whole-localPart fallback ignored the separator contract for single-segment) Rewrite to actually match the contract: 1. Strip @-domain. 2. Split on ./_/-, then drop non-letters per segment. 3. 0 segments after cleanup → '' (caller draws silhouette). 4. >= 2 → first letter of first 2 segments, uppercased. 5. 1 → first 1-2 letters of THAT segment. Tests pin all five v2 leaks plus digit / interleaved-punct cases. Also strip the SKY-825 / bug-43 trailer from ChartBrowser per CLAUDE.md (Tooltip already uses twMerge so the underlying Tailwind-merge concern is already handled in the component). Made-with: Cursor
|
@nadaverell @hisco — ready for review. Cursor bugbot found 2 issues: tailwind class conflict on Tooltip wrapper and avatar initials including separator chars. Both addressed: 75a43ae ( |
Visual testTested locally on Bug 43 - long chart name tooltip ✓Helm Catalog → hovered `prometheus-yet-another-cloudwatch-exporter` (40-char name). Tooltip renders above the card with the full name (shown even when the card itself manages to fit it - the tooltip is the truncation safety-net at narrower viewports): DOM check: the Bug 41 - avatar initials computationCould not exercise - radar OSS launched here has no authenticated VerdictBug 43 visually verified. Bug 41 helper + tests are correct by inspection; needs a follow-up check in cloud where the avatar actually renders. |
…runcated chart names
SKY-825 cosmetic batch — addresses bugs 41 and 43 from the survey;
bugs 42 (Stop-Claude pill overlap — that pill is the Cursor IDE
agent UI, not radar) and 60 (no-op '+' button — could not reproduce
in OSS, the create-resource handler is wired and the dialog
renders) are out of scope here.
41. Account menu avatar showed a generic silhouette while another
circle in the header (radar-hub-web's own avatar) showed
correctly-computed initials — duplicated identity affordance.
Root cause: the initials computation only looked at separator-
split segments of the username's local-part, so a username like
"mkohli" (no '.', '_', '-') produced no initials and the
silhouette fallback kicked in.
Fix: extract `computeUserInitials` into
`packages/k8s-ui/src/utils/user-initials.ts`. New rule: if the
local-part splits into 2+ segments, use the first letter of each
(max 2). Otherwise fall back to the leading 1-2 letters of the
whole local-part. Always uppercased. 9 unit tests pin the
contract including the bug 41 fixture verbatim.
43. Long chart names (e.g. "super-long-chart-nam…") in the Helm
catalogue were truncated with no way to read the full string.
Fix: wrap both card variants' `<h4 truncate>` in `<Tooltip
content={chart.name}>` so the user can hover to reveal the full
name. Reuses the existing Tooltip primitive (which itself was
fixed in PR #570 to anchor correctly and dismiss on click).
Linear: SKY-825
Made-with: Cursor
Cursor Bugbot caught: the `Tooltip` wrapper used `clsx('inline-flex
max-w-full', wrapperClassName)`. When a caller passed a conflicting
display utility (e.g. `wrapperClassName="block"` from ChartBrowser,
which needs the wrapper to fill its `flex-1 min-w-0` parent so the
child's `truncate` triggers), `clsx` simply concatenated and Tailwind's
generated stylesheet ordering — not className order — decided which
display won. `inline-flex` always won, and `block` was silently
dropped, leaving truncated chart names without their tooltip.
Fix:
- Add `tailwind-merge` as a peerDep of @skyhook-io/k8s-ui (web
already has it as a dep).
- Wrap the wrapper className in `twMerge(clsx(...))`. tailwind-merge
is Tailwind-aware and resolves utility-group conflicts in favour
of the later (caller-supplied) value.
No call-site changes — `wrapperClassName="block"` in ChartBrowser
now actually overrides the default.
Made-with: Cursor
Address PR-review-toolkit findings on PR #577. The v2 docstring promised: - returns '' for inputs with no usable letters - if local-part contains separators, use the first letter of each segment The v2 implementation didn't honour either: - computeUserInitials('..') → '..' (returned the raw localPart) - computeUserInitials('123') → '12' (digits leaked through) - computeUserInitials('_') → '_' (separator leaked through) - computeUserInitials('.user') → '.U' (separator leaked through) - computeUserInitials('mary.') → 'MA' (whole-localPart fallback ignored the separator contract for single-segment) Rewrite to actually match the contract: 1. Strip @-domain. 2. Split on ./_/-, then drop non-letters per segment. 3. 0 segments after cleanup → '' (caller draws silhouette). 4. >= 2 → first letter of first 2 segments, uppercased. 5. 1 → first 1-2 letters of THAT segment. Tests pin all five v2 leaks plus digit / interleaved-punct cases. Also strip the SKY-825 / bug-43 trailer from ChartBrowser per CLAUDE.md (Tooltip already uses twMerge so the underlying Tailwind-merge concern is already handled in the component). Made-with: Cursor
0ab023e to
a760e41
Compare
|
You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace. To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard. |
Lock down two regression vectors flagged on PR #577: - Tooltip wrapperClassName: assert that a caller-supplied display utility wins over the default `inline-flex`. Without twMerge the wrapper silently kept inline-flex and ChartBrowser truncation stopped engaging. - computeUserInitials: assert leading/trailing whitespace doesn't leak as blank glyphs into the avatar circle and defeat the UserMenu's silhouette fallback. Also strip ticket/PR/diff-history references from existing user- initials test comments per CLAUDE.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6bbaf88. Configure here.
Every other entry in peerDependencies has a matching devDependencies pin so the package can be type-checked, tested, and built standalone. tailwind-merge was added to peerDependencies in this branch but the devDependencies mirror was missed; Tooltip.test.tsx transitively depends on it, so running vitest against the package outside the monorepo (or under different hoisting rules) would fail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@nadaverell a reminder |
|
@nadaverell — final review-comment items from #issuecomment-4350877739 addressed.
Test suite: |


Summary
SKY-825 cosmetic batch:
Fixes
Bug 41 — silhouette avatar
The previous `UserMenu` initials computation only looked at separator-split segments of the username's local-part, so a username like `mkohli` (no `.`, `_`, `-`) produced no initials and the silhouette fallback kicked in.
Extracted `computeUserInitials` into `packages/k8s-ui/src/utils/user-initials.ts` with a clearer rule:
9 unit tests pin the contract including the bug 41 fixture verbatim, separator variants, the 2-cap, the @-domain stripping, edge cases (consecutive separators, single-character, empty/null).
Bug 43 — truncated chart names
Wrapped both `ChartBrowser` card variants' `
` in `` so users can hover to reveal the full name. Reuses the existing Tooltip primitive (itself fixed in PR #570 to anchor correctly and dismiss on click).
Test plan
Made with Cursor
Note
Low Risk
Low risk UI/utility changes: adds a small pure helper for initials and adjusts tooltip class merging, with unit tests to pin behavior.
Overview
Fixes two UI papercuts: user avatar initials now come from a shared
computeUserInitialshelper that handles single-segment usernames/emails and filters non-letter glyphs, and the HelmChartBrowsernow wraps truncated chart titles inTooltipso the full name is visible on hover.Updates
Tooltipto usetailwind-mergewhen combining its default wrapper classes withwrapperClassName, allowing callers (e.g. chart cards) to override display utilities correctly; adds targeted unit tests for both the tooltip class-merge contract and the new initials helper.Reviewed by Cursor Bugbot for commit 7175703. Bugbot is set up for automated code reviews on this repo. Configure here.