Skip to content

feat: implement comprehensive pino logging across server-side code#31

Merged
asithade merged 8 commits intorefactor/project-uidfrom
feat/error-logging
Aug 8, 2025
Merged

feat: implement comprehensive pino logging across server-side code#31
asithade merged 8 commits intorefactor/project-uidfrom
feat/error-logging

Conversation

@asithade
Copy link
Contributor

@asithade asithade commented Aug 8, 2025

Summary

  • Replace all console statements with structured pino logging
  • Implement dual logger architecture with comprehensive comments
  • Use snake_case convention and protect PII data
  • Add operation timing, error context, and retry logging

Key Changes

  • Server: Dual logger setup (serverLogger + req.log) with redaction
  • Routes: Structured logging with timing and snake_case properties
  • Middleware: Enhanced auth and error logging with context
  • Services: Retry logic and network error classification logging

Technical Details

  • PII protection using boolean flags instead of sensitive data
  • Environment-aware stack traces (dev only)
  • Request correlation and consistent error handling
  • All console.log/error statements removed

Generated with Claude Code

asithade and others added 7 commits August 7, 2025 19:55
Signed-off-by: Asitha de Silva <asithade@gmail.com>
- Add file upload functionality to meeting creation form
- Implement immediate file uploads with progress indicators
- Create reusable file upload component wrapper for PrimeNG
- Add attachment display in meeting cards with file type icons
- Support for PDF, Word, Excel, PowerPoint, and image files
- REST API integration with Supabase storage (no SDK required)
- Created pipes for file type icons and file size formatting
- Add attachment CRUD operations in backend API
- Store attachment metadata in meeting_attachments table
- Display attachments in meeting cards for all scenarios
- Combine attachments and important links in unified resource section

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Asitha de Silva <asithade@gmail.com>
- Extract duplicated allowed file types array to ALLOWED_FILE_TYPES constant
- Extract file size limits to MAX_FILE_SIZE_BYTES constant
- Move filename sanitization to reusable sanitizeFilename utility in utils folder
- Remove code duplication between upload endpoints in meetings.ts

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>
Signed-off-by: Asitha de Silva <asithade@gmail.com>
- Add application/vnd.ms-excel and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for Excel files
- Add application/vnd.ms-powerpoint and application/vnd.openxmlformats-officedocument.presentationml.presentation for PowerPoint files
- File type icon pipe already supports these file types

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>
- Replace all console.log/console.error statements with structured pino logging
- Implement dual logger architecture: serverLogger for non-request context, req.log for request-scoped logging
- Add comprehensive comments explaining logging architecture in server.ts
- Use snake_case convention for all log properties for consistency
- Protect PII by removing sensitive data (names, emails, topics) and using boolean flags
- Add structured logging to all routes with operation context, timing, and status codes
- Enhance error handling with detailed logging in middleware and services
- Add retry and failure logging to API client service with proper error context
- Configure pino with appropriate redaction for sensitive headers and tokens
- Environment-aware stack trace logging (development only)

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>
Signed-off-by: Asitha de Silva <asithade@gmail.com>
Copilot AI review requested due to automatic review settings August 8, 2025 18:50
@asithade asithade requested a review from jordane as a code owner August 8, 2025 18:50
@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/error-logging

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@asithade asithade changed the base branch from main to feat/meeting-attachments August 8, 2025 18:52

This comment was marked as outdated.

@asithade asithade requested a review from Copilot August 8, 2025 18:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive structured logging using Pino across the server-side codebase, replacing all console statements with proper logging infrastructure. The implementation introduces a dual logger architecture with PII protection and environment-aware configurations.

  • Establishes dual logger system with serverLogger for server operations and req.log for request-scoped logging
  • Replaces all console.log/error statements with structured Pino logging using snake_case conventions
  • Adds comprehensive operation timing, error context, and retry logic logging with PII protection

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/lfx-pcc/src/server/server.ts Sets up dual Pino logger architecture with PII redaction and exports serverLogger
apps/lfx-pcc/src/server/services/microservice-proxy.service.ts Replaces console.error with structured logging and PII protection
apps/lfx-pcc/src/server/services/api-client.service.ts Adds comprehensive retry and error logging with structured context
apps/lfx-pcc/src/server/routes/projects.ts Implements operation timing and structured logging for all project endpoints
apps/lfx-pcc/src/server/routes/meetings.ts Adds comprehensive logging for meeting operations with timing and validation context
apps/lfx-pcc/src/server/routes/committees.ts Implements structured logging for committee operations with timing and error context
apps/lfx-pcc/src/server/middleware/error-handler.middleware.ts Updates error handler to use request-scoped logging
apps/lfx-pcc/src/server/middleware/auth-token.middleware.ts Adds authentication flow logging with debug and warning levels

Base automatically changed from feat/meeting-attachments to refactor/project-uid August 8, 2025 18:54
@asithade asithade merged commit 8dc9b1b into refactor/project-uid Aug 8, 2025
5 of 6 checks passed
@asithade asithade deleted the feat/error-logging branch August 8, 2025 18:55
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

✅ E2E Tests Passed

Browser: chromium
Status: passed

All E2E tests passed successfully.

Test Configuration

asithade added a commit that referenced this pull request Aug 8, 2025
* feat: implement committee management for meetings

- Add committee association functionality to meetings with modal interface
- Display committee members with deduplication and enhanced table styling
- Prevent editing of committee members with informational messages
- Support multi-select committee dropdown with dynamic helper text
- Cache committee member data to optimize API calls
- Show voting columns only when committees have voting enabled

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: optimize committee modal table and member display

- Fix incorrect colspan calculation using computed property
- Replace forEach with flatMap for better performance in member collection
- Implement single-pass deduplication instead of array mutation
- Add duplicate committee name prevention for members

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: enhance committee modal with testing support and memory leak prevention

- Add data-testid attributes to multi-select and action buttons for reliable E2E testing
- Implement takeUntilDestroyed for automatic subscription cleanup
- Follow project testing guidelines with hierarchical testid naming convention
- Prevent memory leaks in valueChanges subscription

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* perf: optimize committee member deduplication with O(n) Map-based algorithm

Replace inefficient O(n²) flatMap/reduce/find chain with Map-based deduplication
for better performance with large committee member datasets.

- Use Map<email, member> for O(n) lookups instead of O(n²) array operations
- Add null safety check for member email addresses
- Consolidate duplicate imports for cleaner code
- Maintain same functionality while improving scalability

Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Asitha de Silva <asithade@gmail.com>

* fix: hide members length while loading members

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: project uid

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: enhance meeting cards with participant response breakdown and improved link visibility (#27)

* feat: implement committee management for meetings

- Add committee association functionality to meetings with modal interface
- Display committee members with deduplication and enhanced table styling
- Prevent editing of committee members with informational messages
- Support multi-select committee dropdown with dynamic helper text
- Cache committee member data to optimize API calls
- Show voting columns only when committees have voting enabled

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: optimize committee modal table and member display

- Fix incorrect colspan calculation using computed property
- Replace forEach with flatMap for better performance in member collection
- Implement single-pass deduplication instead of array mutation
- Add duplicate committee name prevention for members

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: enhance committee modal with testing support and memory leak prevention

- Add data-testid attributes to multi-select and action buttons for reliable E2E testing
- Implement takeUntilDestroyed for automatic subscription cleanup
- Follow project testing guidelines with hierarchical testid naming convention
- Prevent memory leaks in valueChanges subscription

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: enhance meeting cards with participant response breakdown and improved link visibility

- Add participants_accepted_count, participants_declined_count, and participants_pending_count fields to Meeting interface
- Update meeting card component to display response breakdown (e.g., "5 Guests (3 Attending, 1 Not Attending, 1 Pending Response)")
- Move important links outside expandable text for better visibility and immediate access
- Only show response breakdown when there are individual participants with response data
- Improve meeting organizer visibility into participation status and key meeting resources

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

---------

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* fix: build issues

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: add complete meeting attachments functionality with file upload (#29)

* refactor: rename projectId to projectUid

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: add complete meeting attachments functionality with file upload

- Add file upload functionality to meeting creation form
- Implement immediate file uploads with progress indicators
- Create reusable file upload component wrapper for PrimeNG
- Add attachment display in meeting cards with file type icons
- Support for PDF, Word, Excel, PowerPoint, and image files
- REST API integration with Supabase storage (no SDK required)
- Created pipes for file type icons and file size formatting
- Add attachment CRUD operations in backend API
- Store attachment metadata in meeting_attachments table
- Display attachments in meeting cards for all scenarios
- Combine attachments and important links in unified resource section

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: extract file upload constants to shared package

- Extract duplicated allowed file types array to ALLOWED_FILE_TYPES constant
- Extract file size limits to MAX_FILE_SIZE_BYTES constant
- Move filename sanitization to reusable sanitizeFilename utility in utils folder
- Remove code duplication between upload endpoints in meetings.ts

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: remove unused messages module

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: add Excel and PowerPoint file support to uploads

- Add application/vnd.ms-excel and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for Excel files
- Add application/vnd.ms-powerpoint and application/vnd.openxmlformats-officedocument.presentationml.presentation for PowerPoint files
- File type icon pipe already supports these file types

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

---------

Signed-off-by: Asitha de Silva <asithade@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>

* feat: implement comprehensive pino logging across server-side code (#31)

* refactor: rename projectId to projectUid

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: add complete meeting attachments functionality with file upload

- Add file upload functionality to meeting creation form
- Implement immediate file uploads with progress indicators
- Create reusable file upload component wrapper for PrimeNG
- Add attachment display in meeting cards with file type icons
- Support for PDF, Word, Excel, PowerPoint, and image files
- REST API integration with Supabase storage (no SDK required)
- Created pipes for file type icons and file size formatting
- Add attachment CRUD operations in backend API
- Store attachment metadata in meeting_attachments table
- Display attachments in meeting cards for all scenarios
- Combine attachments and important links in unified resource section

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: extract file upload constants to shared package

- Extract duplicated allowed file types array to ALLOWED_FILE_TYPES constant
- Extract file size limits to MAX_FILE_SIZE_BYTES constant
- Move filename sanitization to reusable sanitizeFilename utility in utils folder
- Remove code duplication between upload endpoints in meetings.ts

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* refactor: remove unused messages module

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: add Excel and PowerPoint file support to uploads

- Add application/vnd.ms-excel and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet for Excel files
- Add application/vnd.ms-powerpoint and application/vnd.openxmlformats-officedocument.presentationml.presentation for PowerPoint files
- File type icon pipe already supports these file types

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: implement comprehensive pino logging across server-side code

- Replace all console.log/console.error statements with structured pino logging
- Implement dual logger architecture: serverLogger for non-request context, req.log for request-scoped logging
- Add comprehensive comments explaining logging architecture in server.ts
- Use snake_case convention for all log properties for consistency
- Protect PII by removing sensitive data (names, emails, topics) and using boolean flags
- Add structured logging to all routes with operation context, timing, and status codes
- Enhance error handling with detailed logging in middleware and services
- Add retry and failure logging to API client service with proper error context
- Configure pino with appropriate redaction for sensitive headers and tokens
- Environment-aware stack trace logging (development only)

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* fix: disable token middleware (#30)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

---------

Signed-off-by: Asitha de Silva <asithade@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>

* fix: increase express body limit to 15mb and complete pino logging migration

- Increase express.json limit from 1mb to 15mb to support Base64 file uploads up to 10mb
- Convert remaining console statements in meeting attachment routes to req.log
- Add tokenRefreshMiddleware back to server configuration
- Ensure all server-side logging uses structured pino format with snake_case properties
- File upload endpoints now properly support 10mb files (~13mb when Base64 encoded)

Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

* feat: enhance file upload security and reorganize shared package utilities

This commit implements comprehensive improvements to the file upload system
and reorganizes the shared package for better maintainability.

File Upload Security Enhancements:
- Add client-side file validation (size, type, duplicates, filename security)
- Fix RxJS subscription pattern using proper defer/switchMap operators
- Remove duplicate Express route handlers in meetings.ts
- Harden filename sanitization with comprehensive security checks
- Fix data-testid convention for consistent E2E testing

Shared Package Reorganization:
- Move timezone utility functions from constants to utils folder
- Create new timezone.utils.ts with getTimezoneByValue, getUserTimezone, formatTimezoneWithCurrentTime
- Update import paths across codebase to use proper utility locations
- Maintain proper separation of concerns between constants and utilities

Technical Improvements:
- Increase Express body limit from 1mb to 15mb for Base64 file uploads
- Implement proper error handling with structured logging on server side
- Add comprehensive filename security checks (path traversal, Windows reserved names, Unicode normalization)
- Replace nested Observable subscriptions with proper RxJS operators
- Add immediate client-side feedback for file validation errors

All changes tested and verified:
- Build passes successfully
- Linting standards maintained
- License headers properly applied
- Import paths resolve correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Asitha de Silva <asithade@gmail.com>

---------

Signed-off-by: Asitha de Silva <asithade@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants