fix: robust session matching for recurring events with stale has_recurrence_rules#4123
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
Conversation
…rrence_rules When a session's event_json has stale or missing has_recurrence_rules, the key format mismatch between eventMatchingKey (trackingId:day) and sessionEventMatchingKey (trackingId) prevents both syncSessionEmbeddedEvents and syncParticipants from finding the session. This causes participants to never sync for recurring events where the session was created before has_recurrence_rules was correctly set. Fix: - Add fallback matching in findSessionByKey that compares tracking_id and day independently when the primary key match fails - Add fallback matching in syncSessionEmbeddedEvents using a secondary index by tracking_id to find incoming events when key format differs Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for hyprnote canceled.
|
✅ Deploy Preview for hyprnote-storybook canceled.
|
Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
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.
fix: add fallback session matching for recurring events
Summary
Adds fallback matching logic to
syncSessionEmbeddedEventsandfindSessionByKeyto handle sessions whoseevent_jsonhas a stale or missinghas_recurrence_rulesfield.Problem: The session-event matching uses different key formats depending on
has_recurrence_rules:trackingId:daytrackingIdIf a session's
event_jsonhashas_recurrence_rules: false(or undefined) when the actual event is recurring, the keys never match. This creates a permanent mismatch —syncSessionEmbeddedEventscan't update the session (chicken-and-egg), andsyncParticipantscan't find the session to link participants.Fix:
findSessionByKey(session-event.ts): After primary key match fails, tries matching by comparingtracking_idand computed day independently viamatchesWithFallbacksyncSessionEmbeddedEvents(execute.ts): Builds a secondary index bytracking_id, falls back to matching by tracking_id + day when the primary key lookup missesContext: User reported that self-created events don't show participants while invited events do. This fix addresses one possible cause (stale recurring event metadata), though the root cause may also involve Apple Calendar's EventKit not returning attendees for organizer-created events.
Review & Testing Checklist for Human
has_recurrence_rules. Confirm whether the user's "marketing weekly" session actually has a stalehas_recurrence_rulesvalue in itsevent_json— if the real issue is EventKit not returning attendees at all, this fix won't help and a different investigation is neededhas_recurrence_rules: falseinevent_json, then run a calendar sync and verify participants are now linkedmatchesWithFallback,findIncomingByTrackingIdAndDay) are not covered by tests; consider whether test coverage is neededNotes
dayFromDateLocalinexecute.tsduplicates the privatedayFromDatefromsession-event.ts— could be consolidated by exporting it