|
1 | 1 | # Usage limits hub fixture |
2 | 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. |
0 commit comments