Skip to content

test(feed): pin connection-fault classification - #733

Merged
kirillDevPro merged 1 commit into
mainfrom
test/conn-fault-classification
Sep 26, 2026
Merged

kirillDevPro merged 1 commit into
mainfrom
test/conn-fault-classification

Conversation

@kirillDevPro

Copy link
Copy Markdown
Collaborator

What & why

feed::live::convert turns a moonproto connection failure into the ConnFault the panel shows. Nothing called conn_fault_from_proto, key_fault, stall_fault, or bind_fault. A wrong arm there is what the user reads while a core is down: a canceled attempt looks like a refused account, a 1.5s timeout looks like one second, an unknown init step is named as AuthCheck.

Covered

  • conn_fault_from_proto / init_step_by_name: both wire spellings of the strategy-schema step (StrategySchema and TStratSchemaRequest) are that step; NotARealStep and basecheck stay unnamed, and the raw name is kept.
  • conn_fault_from_proto: Canceled and SendChannelClosed are Aborted; NotAuthenticated is not. A 1500ms handshake deadline is stored as 1500 milliseconds.
  • conn_fault_from_proto: a failed AuthCheck keeps the core's message; FutureStep is not renamed to a step this build knows.
  • key_fault: a blank key and a pasted non-export are different faults, and neither invents an identity or a startup snapshot.
  • stall_fault / identity_facts: a payload with server version 42 and protocol version 9, and no bot id, does not count as an identity, and the stall is not stored as a step timeout. The snapshot it was detected on is the one retained.
  • bind_fault: three failed bind sweeps stay three, and the frozen startup keeps sent and received packet counts apart.

Mutation proof

Each test was run green, broken with one edit, observed red for that edit, then the production file was restored (git diff empty) and the test run green again.

Test Mutation Result
schema spellings drop the TStratSchemaRequest arm None instead of StrategySchema, raw name unchanged
timeout as_secs() instead of as_millis() timeout_ms: 1 instead of 1500
failed step force every failed step to AuthCheck FutureStep reported as AuthCheck
key always empty: true a pasted key compares equal to a blank one
stall identity has_identity from server_version.is_some() a version with no bot id counts as an identity
bind sweeps hard-code consecutive_failures: 0 three sweeps reported as zero

Review

One clean-context pass asked whether the tests check real behaviour or are shaped to pass. It kept all six. Nothing was dropped.

Still untested in this file

Order-row construction (build_order_rows, order_trace), news and problems projections, the client-settings edit arms, license/runtime/profit snapshots, and engine-action results. apply_client_settings_edit is reached from the client-settings tests, not from this file's tests.

Not encoded

bybit_category classifies Bybit's BTCPERP USDC perp as inverse because the name has no quote suffix. That looks wrong (Bybit serves it as linear) and is filed as #732. No test asserts it.

How to verify

cargo test -p moon-core --lib conn_fault_

The connection panel reads ConnFault, not the moonproto error. A wrong
arm shows a canceled attempt as an unauthorized core, a 1.5s timeout as
one second, or an unknown init step as a refused account.

Six tests pin those decisions: both schema-step spellings, abort versus
timeout, a failed step's own text, a blank key versus a pasted one, a
version that is not an identity, and a bind failure's sweep count.
@kirillDevPro
kirillDevPro merged commit 209783e into main Sep 26, 2026
8 checks passed
@kirillDevPro
kirillDevPro deleted the test/conn-fault-classification branch September 26, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant