Repository navigation
Various Refactorings - #224
Merged
Merged
Conversation
UZ9
commented
Nov 4, 2025
Contributor
- Fixed issues with bog-analyitcs mysteriously failing without any warning
- Added more logging to bog-analytics custom analytics errors (these should eventually be uniform across all events)
- Removed implicit transformations due to them breaking user type routes
- Returned file information when retrieving config. This was the original vision outlined in the design for file services, although I'm not 100% sold on it. A better way might be returning minimal information on the config route and having dedicated routes for retrieving all buckets and all files -- will probably make this a sprint ticket
Implicit conversion was causing grief with transforming user types and are no longer needed.
Contributor
There was a problem hiding this comment.
Disclaimer: This comment was AI-generated and is not necessarily completely accurate. Please take code comments with a grain of salt.
Greptile Overview
Greptile Summary
This PR improves error handling, fixes type validation issues, and implements file/bucket retrieval functionality.
Key Changes:
- Analytics Error Handling: Wrapped
logger.logCustomEventin try-catch with enhanced error messages that include category and subcategory for easier debugging - ValidationPipe Fix: Removed
enableImplicitConversionwhich was conflicting with explicit@Transformdecorators in DTOs likeSetUserTypeModel.type - File Config Enhancement: Implemented full data retrieval in
getConfig, returning actual files and buckets with relationships instead of empty arrays
Architecture Impact:
The file config change moves from returning minimal data to full relationship graphs. While functional, the PR author notes this may benefit from dedicated routes for retrieving buckets/files separately.
Confidence Score: 4/5
- This PR is safe to merge with low risk - changes are defensive improvements and bug fixes
- Score reflects well-tested bug fixes with one consideration: the file_config changes add complexity without formal type definitions (TODO comment acknowledges this). The changes are sound but could benefit from follow-up work on the API design as the author notes
- Check
packages/db-service/src/modules/file_config/file_config.controller.ts- verify the nested data structure matches proto definitions in production use cases
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/analytics-service/src/modules/analytics/analytics.service.ts | 5/5 | Added try-catch around logger.logCustomEvent call with detailed error messages including category/subcategory to aid debugging |
| packages/api-gateway/src/main.ts | 5/5 | Removed enableImplicitConversion from ValidationPipe to prevent conflicts with explicit @Transform decorators in DTOs |
| packages/db-service/src/modules/file_config/file_config.controller.ts | 4/5 | Extended getConfig to return full file and bucket data with nested relationships instead of empty arrays |
Sequence Diagram
sequenceDiagram
participant Client
participant APIGateway
participant AnalyticsService
participant BogAnalytics
participant DBService
participant Database
Note over APIGateway: ValidationPipe (no implicit conversion)
Client->>APIGateway: POST /user/set-type {type: "ADMIN"}
APIGateway->>APIGateway: Transform decorator converts string to enum
APIGateway->>DBService: Update user type
DBService->>Database: Update query
Database-->>DBService: Success
DBService-->>APIGateway: User updated
APIGateway-->>Client: Success response
Client->>APIGateway: POST /analytics/custom-event
APIGateway->>AnalyticsService: logCustomEvent(category, subcategory, properties)
AnalyticsService->>AnalyticsService: getAnalyticsLogger()
AnalyticsService->>BogAnalytics: logger.logCustomEvent(...)
alt Success
BogAnalytics-->>AnalyticsService: Event response
AnalyticsService-->>APIGateway: Event logged
else Error
BogAnalytics-->>AnalyticsService: Throws error
AnalyticsService->>AnalyticsService: Catch error, enhance message
AnalyticsService-->>APIGateway: RpcException with details
end
Client->>APIGateway: GET /file-config
APIGateway->>DBService: getConfig(id, environment)
DBService->>Database: Query with includes (buckets, FileServiceFile)
Database-->>DBService: Config with relations
DBService->>DBService: Transform Prisma to Proto format
DBService->>DBService: Map files and buckets arrays
DBService->>DBService: Filter files by bucket
DBService-->>APIGateway: Config with files and buckets
APIGateway-->>Client: Full config data
3 files reviewed, no comments
Contributor
Author
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.