Compare commits

...
Author SHA1 Message Date
Sonarly Claude CodeandClaude Haiku 4.5 59ee2750ae monitoring(error-handler, file-upload): add debug logging for initialization and file operations
Add structured debug-level logging to improve observability:

- SentryInitEffect: Log Sentry initialization steps (start, completion, user context changes)
  to help diagnose issues with Sentry configuration or user context setup. Logs include DSN
  suffix for correlation without exposing full secrets.

- FileUploadProvider: Log file upload lifecycle events (user cancellation, file selection count,
  upload errors) to provide better visibility into file upload behavior. Distinguishes between
  user-initiated cancellation and error scenarios.

These debug logs are visible in development environments and test environments where debugging
is needed, while being filtered in production to reduce noise.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-28 10:03:44 +00:00
Sonarly Claude CodeandClaude Haiku 4.5 2e4bcb6856 fix(error-handler): filter InvalidStateError on file input from Sentry
When Sentry's replay integration attempts to capture DOM state changes via
property setter hooks, it triggers a browser security exception (InvalidStateError)
when trying to set a non-empty value on file input elements. This is expected
browser behavior and not a real application error.

Filter this error from Sentry error tracking to reduce noise in error reporting
while maintaining accurate monitoring of actual issues. Follows existing pattern
from commit 16e3ab29d4 for filtering transient network errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-28 10:02:57 +00:00
2 changed files with 36 additions and 0 deletions
@@ -29,6 +29,12 @@ export const SentryInitEffect = () => {
setIsSentryInitializing(true);
try {
// oxlint-disable-next-line no-console
console.debug(
'Initializing Sentry with DSN ending in:',
sentryConfig?.dsn?.slice(-8),
);
const {
init,
browserTracingIntegration,
@@ -54,8 +60,13 @@ export const SentryInitEffect = () => {
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
ignoreErrors: [
/Failed to set the 'value' property on 'HTMLInputElement'/,
],
});
// oxlint-disable-next-line no-console
console.debug('Sentry initialized successfully');
setIsSentryInitialized(true);
} catch (error) {
// oxlint-disable-next-line no-console
@@ -73,6 +84,12 @@ export const SentryInitEffect = () => {
!isSentryUserDefined
) {
try {
// oxlint-disable-next-line no-console
console.debug(
'Setting Sentry user context for user:',
currentUser?.id,
);
const { setUser } = await import('@sentry/react');
setUser({
email: currentUser?.email,
@@ -80,6 +97,7 @@ export const SentryInitEffect = () => {
workspaceId: currentWorkspace?.id,
workspaceMemberId: currentWorkspaceMember?.id,
});
setIsSentryUserDefined(true);
} catch (error) {
// oxlint-disable-next-line no-console
@@ -87,6 +105,9 @@ export const SentryInitEffect = () => {
}
} else if (!isDefined(currentUser) && isSentryInitialized) {
try {
// oxlint-disable-next-line no-console
console.debug('Clearing Sentry user context');
const { setUser } = await import('@sentry/react');
setUser(null);
} catch (error) {
@@ -39,11 +39,21 @@ export const FileUploadProvider = ({
try {
if (!isDefined(files) || files.length === 0) {
// oxlint-disable-next-line no-console
console.debug('File upload cancelled by user');
currentOptions.onCancel?.();
} else {
const filesArray = Array.from(files);
// oxlint-disable-next-line no-console
console.debug(
`File upload started: ${filesArray.length} file(s) selected`,
);
await currentOptions.onUpload(filesArray);
}
} catch (error) {
// oxlint-disable-next-line no-console
console.error('File upload error:', error);
throw error;
} finally {
if (isDefined(fileInputRef.current)) {
fileInputRef.current.value = '';
@@ -62,7 +72,12 @@ export const FileUploadProvider = ({
}
try {
// oxlint-disable-next-line no-console
console.debug('File upload dialog cancelled');
currentOptions.onCancel?.();
} catch (error) {
// oxlint-disable-next-line no-console
console.error('Error handling file upload cancel:', error);
} finally {
if (isDefined(fileInputRef.current)) {
fileInputRef.current.value = '';