Problem
Two error arms in peryx handle states their callers rule out. Both are map_err closures, so each is an uncallable function rather than only an unreached line.
crates/peryx/src/app/retention.rs:117
let header = serde_json::to_string(&serde_json::json!({ "summary": summary })).map_err(|error| error.to_string())?;
json! produces a serde_json::Value, whose Serialize impl has no error path, and the sink is an in-memory String. to_string on a Value cannot return Err, so the closure never runs.
crates/peryx/src/server.rs:781
let allowed_events = plugins
.webhook_events(&index.ecosystem)
.map_err(anyhow::Error::msg)
webhook_events fails only through registration(ecosystem)?, which errors for an ecosystem that is not installed. Both callers of build_webhooks resolve every configured ecosystem first:
check_config_with_active_plugins runs build_indexes_with_plugins at line 125, which calls plugins.activate(...) and returns MissingEcosystem before build_webhooks at line 127.
build_state_with_active_backend_and_plugins runs build_index_settings_with_plugins at line 228, which calls compile_index_settings for every config, and that delegates to the same registration(ecosystem)? at plugin-registry/src/lib.rs:576. build_webhooks follows at line 229.
The second guard is strictly the wider one: build_index_settings_with_plugins iterates all configs, while build_webhooks looks only at those carrying webhooks.
Why it matters now
The native coverage gate holds main to 100% of measurable lines (#2162, #1745). A line no input can reach is neither coverable by a test nor removable by one, so each of these blocks that gate exactly as #2180 and #2190 did. These are the third and fourth instances of the class found while closing #2166.
Required change
Remove both map_err closures and let the infallible call stand on its own. Where a message is still wanted for a Result the compiler requires, use expect with the reason, matching how the surrounding code states invariants it does not check.
Acceptance criteria
- Neither line appears in the crate's missed-line list.
cargo llvm-cov for peryx reports two fewer functions, since removing the closures removes uncallable functions rather than only unreached lines.
- The registration failures those guards produce keep their existing coverage and messages.
- No behaviour change: no input reached either arm before.
Boundary
Only these two closures. The writeln! map_err on the following line of retention.rs, the with_context on build_webhooks, and every other map_err in both files stay — they are reachable.
Problem
Two error arms in
peryxhandle states their callers rule out. Both aremap_errclosures, so each is an uncallable function rather than only an unreached line.crates/peryx/src/app/retention.rs:117json!produces aserde_json::Value, whoseSerializeimpl has no error path, and the sink is an in-memoryString.to_stringon aValuecannot returnErr, so the closure never runs.crates/peryx/src/server.rs:781webhook_eventsfails only throughregistration(ecosystem)?, which errors for an ecosystem that is not installed. Both callers ofbuild_webhooksresolve every configured ecosystem first:check_config_with_active_pluginsrunsbuild_indexes_with_pluginsat line 125, which callsplugins.activate(...)and returnsMissingEcosystembeforebuild_webhooksat line 127.build_state_with_active_backend_and_pluginsrunsbuild_index_settings_with_pluginsat line 228, which callscompile_index_settingsfor every config, and that delegates to the sameregistration(ecosystem)?atplugin-registry/src/lib.rs:576.build_webhooksfollows at line 229.The second guard is strictly the wider one:
build_index_settings_with_pluginsiterates all configs, whilebuild_webhookslooks only at those carrying webhooks.Why it matters now
The native coverage gate holds main to 100% of measurable lines (#2162, #1745). A line no input can reach is neither coverable by a test nor removable by one, so each of these blocks that gate exactly as #2180 and #2190 did. These are the third and fourth instances of the class found while closing #2166.
Required change
Remove both
map_errclosures and let the infallible call stand on its own. Where a message is still wanted for aResultthe compiler requires, useexpectwith the reason, matching how the surrounding code states invariants it does not check.Acceptance criteria
cargo llvm-covforperyxreports two fewer functions, since removing the closures removes uncallable functions rather than only unreached lines.Boundary
Only these two closures. The
writeln!map_erron the following line ofretention.rs, thewith_contextonbuild_webhooks, and every othermap_errin both files stay — they are reachable.