Skip to content

Commit dbed144

Browse files
authored
Merge branch 'main' into MMQA-1673
2 parents 4ae43d1 + f3a256d commit dbed144

4,300 files changed

Lines changed: 251870 additions & 533348 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/ab-testing-implementation/scripts/check-ab-testing-compliance.sh

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Checks changed files for A/B testing implementation compliance.
1111
1212
Rules:
1313
- Fail: New ab_tests payload additions in checked code diffs
14-
- Fail: Malformed literal active_ab_tests objects missing key/value
14+
- Fail: Malformed literal active_ab_tests objects missing key/value/key_value_pair
1515
- Fail: Inline useABTest variants object missing control
1616
- Warn: Flag key naming mismatch for Abtest keys
1717
- Warn: Risky A/B integration changes without test-file updates
@@ -246,15 +246,32 @@ for file in "${CHANGED_FILES[@]}"; do
246246
for ((i=0; i<line_count; i++)); do
247247
line="${added_lines[$i]}"
248248

249-
# Rule: validate literal active_ab_tests payloads include both key and value.
249+
# Rule: validate literal active_ab_tests payloads include key, value, and key_value_pair.
250250
if [[ "$line" =~ active_ab_tests[[:space:]]*: ]]; then
251251
if [[ "$line" =~ active_ab_tests[[:space:]]*:[[:space:]]*(\[|\{) ]]; then
252-
window="$line"
253-
for ((j=i+1; j<line_count && j<=i+8; j++)); do
254-
window+=$'\n'"${added_lines[$j]}"
255-
done
256-
if ! grep -Eq 'key[[:space:]]*:' <<< "$window" || ! grep -Eq 'value[[:space:]]*:' <<< "$window"; then
257-
FAILURES+=("$file: malformed literal active_ab_tests object (expected key and value).")
252+
payload="$(sed -E 's/.*active_ab_tests[[:space:]]*:[[:space:]]*//; q' <<< "$line")"
253+
closing_char="]"
254+
if [[ "${BASH_REMATCH[1]}" == "{" ]]; then
255+
closing_char="}"
256+
fi
257+
258+
if [[ "$payload" == *"$closing_char"* ]]; then
259+
payload="$(printf '%s' "$payload" | cut -d "$closing_char" -f 1)$closing_char"
260+
else
261+
for ((j=i+1; j<line_count && j<=i+8; j++)); do
262+
next_line="${added_lines[$j]}"
263+
if [[ "$next_line" == *"$closing_char"* ]]; then
264+
payload+=$'\n'"$(printf '%s' "$next_line" | cut -d "$closing_char" -f 1)$closing_char"
265+
break
266+
fi
267+
payload+=$'\n'"${next_line}"
268+
done
269+
fi
270+
271+
if grep -Eq 'key[[:space:]]*:|value[[:space:]]*:|key_value_pair[[:space:]]*:' <<< "$payload"; then
272+
if ! grep -Eq 'key[[:space:]]*:' <<< "$payload" || ! grep -Eq 'value[[:space:]]*:' <<< "$payload" || ! grep -Eq 'key_value_pair[[:space:]]*:' <<< "$payload"; then
273+
FAILURES+=("$file: malformed literal active_ab_tests object (expected key, value, and key_value_pair).")
274+
fi
258275
fi
259276
fi
260277
fi
@@ -300,6 +317,9 @@ for file in "${CHANGED_FILES[@]}"; do
300317
while IFS= read -r quoted; do
301318
[[ -z "$quoted" ]] && continue
302319
key="${quoted:1:${#quoted}-2}"
320+
if [[ "$key" =~ [[:space:]{}=] ]]; then
321+
continue
322+
fi
303323
if [[ -n "$use_abtest_literal_key" && "$key" == "$use_abtest_literal_key" ]]; then
304324
continue
305325
fi

.agents/skills/e2e-test/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Do not read the full reference files until the decision tree or workflow sends y
6666
5. **Never use `TestHelpers.delay()`** — use `Assertions.*` which has auto-retry
6767
6. **Use `FixtureBuilder` for state** — do not set state through UI interactions
6868
7. **Selectors live in `*.testIds.ts`** (co-located) or `tests/selectors/` (legacy)
69-
8. **Tag correctly** — Use the tag that matches your feature and test type. Options include `SmokeE2E`, `SmokeTrade`, `SmokePredictions`, `SmokePerps`, `SmokeConfirmations`, `RegressionTrade`, `RegressionWallet`, etc. Check **`tests/tags.js`** for the full list and descriptions, and **existing specs in the same feature folder** to see which tag they use.
69+
8. **Tag correctly** — Use the tag that matches your feature and test type. Options include `SmokeE2E`, `SmokeSwap`, `SmokeStake`, `SmokeMoney`, `SmokePredictions`, `SmokePerps`, `SmokeConfirmations`, `RegressionTrade`, `RegressionWallet`, etc. Check **`tests/tags.js`** for the full list and descriptions, and **existing specs in the same feature folder** to see which tag they use.
7070
9. **Descriptive test names** — no 'should' prefix (e.g., `'opens market details'`)
7171
10. **Fix lint/tsc before running** — never run with known errors
7272

.agents/skills/e2e-test/references/mocking.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,17 @@ Add a mock for every such request to ensure test determinism.
127127

128128
## Features using WebSockets or complex transport
129129

130-
Some features depend on **WebSockets** or other non-HTTP transport (e.g. Perps/HyperLiquid, real-time data). The HTTP mock server cannot intercept these. The repo uses two patterns:
130+
Some features depend on **WebSockets** or other non-HTTP transport (e.g. Perps/HyperLiquid, real-time data). The HTTP mock server cannot intercept these. The repo uses three patterns:
131131

132-
1. **Controller-level mocking** — A mixin under `tests/controller-mocking/mock-config/` replaces provider SDK touchpoints so E2E runs with stable, test-controlled data. Example: `perps-controller-mixin.ts` for HyperLiquid. See **`tests/docs/CONTROLLER_MOCKING.md`** for when and how to use it.
133-
2. **Command queue / test server** — Tests that need to drive the app (e.g. inject state or commands) can use **`CommandQueueServer`** (`tests/framework/fixtures/CommandQueueServer.ts`). Enable it in the fixture with `useCommandQueueServer: true`. Used by Perps specs (e.g. `tests/smoke/perps/perps-add-funds.spec.ts`, `tests/regression/perps/perps-limit-long-fill.spec.ts`). The app consumes the queue in E2E context.
132+
1. **WebSocket mocking** — A `LocalWebSocketServer` (`tests/websocket/server.ts`) intercepts production WebSocket connections via URL rewriting in the E2E shim. Protocol-specific mocks handle subscribe/unsubscribe and push notifications. See **`tests/docs/WEBSOCKET_MOCKING.md`** for full usage guide and how to add new services. Example: `tests/websocket/account-activity-mocks.ts` for AccountActivity.
133+
2. **Controller-level mocking** — A mixin under `tests/controller-mocking/mock-config/` replaces provider SDK touchpoints so E2E runs with stable, test-controlled data. Example: `perps-controller-mixin.ts` for HyperLiquid. See **`tests/docs/CONTROLLER_MOCKING.md`** for when and how to use it.
134+
3. **Command queue / test server** — Tests that need to drive the app (e.g. inject state or commands) can use **`CommandQueueServer`** (`tests/framework/fixtures/CommandQueueServer.ts`). Enable it in the fixture with `useCommandQueueServer: true`. Used by Perps specs (e.g. `tests/smoke/perps/perps-add-funds.spec.ts`, `tests/regression/perps/perps-limit-long-fill.spec.ts`). The app consumes the queue in E2E context.
134135

135136
**When adding support for a new feature that uses WebSockets or similar:**
136137

137-
- Follow the **same pattern** as existing features (controller mixin and/or CommandQueueServer).
138-
- Implement under `tests/controller-mocking/mock-config/` or extend the command-queue protocol as needed.
138+
- For WebSocket services: add a service config in `tests/websocket/constants.ts` and a protocol mock. See `tests/docs/WEBSOCKET_MOCKING.md`.
139+
- For SDK-level mocking: implement under `tests/controller-mocking/mock-config/`.
140+
- For test-driven commands: extend the command-queue protocol as needed.
139141
- Add or update **tests/specs** that cover the mock infrastructure and the E2E flow.
140142

141-
Prefer HTTP mocking whenever the feature’s API is plain HTTP; use controller mocking or the command server only when necessary.
143+
Prefer HTTP mocking whenever the feature’s API is plain HTTP; use WebSocket mocking for WS connections; use controller mocking or the command server only when necessary.

.agents/skills/e2e-test/references/writing-tests.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
## Spec File Location
44

5-
| Test Type | Directory | Tag |
6-
| ---------- | ------------------------------------------- | -------------------------------------------------------------------------------------- |
7-
| Smoke | `tests/smoke/<feature>/<name>.spec.ts` | `SmokeE2E`, `SmokeTrade`, `SmokePredictions`, `SmokePerps`, `SmokeConfirmations`, etc. |
8-
| Regression | `tests/regression/<feature>/<name>.spec.ts` | `RegressionTrade`, `RegressionWallet`, etc. |
5+
| Test Type | Directory | Tag |
6+
| ---------- | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
7+
| Smoke | `tests/smoke/<feature>/<name>.spec.ts` | `SmokeE2E`, `SmokeSwap`, `SmokeStake`, `SmokeMoney`, `SmokePredictions`, `SmokePerps`, `SmokeConfirmations`, etc. |
8+
| Regression | `tests/regression/<feature>/<name>.spec.ts` | `RegressionTrade`, `RegressionWallet`, etc. |
99

10-
Import tags from `tests/tags.ts`. Check **`tests/tags.js`** for the full list and descriptions. Use the same tag as **existing specs in that feature folder** (e.g. `tests/smoke/predict/` uses `SmokeTrade`).
10+
Import tags from `tests/tags.ts`. Check **`tests/tags.js`** for the full list and descriptions. Use the same tag as **existing specs in that feature folder** (e.g. `tests/smoke/swap/` uses `SmokeSwap`, `tests/smoke/stake/` uses `SmokeStake`, `tests/smoke/card/` and `tests/smoke/ramps/` use `SmokeMoney`).
1111

1212
## Minimal Smoke Spec
1313

0 commit comments

Comments
 (0)