Skip to content

Log peer version failing check - #8170

Merged
agourlay merged 3 commits into
devfrom
log-peer-version-check
Feb 18, 2026
Merged

agourlay merged 3 commits into
devfrom
log-peer-version-check

Conversation

@agourlay

Copy link
Copy Markdown
Member

The current mechanism for version check of peers is a black box for operators.

This PR adds a log for when the check fails.

INFO collection::shards::channel_service: Not all peers at version:1.16.4-dev peers:{
6476872615560361: PeerMetadata { version: Version { major: 1, minor: 16, patch: 3 } }, 
7736355234278729: PeerMetadata { version: Version { major: 1, minor: 16, patch: 3 } },
8361064564809870: PeerMetadata { version: Version { major: 1, minor: 16, patch: 3 } }}

@timvisee

This comment was marked as resolved.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/collection/src/shards/channel_service.rs (1)

184-190: Rename _m to _addr or _uri for clarity.

The tuple parameter _m shadows 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.

Comment on lines +188 to +199
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:?}");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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).

coderabbitai[bot]

This comment was marked as resolved.

@qdrant qdrant deleted a comment from coderabbitai Bot Feb 18, 2026
@agourlay
agourlay merged commit 8970e7a into dev Feb 18, 2026
15 checks passed
@agourlay
agourlay deleted the log-peer-version-check branch February 18, 2026 13:36
timvisee pushed a commit that referenced this pull request Feb 18, 2026
* Log peer version failing check

* log peers without metadata

* please the rabbit
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* Log peer version failing check

* log peers without metadata

* please the rabbit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants