Skip to content

fix(test): PORT-007 fails on hidden tooltip copy, not on a rendered banner - #2458

Open
dcccrypto wants to merge 1 commit into
playgroundfrom
fix/port007-tooltip-text-collision
Open

fix(test): PORT-007 fails on hidden tooltip copy, not on a rendered banner#2458
dcccrypto wants to merge 1 commit into
playgroundfrom
fix/port007-tooltip-text-collision

Conversation

@dcccrypto

Copy link
Copy Markdown
Owner

What broke

Portfolio.test.tsxPORT-007 "renders nothing (zero height) when no position is at risk" now fails on playground.

It is deterministic, not flaky: fails 3/3 on fb53c2ff, passes at b828e025 (before the trade-UI batch).

Root cause

90be44c0 swapped the Risk Lev. label's title= attribute for an <InfoIcon tooltip={RISK_LEVERAGE_TITLE}>.

<Tooltip> keeps its copy mounted permanently and hides it with inline visibility/opacity (it animates in on hover):

<span role="tooltip" style={{ visibility: "hidden", opacity: 0 }}>{text}</span>

So the text is invisible to users but still visible to queryByText (which filters only script, style). And:

RISK_LEVERAGE_TITLE = "…Extra collateral lowers liquidation risk."

which the assertion queryByText(/Liquidation risk/i) matches. The test was failing on hidden tooltip prose, not on a rendered AtRiskBanner.

The component behaviour is intentional (that's how the animated tooltip works) — the assertion was too loose.

Fix

Scope both negative assertions with ignore: '[role="tooltip"]'. Hidden tooltip copy is not a rendered banner, so it must not satisfy them. The sibling positive test already distinguished AtRiskBanner from PositionCard's per-row banner by case; this extends the same care to the negative case.

Verification — it still binds, it is not silenced

An ignore that hides a failure would be worse than the bug, so I mutation-tested it:

state PORT-007
fix applied passes
fix applied + AtRiskBanner's if (atRisk.length === 0) return null; guard neutralised FAILS
guard restored passes

The assertion still catches a genuinely mis-rendered banner.

Full suite (app/), with the open test-repair PRs stacked: 2805 passed, 0 failed.

Note

This was invisible to CI — see #2447: Unit Tests / Integration Tests / Coverage Gate report SKIPPED while the Merge Gate still reports SUCCESS.

🤖 Generated with Claude Code

…anner

The Risk Lev. label swapped its `title=` attribute for an <InfoIcon> (90be44c).
<Tooltip> keeps its copy mounted permanently and hides it with inline
visibility/opacity (it animates in on hover), so the text is invisible to users
but still visible to queryByText. RISK_LEVERAGE_TITLE ends with '...Extra
collateral lowers liquidation risk.', which the /i assertion in PORT-007
'renders nothing when no position is at risk' then matched — failing on hidden
tooltip prose rather than on a rendered AtRiskBanner.

Scopes both negative assertions with `ignore: '[role="tooltip"]'`: hidden
tooltip copy is not a rendered banner and must not satisfy them.

Verified it still binds, not silenced: neutralising AtRiskBanner's
`if (atRisk.length === 0) return null;` guard makes the test FAIL again, and
restoring it passes. Deterministic, not flaky — fails 3/3 on fb53c2f, passes at
b828e02 (before the tooltip change).
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
percolator-launch Ready Ready Preview, Comment Jul 25, 2026 11:55am
percolator-mainnet Ready Ready Preview, Comment Jul 25, 2026 11:55am
percolator-playground Ready Ready Preview, Comment Jul 25, 2026 11:55am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 013c7707-9b74-4825-85e5-64ca096c9d47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/port007-tooltip-text-collision

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant