LibreChat/e2e/specs/mock
Danny Avila 7cf2877b45
🪙 feat: Context Gauge UX, Hover Snapshot, Click Breakdown, Currency, Cost-On-By-Default (#13739)
* 🪙 feat: Default Context Cost On + Configurable Display Currency

Flip interface.contextCost to default-on (schema default true, resolved per-field
in loadDefaultInterface so it applies unless an admin explicitly sets false).

Add interface.currency { code, rate }: an ISO-4217 code and a static USD→local
multiplier so non-USD communities (EUR, JPY, CNY, BRL, ZAR, …) can show costs in
their currency. Inner fields are required (no nested defaults) to keep zod
input/output identical; loadDefaultInterface passes it through. Display-only —
model prices stay USD server-side.

* 🪙 feat: Currency-Aware Context Cost Formatting

formatCost(usd, currency?) applies the static rate (usd × rate) and formats via
a cached Intl.NumberFormat keyed by currency code — locale-correct symbol and
per-currency decimals, falling back to USD on a malformed code. The USD default
(code USD, rate 1) is byte-identical to the prior output.

* 💄 feat: Gauge Hover Snapshot, Click-to-Open Breakdown, Hide Until Data

Replace the hover-only HoverCard with: a compact hover snapshot tooltip
("Context 341.7k / 1.0M (34%)" + cost when enabled) via the existing Tooltip
primitive, and a click-opened Ariakit popover for the full breakdown that
dismisses on outside-click/Escape/blur. Gate visibility on usedTokens > 0 so a
fresh, message-less chat shows nothing, with an animate-in fade as the first
tokens land. Thread the display currency into the breakdown + snapshot.

* 🧪 test: Gauge Interaction + Visibility E2E

Switch the breakdown specs from hover to click, and add a test that the gauge is
absent on a new chat, surfaces the snapshot tooltip on hover, opens the breakdown
on click, and dismisses on Escape and outside-click.

* 🪙 fix: Harden Currency Resolution + Layer Breakdown Above Tooltip

Address Codex review on the currency display:
- Unsupported currency code now falls back to USD AND rate 1, so a typo like
  { code: 'EURO', rate: 0.92 } no longer shows a converted amount under a $
  symbol (was $9.20 for a $10 cost; now $10.00).
- A non-finite/negative rate (e.g. a partial admin override that set code before
  rate) falls back to rate 1, so a cost never renders as NaN.
- Fraction digits derive from the currency's own defaults, so zero-decimal
  currencies (JPY) render ¥5, not ¥5.00, and extra sub-unit precision applies
  only to currencies that have minor units. USD output is unchanged.
- Raise the click breakdown popover to z-[200] so it always sits above the
  z-150 hover tooltip when both briefly coexist.

* 🪙 fix: Validate ISO-4217 Codes + Derive Tiny Threshold from Minor Unit

Address Codex review on currency formatting:
- Intl.NumberFormat accepts any well-formed 3-letter code (EUU, RMB) without
  throwing, so the previous construct-based check missed typos/non-ISO codes and
  applied the rate under a bogus label. Validate against Intl.supportedValuesOf
  ('currency') (the ISO-4217 set); unsupported codes fall back to USD + rate 1.
  Codes are normalized to upper-case; graceful fallback if the runtime lacks
  supportedValuesOf.
- The tiny-amount threshold now derives from the currency's minor unit
  (10^-fractionDigits): 0.01 for 2-decimal, 0.001 for 3-decimal (KWD/BHD/JOD),
  1 for zero-decimal — instead of a hard-coded 0.01. Sub-unit precision trims to
  each currency's own scale. USD output unchanged.
2026-06-14 13:38:27 -04:00
..
agents.helpers.ts ci: Add mock e2e coverage for agents, prompts, MCP, and chat flows (#13589) 2026-06-10 09:06:52 -04:00
agents.spec.ts ci: Add mock e2e coverage for agents, prompts, MCP, and chat flows (#13589) 2026-06-10 09:06:52 -04:00
app-load.spec.ts ci: Add mock e2e coverage for agents, prompts, MCP, and chat flows (#13589) 2026-06-10 09:06:52 -04:00
auth.spec.ts 🛬 fix: Coalesce Auth Recovery into a Single Refresh Flight (#13618) 2026-06-09 12:04:12 -04:00
chat.spec.ts 🌿 fix: Preserve Viewed Branch on Sibling-Tree Churn (#13732) 2026-06-14 09:38:06 -04:00
conversation-management.spec.ts ci: Add mock e2e coverage for agents, prompts, MCP, and chat flows (#13589) 2026-06-10 09:06:52 -04:00
deployment-skills.spec.ts 🗂️ feat: Add Deployment Skill Directory (#13523) 2026-06-05 10:24:28 -04:00
helpers.ts 🔌 fix: Preserve Ephemeral MCP Selections Across Model Switches (#13697) 2026-06-11 18:13:41 -04:00
isolation.spec.ts 🎭 feat: Add Credential-Free Playwright Smoke Suite with a Local Mock LLM (#13472) 2026-06-02 16:36:39 -04:00
mcp-ephemeral.spec.ts 🔌 fix: Preserve Ephemeral MCP Selections Across Model Switches (#13697) 2026-06-11 18:13:41 -04:00
mcp.spec.ts ci: Add mock e2e coverage for agents, prompts, MCP, and chat flows (#13589) 2026-06-10 09:06:52 -04:00
message-tree.spec.ts 🌿 fix: Preserve Viewed Branch on Sibling-Tree Churn (#13732) 2026-06-14 09:38:06 -04:00
model-spec-branding.spec.ts feat: Surface Model Spec Branding on Landing and Selector (#13662) 2026-06-10 21:02:22 -04:00
model-spec-icons.spec.ts 🪞 fix: Preserve Model Spec Icons Across Stream Resume and Abort (#13603) 2026-06-08 17:14:21 -04:00
model-spec-skills.spec.ts 🧭 feat: Scope Model Spec Skills (#13522) 2026-06-05 10:22:02 -04:00
model-spec-starters.spec.ts 💬 feat: Conversation Starters for Model Specs (#13710) 2026-06-13 11:38:49 -04:00
model-switching.spec.ts 🎭 feat: Add Credential-Free Playwright Smoke Suite with a Local Mock LLM (#13472) 2026-06-02 16:36:39 -04:00
permissions.spec.ts 🪪 fix: Filter ACL Principal Details (#13524) 2026-06-05 19:06:41 -04:00
projects.spec.ts 📌 fix: Preserve Project Scope Through Enforced Model Specs (#13586) 2026-06-08 08:41:27 -04:00
prompts.spec.ts ci: Add mock e2e coverage for agents, prompts, MCP, and chat flows (#13589) 2026-06-10 09:06:52 -04:00
shared-links.spec.ts 🔗 feat: Add Granular Access Control to Shared Links via ACL System (#13051) 2026-06-03 14:17:17 -04:00
sidebar.spec.ts 📐 fix: Sidebar Chat List Width Tracking and Stale Row Measurements (#13655) 2026-06-10 13:27:18 -04:00
skill-file-authoring.spec.ts 📌 fix: Preserve Project Scope Through Enforced Model Specs (#13586) 2026-06-08 08:41:27 -04:00
soft-default.spec.ts 🛬 fix: Prevent Viewed Conversations from Re-Arming the Soft Default Spec (#13699) 2026-06-11 20:52:17 -04:00
two-factor.spec.ts 🧪 test: Add E2E Regression For 2FA framer-motion Crash (#13513) 2026-06-04 13:25:02 -04:00
usage.spec.ts 🪙 feat: Context Gauge UX, Hover Snapshot, Click Breakdown, Currency, Cost-On-By-Default (#13739) 2026-06-14 13:38:27 -04:00