Skip to content

Commit 2120ad5

Browse files
perf(Mountain): Deduplicate dev log entries for unregistered commands
Replace dev_log! macro with DebugOnce for unregistered view-action and workbench-internal commands. These commands fire repeatedly (view-action buttons clicked multiple times, getTelemetrySenderObject fires 30+ times per boot extension activation), causing N-line log trails that obscure other diagnostic output. The new implementation uses a dedup key format (e.g., "view-action-noop:{CommandId}") so the first invocation still logs for debugging probe shape, while subsequent calls to the same command ID are silently suppressed. This reduces dev log noise in hot IPC paths while preserving diagnostic value for identifying unregistered command patterns.
1 parent dfa3acd commit 2120ad5

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

Source/Environment/CommandProvider.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,19 @@ impl CommandExecutor for MountainEnvironment {
297297
|| CommandIdentifier.ends_with(".resetViewLocation")
298298
|| CommandIdentifier.ends_with(".removeView")
299299
{
300-
dev_log!(
300+
// Once-per-command-id so the no-op fallback doesn't
301+
// generate an N-line trail through the dev log every
302+
// time the user clicks a view-action button. The
303+
// first occurrence still fires (documents the probe
304+
// shape); subsequent invocations of the same command
305+
// are silent.
306+
crate::IPC::DevLog::DebugOnce(
301307
"commands",
302-
"[CommandProvider] View-action command '{}' not registered; treating as no-op (auto-generated by view registry in stock VS Code).",
303-
CommandIdentifier
308+
&format!("view-action-noop:{}", CommandIdentifier),
309+
&format!(
310+
"[CommandProvider] View-action command '{}' not registered; treating as no-op (auto-generated by view registry in stock VS Code).",
311+
CommandIdentifier
312+
),
304313
);
305314
return Ok(Value::Null);
306315
}
@@ -329,10 +338,17 @@ impl CommandExecutor for MountainEnvironment {
329338
CommandIdentifier.as_str(),
330339
"getTelemetrySenderObject" | "testing.clearTestResults"
331340
) {
332-
dev_log!(
341+
// `getTelemetrySenderObject` fires once per extension
342+
// activation (~30+ times per boot) - same once-per-id
343+
// dedup as the view-action path so the log line
344+
// documents the probe but doesn't trail.
345+
crate::IPC::DevLog::DebugOnce(
333346
"commands",
334-
"[CommandProvider] Workbench-internal command '{}' not registered; treating as no-op (Land has no backing service).",
335-
CommandIdentifier
347+
&format!("workbench-internal-noop:{}", CommandIdentifier),
348+
&format!(
349+
"[CommandProvider] Workbench-internal command '{}' not registered; treating as no-op (Land has no backing service).",
350+
CommandIdentifier
351+
),
336352
);
337353
return Ok(Value::Null);
338354
}

0 commit comments

Comments
 (0)