test(feed): pin connection-fault classification - #733
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
feed::live::convertturns a moonproto connection failure into theConnFaultthe panel shows. Nothing calledconn_fault_from_proto,key_fault,stall_fault, orbind_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 asAuthCheck.Covered
conn_fault_from_proto/init_step_by_name: both wire spellings of the strategy-schema step (StrategySchemaandTStratSchemaRequest) are that step;NotARealStepandbasecheckstay unnamed, and the raw name is kept.conn_fault_from_proto:CanceledandSendChannelClosedareAborted;NotAuthenticatedis not. A 1500ms handshake deadline is stored as 1500 milliseconds.conn_fault_from_proto: a failedAuthCheckkeeps the core's message;FutureStepis 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 diffempty) and the test run green again.TStratSchemaRequestarmNoneinstead ofStrategySchema, raw name unchangedas_secs()instead ofas_millis()timeout_ms: 1instead of1500AuthCheckFutureStepreported asAuthCheckempty: truehas_identityfromserver_version.is_some()consecutive_failures: 0Review
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_editis reached from the client-settings tests, not from this file's tests.Not encoded
bybit_categoryclassifies Bybit'sBTCPERPUSDC perp asinversebecause the name has no quote suffix. That looks wrong (Bybit serves it aslinear) and is filed as #732. No test asserts it.How to verify
cargo test -p moon-core --lib conn_fault_