Fix validation bug when converting Someday events to Grid/Calendar events#1003
Merged
victor-enogwe merged 4 commits intomainfrom Sep 26, 2025
Merged
Conversation
Co-authored-by: victor-enogwe <23452630+victor-enogwe@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Validation Bug When Converting Someday Event to Grid/Calendar Event
Fix validation bug when converting Someday events to Grid/Calendar events
Sep 26, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a validation bug that prevented users from converting Someday events to Grid/Calendar events by dragging them from the sidebar to the calendar. The core issue was that Someday events lack the required position field that Grid events need, causing validation to fail during conversion.
Key Changes
- Modified
_assembleGridEventto use the existingassembleGridEventutility which properly sets default values for all required Grid event fields - Updated type signatures throughout the codebase to use more appropriate web event types
- Added comprehensive unit tests to verify the fix works correctly
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web/src/ducks/events/sagas/saga.util.ts | Updated _assembleGridEvent to use assembleGridEvent utility and improved type annotations |
| packages/web/src/common/validators/grid.event.validator.ts | Updated import structure and function signature to use Schema_WebEvent |
| packages/web/src/common/utils/event.util.ts | Exported gridEventDefaultPosition, updated type signatures, and improved type handling |
| packages/web/src/common/utils/event.util.test.ts | Added unit tests to verify Someday-to-Grid event conversion works properly |
| packages/web/src/common/types/web.event.types.ts | Made _id field optional in WebCoreEventSchema |
| packages/core/src/util/test/ccal.event.factory.ts | Updated MongoDB import and event utility import paths |
| packages/core/src/util/event/compass.event.rrule.ts | Replaced WithId type with WithMongoId throughout |
| packages/core/src/util/event/compass.event.rrule.test.ts | Updated import and type usage to use WithMongoId |
| packages/core/src/types/sync.types.ts | Changed import to use type-only import |
| packages/core/src/types/mongo.types.ts | Updated ObjectId import to use bson instead of mongodb |
| packages/core/src/mappers/map.event.ts | Updated type signatures to use WithMongoId instead of WithId |
| packages/core/src/mocks/v1/events/events.22mar.ts | Updated imports and type usage to use WithMongoId |
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.
Problem
When converting a Someday event to a Grid/Calendar event (e.g., by dragging from sidebar to calendar), the conversion failed with a validation error:
This prevented users from seamlessly moving events between the Someday list and calendar grid view.
Root Cause
The
_assembleGridEventfunction insaga.util.tswas:positionfield) withupdatedFieldsvalidateGridEventGridEventSchemarequires apositionfield that Someday events don't haveSolution
Modified
_assembleGridEventto use the existingassembleGridEventutility function, which properly sets default values for all required Grid event fields including thepositionfield:Testing
Added comprehensive unit tests that verify:
positionfield is properly populated with default valuesAll existing tests continue to pass (419/419), ensuring no regression.
Impact
Users can now successfully convert Someday events to calendar events by dragging them to the grid without encountering validation errors.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.