fix: address CodeRabbit review findings from release PR#3291
Conversation
- Reset dedup state on error so subsequent non-error messages aren't
wrongly suppressed (logging/dedup.ts)
- Fix SSL cert regex to match "self signed certificate" with spaces
and hyphens (outlookCalendar/errorClassification.ts)
- Redact cookie/set-cookie headers in sensitive context sanitizer
(outlookCalendar/errorClassification.ts)
- Fix PdfContent useEffect to depend only on url, clear timeout on
cleanup to prevent duplicate navigations (PdfContent.tsx)
- Use closest('a') and case-insensitive .pdf check for PDF link
guard (PdfContent.tsx)
WalkthroughThree targeted improvements to logging deduplication, error classification patterns, and PDF content handling. Updates include clearing deduplication keys on errors, expanding TLS/SSL error pattern matching with separator variants, adding cookie-based sensitive key detection, and improving document URL synchronization with proper cleanup and anchor resolution logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/outlookCalendar/errorClassification.ts (1)
69-70: Minor inconsistency in character class separators.The
self[.\s-]signedpattern includes hyphen-as a separator, butcertificate[.\s]has[.\s]expireddoes not. For consistency, consider adding hyphen to both patterns if "certificate-has-expired" variants may occur in error messages.Otherwise, the regex updates look correct for matching the common "self signed certificate" and "self-signed certificate" variants.
Optional: Add hyphen separator for consistency
pattern: - /SSL_ERROR|UNABLE_TO_VERIFY|CERT_|ERR_TLS|self[.\s-]signed|certificate[.\s]has[.\s]expired/i, + /SSL_ERROR|UNABLE_TO_VERIFY|CERT_|ERR_TLS|self[.\s-]signed|certificate[.\s-]has[.\s-]expired/i,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/outlookCalendar/errorClassification.ts` around lines 69 - 70, Update the regex pattern used in error classification so both variants accept a hyphen as a separator: modify the existing pattern entry (the `pattern:` value in errorClassification.ts) to include `-` in the `certificate[.\s]has[.\s]expired` portion (make it `certificate[.\s-]has[.\s-]expired`) to match "certificate-has-expired" and keep consistency with `self[.\s-]signed`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/outlookCalendar/errorClassification.ts`:
- Around line 69-70: Update the regex pattern used in error classification so
both variants accept a hyphen as a separator: modify the existing pattern entry
(the `pattern:` value in errorClassification.ts) to include `-` in the
`certificate[.\s]has[.\s]expired` portion (make it
`certificate[.\s-]has[.\s-]expired`) to match "certificate-has-expired" and keep
consistency with `self[.\s-]signed`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6f943b01-a99d-4ae8-a355-9a14cc3fa987
📒 Files selected for processing (3)
src/logging/dedup.tssrc/outlookCalendar/errorClassification.tssrc/ui/components/ServersView/PdfContent.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: check (windows-latest)
- GitHub Check: check (macos-latest)
- GitHub Check: check (ubuntu-latest)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript strict mode enabled in TypeScript configuration
Use React functional components with hooks instead of class components
Follow FSA (Flux Standard Action) pattern for Redux actions
Use camelCase for file names and PascalCase for component file names
All code must pass ESLint and TypeScript checks
Write self-documenting code with clear naming; avoid unnecessary comments except for complex business logic or non-obvious decisions
Use Fuselage components from@rocket.chat/fuselagefor all UI work and only create custom components when Fuselage doesn't provide what's needed
CheckTheme.d.tsfor valid color tokens when using Fuselage components
Use defensive coding with optional chaining and fallbacks for Linux-only APIs (process.getuid(), process.getgid(), process.geteuid(), process.getegid()) to ensure cross-platform compatibility across Windows, macOS, and Linux
Files:
src/logging/dedup.tssrc/outlookCalendar/errorClassification.tssrc/ui/components/ServersView/PdfContent.tsx
src/outlookCalendar/**/*.{ts,tsx}
📄 CodeRabbit inference engine (src/outlookCalendar/AGENTS.md)
src/outlookCalendar/**/*.{ts,tsx}: UsecreateClassifiedError()fromerrorClassification.tsfor user-facing errors to provide error categorization, user-friendly messages, and structured error context
Always use outlookError() for errors as it logs regardless of verbose mode settings, ensuring errors are always visible to users
Files:
src/outlookCalendar/errorClassification.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: Ram-sah19
Repo: RocketChat/Rocket.Chat.Electron PR: 3254
File: .github/workflows/build-release.yml:80-94
Timestamp: 2026-03-11T06:38:40.426Z
Learning: In the RocketChat/Rocket.Chat.Electron repository, the issues flagged in `.github/workflows/build-release.yml` (e.g., `node12` runtime in the release action and missing `snapcraft_token` input), i18n files, and `electron-builder.json` are pre-existing in the `develop` branch and are pulled in during merge conflict resolution. Do not flag these as new issues introduced by PRs that only modify `src/injected.ts` and `src/ui/main/rootWindow.ts`.
📚 Learning: 2026-03-06T19:31:11.433Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat.Electron PR: 0
File: src/outlookCalendar/AGENTS.md:0-0
Timestamp: 2026-03-06T19:31:11.433Z
Learning: Applies to src/outlookCalendar/**/*.{ts,tsx} : Use `createClassifiedError()` from `errorClassification.ts` for user-facing errors to provide error categorization, user-friendly messages, and structured error context
Applied to files:
src/outlookCalendar/errorClassification.ts
📚 Learning: 2026-03-06T19:31:11.433Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat.Electron PR: 0
File: src/outlookCalendar/AGENTS.md:0-0
Timestamp: 2026-03-06T19:31:11.433Z
Learning: Applies to src/outlookCalendar/**/*.{ts,tsx} : Always use outlookError() for errors as it logs regardless of verbose mode settings, ensuring errors are always visible to users
Applied to files:
src/outlookCalendar/errorClassification.ts
🔇 Additional comments (6)
src/logging/dedup.ts (2)
46-49: Good fix: reset IPC dedup state on errors.Resetting
lastIpcKeyon error prevents stale dedup state from suppressing the next non-error IPC message.
70-74: Good fix: file-hook error path now safely resets dedup state.Passing through missing messages and clearing
lastFileKeyon error keeps file transport dedup behavior consistent after failures.src/ui/components/ServersView/PdfContent.tsx (2)
20-33: Good fix for URL sync and duplicate navigation prevention.The narrowed dependency (
[url]) plus timeout cleanup makes this effect deterministic and prevents stale delayed navigations.
49-56: PDF link interception logic is now robust.
closest('a')+ case-insensitive pathname matching is a solid improvement for nested targets andsrc/outlookCalendar/errorClassification.ts (2)
232-239: Good addition of cookie headers to sensitive keys.Adding
cookieandset-cookieto the redaction list is a proper security enhancement. These headers can contain session tokens and authentication data that should not appear in logs.
241-251: LGTM - defensive sensitive key detection.The
includes('cookie')andincludes('authorization')checks provide defense-in-depth by catching variations likeproxy-authorization,x-custom-cookie, or any header names containing these sensitive terms. This is appropriate for security-sensitive redaction logic.
Summary
Addresses the legitimate findings from CodeRabbit's review on the release PR #3289.
info A → error → info Ano longer drops the secondinfo A)"self signed certificate"(spaces/hyphens) in addition to"self.signed"(dots)cookieandset-cookieadded to sensitive keys in Outlook error context sanitizerurlnow, with proper timeout cleanupclosest('a')for nested elements, case-insensitive.pdfcheck, handles query strings and fragmentsTest plan
info → error → same infologs all threeself signed certificate) are classified correctly.PDF(uppercase) link inside PDF viewer, verify it's blockedSummary by CodeRabbit
Bug Fixes
Security