Skip to content

Commit d364ad6

Browse files
committed
fix(sentry): tighten redaction and remove unused bridge metric
1 parent bb89065 commit d364ad6

2 files changed

Lines changed: 5 additions & 29 deletions

File tree

src/utils/__tests__/sentry-redaction.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ describe('sentry redaction', () => {
3232
extra: {
3333
output: 'log at /Users/cam/project/build.log',
3434
attempts: 1,
35+
nested: {
36+
cwd: '/Users/cam/project',
37+
},
3538
},
3639
};
3740

@@ -50,6 +53,7 @@ describe('sentry redaction', () => {
5053
);
5154
expect(redacted.extra?.output).toBe('log at /Users/<redacted>/project/build.log');
5255
expect(redacted.extra?.attempts).toBe(1);
56+
expect(redacted.extra?.nested).toEqual({ cwd: '/Users/<redacted>/project' });
5357
});
5458

5559
it('parses xcode version metadata safely', () => {

src/utils/sentry.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export type SentryToolRuntime = 'cli' | 'daemon' | 'mcp';
1818
export type SentryToolTransport = 'direct' | 'daemon' | 'xcode-ide-daemon';
1919
export type SentryToolInvocationOutcome = 'completed' | 'infra_error';
2020
export type SentryDaemonLifecycleEvent = 'start' | 'shutdown' | 'crash';
21-
export type SentryXcodeBridgeSyncOutcome = 'success' | 'error' | 'empty';
2221

2322
export interface SentryRuntimeContext {
2423
mode: SentryRuntimeMode;
@@ -98,9 +97,7 @@ function redactEvent(event: Sentry.ErrorEvent): Sentry.ErrorEvent {
9897

9998
if (event.extra) {
10099
for (const [key, value] of Object.entries(event.extra)) {
101-
if (typeof value === 'string') {
102-
event.extra[key] = redactPathLikeData(value);
103-
}
100+
event.extra[key] = redactUnknown(value);
104101
}
105102
}
106103

@@ -224,7 +221,6 @@ function applyRuntimeContext(context: SentryRuntimeContext): void {
224221
setTagIfDefined('config.xcode_ide_workflow_enabled', boolToTag(context.xcodeIdeWorkflowEnabled));
225222
setTagIfDefined('axe.available', boolToTag(context.axeAvailable));
226223
setTagIfDefined('axe.source', context.axeSource);
227-
setTagIfDefined('axe.path_mode', context.axeSource);
228224
setTagIfDefined('axe.version', context.axeVersion);
229225
setTagIfDefined('xcodemake.available', boolToTag(context.xcodemakeAvailable));
230226
setTagIfDefined('xcodemake.enabled', boolToTag(context.xcodemakeEnabled));
@@ -481,30 +477,6 @@ export function recordBootstrapDurationMetric(
481477
}
482478
}
483479

484-
export function recordXcodeBridgeSyncDurationMetric(
485-
durationMs: number,
486-
outcome: SentryXcodeBridgeSyncOutcome,
487-
): void {
488-
if (!shouldEmitMetrics()) {
489-
return;
490-
}
491-
492-
try {
493-
Sentry.metrics.distribution(
494-
'xcodebuildmcp.xcode_bridge.sync.duration_ms',
495-
Math.max(0, durationMs),
496-
{
497-
attributes: {
498-
runtime: 'mcp',
499-
outcome,
500-
},
501-
},
502-
);
503-
} catch {
504-
// Metrics are best effort and must never affect runtime behavior.
505-
}
506-
}
507-
508480
export function recordDaemonGaugeMetric(metricName: DaemonGaugeMetricName, value: number): void {
509481
if (!shouldEmitMetrics()) {
510482
return;

0 commit comments

Comments
 (0)