Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions docs/binance-orderbook-trade-ui-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,63 @@ used as a reason to retain event buffers or persistent probes.
exchange limit minus one.
- Verify no fills, no residual test-owned orders, and restored page state after each run.

Store every live run as a strict capture rather than copying timing numbers from chat:

```bash
npm run summarize:binance-orderbook-live -- /path/to/capture.json
```

The first checked-in L4 reference is the zero-order HYPEUSDT run:

- `e2e/binance-orderbook/live-baselines/no-orders-2026-08-26.capture.json`
- `e2e/binance-orderbook/live-baselines/no-orders.baseline.json`

Each scenario declares its applicable wall-clock segments and contains at least three
isolated samples. Every sample must prove restored UI state, no fills, zero residual
test-owned orders, zero uncaught errors, and bounded long-task observations. Missing
segments are invalid data, not zero-duration work.

`testOrderLedger` is the evidence behind the fill and cleanup claims. Its `created`,
`fills`, and `residual` collections use the same exact order identity: symbol, side,
position side, price, quantity, and creation timestamp. A fill or residual record that
does not match a created test order invalidates the capture. An empty ledger is valid
for no-order and dialog-cancel scenarios; account-wide count changes never create test
ownership.

Compare a new capture with a checked-in summary without making network timing a PR
gate by default:

```bash
npm run summarize:binance-orderbook-live -- \
/path/to/capture.json \
--compare /path/to/baseline.json
```

`--enforce` is reserved for a controlled machine and stable scenario. It fails only
when a metric exceeds both the baseline ratio and absolute tolerance recorded in the
baseline comparison policy. Account orders remain user-owned unless a test ledger
proves symbol, side, price, quantity, and creation-time ownership.

The baseline JSON root is the generated summary shape plus one required field:

```json
{
"schemaVersion": 1,
"capturedAt": "2026-08-26T08:00:00.000Z",
"environment": {},
"scenarios": [],
"comparisonPolicy": {
"absoluteToleranceMs": 50,
"medianRatio": 1.5,
"p95Ratio": 1.5
}
}
```

The environment and scenarios shown as empty placeholders above must be copied from
the validated summary output. A malformed or incomplete baseline fails validation;
it cannot silently turn a regression into a passing comparison.

## Change Workflow

1. Convert a defect into a failing scenario or invariant assertion.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"schemaVersion": 1,
"capturedAt": "2026-08-26T08:30:11.000Z",
"environment": {
"browser": "Chrome 151.0.0.0",
"os": "macOS (MacIntel)",
"route": "https://www.binance.com/zh-CN/futures/HYPEUSDT",
"symbol": "HYPEUSDT",
"userscriptSha256": "cc4135902ad4ad62eb6188828479780a8e194713be8067dc10c8c73428c5dcdb",
"userscriptVersion": "2.7.119"
},
"scenarios": [
{
"name": "cancel-current-symbol-no-orders",
"applicableSegments": [
"clickToFirstFeedback",
"clickToFinalReady"
],
"samples": [
{
"segmentsMs": {
"clickToFirstFeedback": 30.6,
"clickToFinalReady": 637.1
},
"testOrderLedger": {
"created": [],
"fills": [],
"residual": []
},
"stateRestored": true,
"noFills": true,
"residualTestOrders": 0,
"uncaughtErrors": 0,
"maxLongTaskMs": 0,
"maxLongAnimationFrameMs": 0
},
{
"segmentsMs": {
"clickToFirstFeedback": 33,
"clickToFinalReady": 630.8
},
"testOrderLedger": {
"created": [],
"fills": [],
"residual": []
},
"stateRestored": true,
"noFills": true,
"residualTestOrders": 0,
"uncaughtErrors": 0,
"maxLongTaskMs": 0,
"maxLongAnimationFrameMs": 0
},
{
"segmentsMs": {
"clickToFirstFeedback": 38.3,
"clickToFinalReady": 646.7
},
"testOrderLedger": {
"created": [],
"fills": [],
"residual": []
},
"stateRestored": true,
"noFills": true,
"residualTestOrders": 0,
"uncaughtErrors": 0,
"maxLongTaskMs": 54,
"maxLongAnimationFrameMs": 56.1
}
]
}
]
}
49 changes: 49 additions & 0 deletions e2e/binance-orderbook/live-baselines/no-orders.baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"schemaVersion": 1,
"capturedAt": "2026-08-26T08:30:11.000Z",
"environment": {
"browser": "Chrome 151.0.0.0",
"os": "macOS (MacIntel)",
"route": "https://www.binance.com/zh-CN/futures/HYPEUSDT",
"symbol": "HYPEUSDT",
"userscriptSha256": "cc4135902ad4ad62eb6188828479780a8e194713be8067dc10c8c73428c5dcdb",
"userscriptVersion": "2.7.119"
},
"scenarios": [
{
"name": "cancel-current-symbol-no-orders",
"sampleCount": 3,
"segmentsMs": {
"clickToFirstFeedback": {
"min": 30.6,
"median": 33,
"p95": 38.3,
"max": 38.3
},
"clickToFinalReady": {
"min": 630.8,
"median": 637.1,
"p95": 646.7,
"max": 646.7
}
},
"maxLongTaskMs": {
"min": 0,
"median": 0,
"p95": 54,
"max": 54
},
"maxLongAnimationFrameMs": {
"min": 0,
"median": 0,
"p95": 56.1,
"max": 56.1
}
}
],
"comparisonPolicy": {
"absoluteToleranceMs": 50,
"medianRatio": 1.5,
"p95Ratio": 1.5
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"import:brooks-media-index": "node scripts/brooks-media-import-index.mjs",
"download:brooks-media": "node scripts/brooks-media-download.mjs",
"inspect:binance-orderbook-trade": "node scripts/userscript-release-contract.mjs scripts/binance-orderbook-trade.user.js",
"summarize:binance-orderbook-live": "node scripts/binance-live-performance.mjs",
"check:binance-userscripts": "node --check scripts/binance-orderbook-trade.user.js && node --check scripts/binance-trading-data.user.js && node --check scripts/binance-coinmarketcap-data.user.js",
"check:binance-orderbook-trade": "node --check scripts/binance-orderbook-trade.user.js",
"check:m3u8-downloader": "node --check scripts/m3u8-downloader.user.js",
Expand Down
Loading
Loading