Repository navigation
refactor(sync): retire dead graph zone option and dedupe microsoft recurrence mapping - #4844
Merged
Merged
Conversation
…tion `NormalizeMicrosoftEventOptions.graphPreferTimeZone` was configurable in name only. Every production caller (reader delta pages, writer fetchEvent, writer fetchInstanceAt) passed `MICROSOFT_GRAPH_OUTLOOK_TIMEZONE`, every test passed the same `"UTC"`, and the option defaulted to that constant when omitted. Both guards that read it compared it against that very constant, so `graphPreferTimeZone === MICROSOFT_GRAPH_OUTLOOK_TIMEZONE` was a tautology and the non-UTC branch in `toOffsetIso` was unreachable. Remove the option and collapse the two branches it fed. `mapSchedule` no longer needs the options bag at all, and `resolveTimedEventTimeZone` now reads as the rule it always implemented: a non-UTC start field is the event's real zone, and a UTC one falls back to the recurrence zone and then the original start zone. Zone resolution and the Prefer header are unchanged, so there is no behavior change. VERDICT: PASS Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gVNGW5WLSrqPjZaT1ReM4
…guards Three pieces of copy-paste had built up in the Graph recurrence mapper: - `RRULE_TO_GRAPH_DAY` restated `GRAPH_TO_RRULE_DAY` backwards, so adding or correcting a weekday meant editing two tables that nothing checked against each other. Invert the forward table instead. - `requireDayOfMonth`, `requireMonth`, `requireCount`, and `requireEndDate` were the same eight lines four times over, differing only in the field name they interpolated. One `requireField` covers all four, and the numbered-range message now names the Graph field (`numberOfOccurrences`) rather than the local variable. - The "Multiple BYDAY ordinals" rule was thrown verbatim from both `splitRelativeByDay` and `byweekdayToTokens`. Both now call `assertSingleOrdinal`. `GRAPH_DAY_ORDER` and `RRULE_WEEKDAY_TOKENS` stay as they are: the first carries Graph's Sunday-first ordering and the second rrule's Monday-based weekday indexes, which are separate facts rather than restatements of the token map. VERDICT: PASS Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gVNGW5WLSrqPjZaT1ReM4
tyler-dane
marked this pull request as ready for review
October 26, 2026 10:09
tyler-dane
enabled auto-merge
October 26, 2026 10:09
Contributor
Author
|
Technical-debt sweep summary for the 2026-10-19 → 2026-10-26 window (49 merged commits reviewed). Debt addressed in this PR
Reviewed and deliberately left alone
Generated by Claude Code |
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.
What and why
Technical-debt sweep over the merged changes from the last seven days. The Microsoft Graph provider was by far the hottest churn in that window (
microsoft-event.normalizer.tstouched six times,microsoft-recurrence.tsfour), and two kinds of debt had accumulated there: a configuration option that was never actually configurable, and four-way copy-paste in the recurrence mapper. Two commits, one per debt item, no behavior change in either.1.
simplify(sync): drop the always-UTCgraphPreferTimeZoneoption.NormalizeMicrosoftEventOptions.graphPreferTimeZonelooked like a seam but had exactly one value. Every production caller (reader delta pages, writerfetchEvent, writerfetchInstanceAt) passedMICROSOFT_GRAPH_OUTLOOK_TIMEZONE; every test passed the same literal"UTC"; omitting it defaulted to that same constant. Both guards that read it compared it against that constant, sographPreferTimeZone === MICROSOFT_GRAPH_OUTLOOK_TIMEZONEwas a tautology and thedayjs.tz(raw, timeZone)branch intoOffsetIsowas unreachable from any caller. Removing the option letsmapScheduledrop the options bag entirely and letsresolveTimedEventTimeZoneread as the rule it always implemented: a non-UTC start field is the event's real zone, and a UTC one falls back to the recurrence zone, then the original start zone. The Prefer header itself is untouched, and the zone each event resolves to is identical.2.
refactor(sync): dedupe the recurrence weekday tables and field guards.RRULE_TO_GRAPH_DAYrestatedGRAPH_TO_RRULE_DAYbackwards, so a weekday correction meant editing two tables with nothing checking them against each other; it is now derived by inverting the forward table.requireDayOfMonth/requireMonth/requireCount/requireEndDatewere the same eight lines four times, differing only in the interpolated field name, and collapse into onerequireField(the numbered-range message now names the Graph field,numberOfOccurrences, instead of the local variable). The "Multiple BYDAY ordinals" rule was thrown verbatim from bothsplitRelativeByDayandbyweekdayToTokens, and both now call oneassertSingleOrdinal.GRAPH_DAY_ORDERandRRULE_WEEKDAY_TOKENSdeliberately stay as they are. They are not restatements of the token map: the first carries Graph's Sunday-first ordering, the second rrule's Monday-based weekday indexes.Net effect across both commits: 7 files, +70 / -154, with the existing suites covering the behavior unchanged.
Verify
bun run verify --strictbun test packages/sync/src/providers/microsoft/microsoft-recurrence.test.ts: 60 pass, 0 fail.🤖 Generated with Claude Code
https://claude.ai/code/session_018gVNGW5WLSrqPjZaT1ReM4