[FSSDK-11638] cleanups in event processing#1073
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors how user events are built by introducing a generic buildBaseEvent helper, removes legacy V1 log builders, updates tests to use the unified batch builder, and adds a caching check in the batch processor.
- Extracted common event fields into a new
buildBaseEventfunction and updatedbuildImpressionEvent/buildConversionEventto use it - Removed
buildImpressionEventV1/buildConversionEventV1fromlog_event.tsand revised specs to targetmakeEventBatch - Added an early-return cache in
BatchEventProcessor.readEventCountInStoreto prevent redundant store reads
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| lib/event_processor/event_builder/user_event.ts | Refactored user events to use a generic BaseUserEvent<T> and buildBaseEvent helper |
| lib/event_processor/event_builder/log_event.ts | Deleted legacy V1 event builders |
| lib/event_processor/event_builder/log_event.spec.ts | Updated tests to call makeEventBatch and renamed suite |
| lib/event_processor/batch_event_processor.ts | Added a guard to skip store lookup when eventCountInStore is already set |
Comments suppressed due to low confidence (3)
lib/event_processor/event_builder/user_event.ts:112
- [nitpick] Consider adding a JSDoc comment to
buildBaseEventto clarify its purpose and parameters for future maintainers.
const buildBaseEvent = <T extends EventType>({
lib/event_processor/event_builder/user_event.ts:47
- [nitpick] If
EventTypeis intended for reuse outside this module, consider exporting it (export type EventType) to improve discoverability.
type EventType = 'impression' | 'conversion';
lib/event_processor/event_builder/user_event.ts:146
- [nitpick] The new
buildImpressionEventandbuildConversionEventfunctions rely onbuildBaseEvent; consider adding direct unit tests to cover their output structure.
}
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.
Summary
Issues