Skip to content

Commit 5b111b1

Browse files
feat(Mountain): Add per-URI marker payloads to diagnostics events and cap keyring logging
Two changes in Mountain's diagnostic system: 1. **DiagnosticProvider.rs**: Extend the `DiagnosticsChanged` event payload with a new `changedURIs` field containing per-URI marker data alongside the existing `Uris` string array. This enables SkyBridge's `cel:diagnostics:changed` listener to call `IMarkerService.changeOne(owner, uri, markers)` directly without an extra IPC round-trip per diagnostic change. Also adds lowercase `owner` field for consistency. Maintains backward compatibility with listeners expecting the original format. 2. **LoggingPlugin.rs**: Cap the `keyring` crate to Warn level. This dependency (used by Mountain's secret-storage path for license data lookups) emits a 3-line DEBUG block per `get_password` call that fires indefinitely after the workbench paints, similar to the previous `ignore` and `globset` mutes. Signed-off-by: Nikola Hristov <Nikola@PlayForm.Cloud>
1 parent 7ecd2c7 commit 5b111b1

2 files changed

Lines changed: 58 additions & 12 deletions

File tree

Source/Binary/Build/LoggingPlugin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ pub fn LoggingPlugin<R:tauri::Runtime>(LogLevel:LevelFilter) -> TauriPlugin<R> {
9090
.level_for("ignore::walk", LevelFilter::Warn)
9191
.level_for("ignore::gitignore", LevelFilter::Warn)
9292
.level_for("globset", LevelFilter::Warn)
93+
// `keyring` (used by Mountain's secret-storage path on the
94+
// `dev1phpTools.license.data` lookup chain) emits a 3-line
95+
// DEBUG block per `get_password` call - "creating entry",
96+
// "created entry", "get password from entry" - per refresh
97+
// tick. After the workbench paints these fire indefinitely.
98+
// Cap to Warn alongside the other dependency mutes.
99+
.level_for("keyring", LevelFilter::Warn)
93100
// Filter out extremely noisy targets
94101
.filter(|Metadata| {
95102
!Metadata.target().starts_with("polling")

Source/Environment/DiagnosticProvider.rs

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,28 +230,55 @@ impl DiagnosticManager for MountainEnvironment {
230230
let OwnerMap = DiagnosticsMapGuard.entry(Owner.clone()).or_default();
231231

232232
let mut ChangedURIKeys = Vec::new();
233+
// `ChangedEntries` carries the post-update marker set per URI so the
234+
// Sky-side `cel:diagnostics:changed` listener can call
235+
// `IMarkerService.changeOne(owner, uri, markers)` without an extra
236+
// IPC round-trip per change. URIs whose markers were cleared still
237+
// appear here with an empty array, so the workbench replaces the
238+
// previous owner-set rather than leaving stale red squiggles.
239+
let mut ChangedEntries:Vec<serde_json::Value> = Vec::new();
233240

234241
for (URIComponentsValue, MarkersOption) in DeserializedEntries {
235242
let URIKey = Utility::GetURLFromURIComponentsDTO(&URIComponentsValue)?.to_string();
236243

237244
ChangedURIKeys.push(URIKey.clone());
238245

239-
if let Some(Markers) = MarkersOption {
240-
if Markers.is_empty() {
246+
let MarkersForEvent = match MarkersOption {
247+
Some(Markers) => {
248+
if Markers.is_empty() {
249+
OwnerMap.remove(&URIKey);
250+
Vec::new()
251+
} else {
252+
let MarkersClone = Markers.clone();
253+
OwnerMap.insert(URIKey.clone(), Markers);
254+
MarkersClone
255+
}
256+
},
257+
None => {
241258
OwnerMap.remove(&URIKey);
242-
} else {
243-
OwnerMap.insert(URIKey, Markers);
244-
}
245-
} else {
246-
OwnerMap.remove(&URIKey);
247-
}
259+
Vec::new()
260+
},
261+
};
262+
263+
ChangedEntries.push(json!({
264+
"uri": URIKey,
265+
"markers": MarkersForEvent,
266+
}));
248267
}
249268

250269
drop(DiagnosticsMapGuard);
251270

252-
// Notify the frontend that diagnostics have changed for specific URIs.
253-
// Include both added/cleared URIs so UI can update accurately.
254-
let EventPayload = json!({ "Owner": Owner, "Uris": ChangedURIKeys });
271+
// Notify the frontend that diagnostics have changed. Both keys are
272+
// included for backward compatibility - older listeners read `Uris`
273+
// (string-array) while the new SkyBridge marker bridge reads
274+
// `changedURIs` (per-URI marker payload) to push directly into
275+
// the workbench's `IMarkerService`.
276+
let EventPayload = json!({
277+
"Owner": Owner,
278+
"owner": Owner,
279+
"Uris": ChangedURIKeys,
280+
"changedURIs": ChangedEntries,
281+
});
255282

256283
if let Err(Error) = self.ApplicationHandle.emit(SkyEvent::DiagnosticsChanged.AsStr(), EventPayload) {
257284
dev_log!(
@@ -304,7 +331,19 @@ impl DiagnosticManager for MountainEnvironment {
304331
ChangedURIKeys.len()
305332
);
306333

307-
let EventPayload = json!({ "Owner": Owner, "Uris": ChangedURIKeys });
334+
// Clear path - every URI's marker set goes to empty so the
335+
// SkyBridge listener can wipe them via
336+
// `IMarkerService.changeOne(owner, uri, [])`.
337+
let ChangedEntries:Vec<serde_json::Value> = ChangedURIKeys
338+
.iter()
339+
.map(|Uri| json!({ "uri": Uri, "markers": [] }))
340+
.collect();
341+
let EventPayload = json!({
342+
"Owner": Owner,
343+
"owner": Owner,
344+
"Uris": ChangedURIKeys,
345+
"changedURIs": ChangedEntries,
346+
});
308347

309348
if let Err(Error) = self.ApplicationHandle.emit(SkyEvent::DiagnosticsChanged.AsStr(), EventPayload) {
310349
dev_log!(

0 commit comments

Comments
 (0)