You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
apollo_integration_tests: fix non-interpolating .expect() messages and log typos (#14069)
The original motivating bug lives in apollo_integration_tests:
// crates/apollo_integration_tests/src/integration_test_manager.rs
.expect("Service {service:?} does not exist in the running executables map.");
.expect("Node {node_idx} does not exist in idle or running nodes.");
`.expect()` is an ordinary method on Option/Result that takes a `&str` and
prints it verbatim on panic — it does not invoke `format_args!`. So named
arguments inside the braces never get substituted:
Before: thread '...' panicked at 'Service {service:?} does not exist in the running executables map.'
After: thread '...' panicked at 'Service Batcher does not exist in the running executables map.'
The panic still fires at the right moment for the right reason; only the
diagnostic value is lost, which defeats the whole point of embedding the
variable. The fix is to wrap the call as `.unwrap_or_else(|| panic!(...))`
(or `|err| panic!("...: {err}")` on a Result), since `panic!` IS a format
macro and the placeholders interpolate normally.
A workspace grep revealed the same anti-pattern in nine more places, plus a
small batch of unrelated typos in user-facing log/panic/assert strings.
Bundling them all here because the common audit "are all log strings in the
sequencer correct?" is what surfaced them.
.expect() placeholder fixes (panic message would have been useless before):
- apollo_storage/src/header.rs ({block_number})
- apollo_consensus_manager/src/consensus_manager.rs ({height})
- apollo_consensus/src/manager.rs (was {self.height} -- field access also invalid in fmt; corrected to local {height})
- apollo_storage/src/serialization/serializers_test.rs (7 sites; one referenced an out-of-scope {casm_file}, corrected to {bin_file_name})
- starknet_os/.../state_diff_encryption/utils.rs ({public_key}, {sn_public_key})
- apollo_integration_tests/src/integration_test_manager.rs ({service:?}, {node_idx})
- apollo_batcher/src/batcher.rs ({new_latest_height})
Plain typo fixes in log/panic/assert messages:
- apollo_integration_tests/src/integration_test_manager.rs "succesfully" -> "successfully" (info!)
- blockifier/src/execution/entry_point.rs "to to usize" -> "to usize" (log::warn!, duplicate word)
- apollo_monitoring_endpoint/src/monitoring_endpoint.rs "MointoringEndpoint" -> "MonitoringEndpoint" (panic!)
- starknet_patricia/.../filled_tree/tree.rs "a unmodified" -> "an unmodified" (panic!)
- apollo_integration_tests/src/flow_test_setup.rs "a init message" -> "an init message" (panic!)
- apollo_infra_utils/src/path_test.rs "an non-existent" -> "a non-existent" (assert!)
No behavior change beyond what panic messages display; cargo check --tests
passes on all touched crates.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments