Repository navigation
Log peer version failing check - #8170
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
lib/collection/src/shards/channel_service.rs (1)
184-190: Rename_mto_addror_urifor clarity.The tuple parameter
_mshadows the surrounding "metadata" concept but actually holds a&Uri(the peer's network address). A more descriptive discard name avoids the confusion.♻️ Proposed rename
- .filter(|(id, _m)| !id_to_metadata.contains_key(id)) + .filter(|(id, _addr)| !id_to_metadata.contains_key(id))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/collection/src/shards/channel_service.rs` around lines 184 - 190, The closure argument name `_m` in the filter over id_to_address is misleading because it actually represents the peer address/URI; update the closure pattern in the filter from |(id, _m)| to a descriptive discard like |(id, _addr)| or |(id, _uri)| in the id_to_address iteration (the code that builds peers_without_metadata and the log call referencing version) so it no longer suggests "metadata" and improves readability without changing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/collection/src/shards/channel_service.rs`:
- Around line 188-199: The two log::info! messages use inconsistent separators;
update them to the same "label: {value:?}" style for consistency and easier
parsing—specifically change the message using peers_without_metadata to use
"metadata: {peers_without_metadata:?}" (or alternatively update the other to
match, but ensure both log::info! calls that reference id_to_metadata,
peers_without_metadata, and version use the identical "label: {value:?}"
formatting).
---
Nitpick comments:
In `@lib/collection/src/shards/channel_service.rs`:
- Around line 184-190: The closure argument name `_m` in the filter over
id_to_address is misleading because it actually represents the peer address/URI;
update the closure pattern in the filter from |(id, _m)| to a descriptive
discard like |(id, _addr)| or |(id, _uri)| in the id_to_address iteration (the
code that builds peers_without_metadata and the log call referencing version) so
it no longer suggests "metadata" and improves readability without changing
behavior.
| log::info!( | ||
| "Not all peers at version:{version} because there are peers without metadata {peers_without_metadata:?}" | ||
| ); | ||
| return false; | ||
| } | ||
|
|
||
| id_to_metadata | ||
| let all = id_to_metadata | ||
| .values() | ||
| .all(|metadata| &metadata.version >= version) | ||
| .all(|metadata| &metadata.version >= version); | ||
|
|
||
| if !all { | ||
| log::info!("Not all peers at version:{version} peers:{id_to_metadata:?}"); |
There was a problem hiding this comment.
Inconsistent log message formatting between the two log::info! calls.
Line 189 separates the label from the value with a space (metadata {peers_without_metadata:?}), while line 199 uses a colon with no space (peers:{id_to_metadata:?}). Aligning the style makes log parsing (grepping, structured log tools) more predictable.
🔧 Proposed fix
- log::info!(
- "Not all peers at version:{version} because there are peers without metadata {peers_without_metadata:?}"
- );
+ log::info!(
+ "Not all peers at version:{version} peers without metadata:{peers_without_metadata:?}"
+ );- log::info!("Not all peers at version:{version} peers:{id_to_metadata:?}");
+ log::info!("Not all peers at version:{version} peers:{id_to_metadata:?}");(second line already consistent once the first is fixed)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| log::info!( | |
| "Not all peers at version:{version} because there are peers without metadata {peers_without_metadata:?}" | |
| ); | |
| return false; | |
| } | |
| id_to_metadata | |
| let all = id_to_metadata | |
| .values() | |
| .all(|metadata| &metadata.version >= version) | |
| .all(|metadata| &metadata.version >= version); | |
| if !all { | |
| log::info!("Not all peers at version:{version} peers:{id_to_metadata:?}"); | |
| log::info!( | |
| "Not all peers at version:{version} peers without metadata:{peers_without_metadata:?}" | |
| ); | |
| return false; | |
| } | |
| let all = id_to_metadata | |
| .values() | |
| .all(|metadata| &metadata.version >= version); | |
| if !all { | |
| log::info!("Not all peers at version:{version} peers:{id_to_metadata:?}"); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@lib/collection/src/shards/channel_service.rs` around lines 188 - 199, The two
log::info! messages use inconsistent separators; update them to the same "label:
{value:?}" style for consistency and easier parsing—specifically change the
message using peers_without_metadata to use "metadata:
{peers_without_metadata:?}" (or alternatively update the other to match, but
ensure both log::info! calls that reference id_to_metadata,
peers_without_metadata, and version use the identical "label: {value:?}"
formatting).
* Log peer version failing check * log peers without metadata * please the rabbit
* Log peer version failing check * log peers without metadata * please the rabbit
The current mechanism for version check of peers is a black box for operators.
This PR adds a log for when the check fails.