Skip to content

Commit 096d06a

Browse files
silasjmatsonclaude
andcommitted
chore(reactotron-mcp): trim narrating comments added in recent commits
Drop or shorten four comments that were either duplicating a JSDoc right above them, or written as post-mortem decision narration that assumes the reader was around for the perf work. - createRedactor cache comment: duplicated the Redactor JSDoc and cited the 500-event benchmark scenario specifically - ParsedRules JSDoc: collapsed three lines of "what this is and why it exists" into one line — the type contents already say it - RedactionContext JSDoc: dropped "the parsed bundle stays shared" — visible from the field types - redactObject ordering note: shortened the O(1)/O(N) framing into one line about common case ordering Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bcfa671 commit 096d06a

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

lib/reactotron-mcp/src/redaction.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ export function createRedactor(
126126
server: ReactotronServer,
127127
serverRedactionConfig: McpRedactionServerConfig,
128128
): Redactor {
129-
// Cache the parsed bundle (lowered Set + compiled regex) per clientId, not
130-
// the raw rules — so a 500-event read does one parse per distinct app
131-
// instead of one per event.
132129
const cache = new Map<string, ParsedRules | null>()
133130

134131
function parsedFor(clientId?: string): ParsedRules | null {
@@ -195,11 +192,7 @@ function dedupe(arr: string[]): string[] {
195192
const MAX_JSON_STRING_DEPTH = 5
196193
const MAX_JSON_PARSE_LENGTH = 1_000_000
197194

198-
/**
199-
* Precomputed form of a rules object — built once per ruleset, reused across
200-
* every redact() call that uses those rules. Holds the lowered key Set and
201-
* the combined value-pattern regex so the hot path doesn't rebuild them.
202-
*/
195+
/** Precomputed form of a rules object, reused across redact() calls. */
203196
interface ParsedRules {
204197
sensitiveKeysLower: Set<string>
205198
/** All valuePatterns folded into a single alternation; null when no valid patterns. */
@@ -241,7 +234,7 @@ function parseRules(rules: McpRedactionRules): ParsedRules {
241234
}
242235
}
243236

244-
/** Per-call state threaded through recursion. The parsed bundle stays shared. */
237+
/** Per-call state threaded through recursion. */
245238
interface RedactionContext {
246239
parsed: ParsedRules
247240
seen: Set<unknown>
@@ -296,8 +289,7 @@ function redactObject(
296289
const trackPaths = ctx.parsed.trackPaths
297290

298291
for (const [key, value] of Object.entries(obj)) {
299-
// Set lookup is O(1) and matches the common case; check it before the
300-
// O(N) state-path scan.
292+
// Common case first — most keys aren't path-pattern matches.
301293
if (sensitiveKeysLower.has(key.toLowerCase())) {
302294
result[key] = REDACTED
303295
continue

0 commit comments

Comments
 (0)