fix(scanner_ws_parse): flatten block arm so llvm-cov tracks line 37 - #91
Merged
Conversation
PR #87 merged with the nested `if let Some(block) { if let Some(hash) { if let Ok(h) = BlockHash::from_str(hash) { ... } } }` shape. The closing brace at line 37 (the path where `block.id` is a string but not a valid hex) reads as covered by the `parse_ws_frame_returns_empty_when_block_id_is_invalid_hex` test in local `cargo test`, but llvm-cov's region tracking reports the closing-brace region as untaken — the Coverage Gate flags `server/src/scanner_ws_parse.rs:37` as the only uncovered line. Flatten the block arm to a single Option chain (`block.get("id").and_then(...).and_then(...).map(...).unwrap_or_default()`). Behavior is identical across every input shape the existing tests cover; LLVM's region tracking collapses cleanly because the closing brace no longer exists as a distinct sub-region. Affects PR #18 (Release: develop -> main) and any open PR based on develop (e.g. #90).
TaprootFreak
marked this pull request as ready for review
May 23, 2026 19:25
2 tasks
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.
Problem
PR #87 (event-driven scanner) merged into develop with a Coverage Gate FAILURE:
server/src/scanner_ws_parse.rs:37is reported as uncovered by llvm-cov despiteparse_ws_frame_returns_empty_when_block_id_is_invalid_hexexercising that exact path in localcargo test.Root cause: the nested
if let Some(block) { if let Some(hash) { if let Ok(h) = BlockHash::from_str(hash) { ... } } }shape produces a closing-brace region at line 37 that llvm-cov reports as an untaken region, even though every reachable input either short-circuits earlier or returns on the inner success arm. This is an llvm-cov region-tracking quirk with nestedif let, not a real coverage hole.Consequence: every PR based on develop now inherits a red Coverage Gate. This is currently blocking:
Fix
Flatten the block arm to a single Option chain. Behavior is byte-identical across every input shape the existing 6 tests cover; only LLVM's region tracking changes (the closing-brace region at line 37 no longer exists as a distinct sub-region).
The
blocksarm andframe_signals_tx_seenare untouched. No new tests needed — the existing 6 tests cover every input shape (valid hex, invalid hex via"not-a-real-hash"and"zzzz", missingid, non-stringid, array shape, malformed JSON, unknown shapes).Test plan