The best way to control Claude Code, Codex and more from any computer or phone
test(web): pooled Limits segments narrower than 6px draw no pace mark; fixture README (#22453)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 20, 2026 at 11:58 UTC
7e289ae1f77b9137580688aaccf00d48906984ad
2 files changed
+83
-6
apps/web/src/components/usage/UsageLimitsPooled.browser.test.tsx
+20
@@ -194,6 +194,26 @@ it("cuts the pace gap through the segment track and keeps the tick inside it", a
194
expect(tick.right).toBeLessThanOrEqual(rect.right);
195
});
196
197
+it("drops the pace gap and tick when a segment is narrower than 6px", async () => {
198
+ setup();
199
+ await using _screen = await render(
200
+ <UsageLimitsPooled
201
+ presentations={presentations("2026-09-03T14:00:00Z", 0)}
202
+ now={Date.parse("2026-09-03T11:30:00Z")}
203
+ />,
204
+ );
205
+ const segment = page.getByRole("button", { name: /^Alpha:/ }).element();
206
+ const tick = () => segment.querySelector(':scope > span[style*="left"]');
207
+ expect(tick()).not.toBeNull();
208
+ // Pooled grid columns have no minimum width; squeeze the segment the way a crowded pool does.
209
+ await act(() => {
210
+ segment.style.width = "4.5px";
211
+ });
212
+ await expect.poll(tick).toBeNull();
213
+ expect(getComputedStyle(segment).backgroundImage).toBe("none");
214
+ expect(getComputedStyle(segment.querySelector(":scope > div > div")!).clipPath).toBe("none");
215
+});
216
+
217
it("moves the one limit popover between windows on hover", async () => {
218
setup();
219
await using screen = await render(initial());
apps/web/test/fixtures/usage-limits-hub/README.md
+63
-6
@@ -1,8 +1,65 @@
1
# Usage limits hub fixture
2
3
-A fake CLIProxyAPI hub that serves the Limits evidence scenarios in `scenarios.json`
4
-(A mixed, B one account per provider, C six long-named Codex accounts, L named accounts,
5
-T forty accounts). Run `node hub.mjs state.json 18517` with `state.json` set to
6
-`{"scenario": "A", "n0": <epoch ms>}`, add `http://127.0.0.1:18517` with any management key
7
-under Settings → Usage limit sources in a dev server, and freeze the browser clock at `n0`.
8
-Edit `state.json` and press Refresh limits to switch scenarios.
3
+A fake CLIProxyAPI hub that serves the Limits evidence scenarios in `scenarios.json`:
4
+
5
+| Scenario | Accounts |
6
+| -------- | -------------------------------------------------------------- |
7
+| A | mixed Codex and Claude accounts |
8
+| B | one account per provider |
9
+| C | six long-email Codex accounts |
10
+| L | named accounts (no email, so segments show the auth-file name) |
11
+| T | forty accounts, so pooled segments are 4px wide at 390px |
12
+
13
+Reset times are minute offsets from `n0`.
14
+
15
+## Rebuild a capture
16
+
17
+1. Start a dev server with empty provider homes, so local logins add no accounts:
18
+
19
+ ```sh
20
+ CODEX_HOME=$(mktemp -d) CLAUDE_CONFIG_DIR=$(mktemp -d) vp run dev
21
+ ```
22
+
23
+2. Write `state.json` as `{"scenario": "A", "n0": 1792515540000}`. That `n0` is 2026-10-20T16:59:00Z, the instant every published capture uses. Then start the hub:
24
+
25
+ ```sh
26
+ node hub.mjs state.json 18517
27
+ ```
28
+
29
+3. Under Settings → Providers → Usage limit sources, add a hub with URL `http://127.0.0.1:18517`, any management key, and label `Team hub`. The composer panel prints that label on every account row.
30
+
31
+4. Freeze the browser clock at `n0` from the devtools console:
32
+
33
+ ```js
34
+ const T = 1792515540000;
35
+ const R = Date;
36
+ window.Date = class extends R {
37
+ constructor(...a) {
38
+ super(...(a.length ? a : [T]));
39
+ }
40
+ static now() {
41
+ return T;
42
+ }
43
+ };
44
+ ```
45
+
46
+ Then re-read the time:
47
+ - On the Usage page, select Cost and then Limits again.
48
+ - Open the composer panel with `/usage-limits` after freezing.
49
+ - The sidebar's relative timestamp picks up the frozen clock on its next minute tick.
50
+
51
+5. Viewports and themes: emulate `prefers-color-scheme` light and dark, and wait a few seconds after switching theme or size so transitions and overlay scrollbars settle.
52
+
53
+ | Surface | Viewport |
54
+ | ----------------------------------------------- | ------------------------------------- |
55
+ | Usage page | 1440×900 and 390×1500 |
56
+ | Scenario T | 390×3100, so the page does not scroll |
57
+ | Composer panel, Codex thread (`gpt-6-astra`) | 1440×900 |
58
+ | Composer panel, Claude thread (Claude Opus 5.5) | 390×1300 |
59
+
60
+6. Edit `state.json` and press Refresh limits to switch scenarios.
61
+
62
+## Not from the fixture
63
+
64
+- **"Codex: Could not read limits."** That banner comes from the local Codex install, which is unauthenticated with an empty `CODEX_HOME`.
65
+- **"Claude API Key" rows** in the Claude composer panel come from the local Claude install, not the fixture.