Skip to content

Commit f27b2e0

Browse files
fix(desktop): name the failing field in directory-parse skip warns
Review follow-up on #3866: the per-entry warn carried serde's message but not the field path, so spotting schema drift meant guessing. Route deserialization through serde_path_to_error (already in the tree as a transitive dep) — the warn now reads e.g. '(...pubkey...): channel_add_policy: invalid type: integer'. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Bryce Del Rio <[email protected]>
1 parent 83b8572 commit f27b2e0

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎desktop/src-tauri/Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎desktop/src-tauri/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ opus = "0.3"
8484
neteq = { version = "0.8", default-features = false }
8585
serde = { version = "1", features = ["derive"] }
8686
serde_json = "1"
87+
# Names the failing field path in directory-parse skip warns (already in the
88+
# tree as a transitive dep).
89+
serde_path_to_error = "0.1"
8790
serde_yaml = "0.9"
8891
toml = "0.8"
8992
nostr = { version = "0.44", features = ["nip44", "nip49"] }

‎desktop/src-tauri/src/commands/agent_discovery.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,10 @@ fn parse_relay_agents(agents: serde_json::Value) -> Vec<RelayAgentInfo> {
10921092
.and_then(serde_json::Value::as_str)
10931093
.unwrap_or("<missing pubkey>")
10941094
.to_owned();
1095-
match serde_json::from_value::<RelayAgentInfo>(item) {
1095+
// serde_path_to_error names the offending field (e.g.
1096+
// `channel_add_policy: invalid type: integer`) so operators can
1097+
// spot schema drift from the warn alone.
1098+
match serde_path_to_error::deserialize::<_, RelayAgentInfo>(item) {
10961099
Ok(agent) => Some(agent),
10971100
Err(e) => {
10981101
tracing::warn!(

0 commit comments

Comments
 (0)