Repository navigation
fix(microsoft): ignore free, cancelled and declined entries in free/busy - #189
Conversation
Graph's calendarView returns every entry on the calendar; the request only $select-ed start,end, so each one counted as busy. Unlike Google's freeBusy (which applies transparency server-side) the filter has to be ours: - showAs "free" (reminders, subscribed holiday calendars, OOO notices from others) - one all-day "free" entry blocked a whole day, and in a collective that day for every other host too - isCancelled meetings still sitting on the calendar - invitations the owner declined Tentative, busy, out-of-office and working-elsewhere still block, matching Outlook's own scheduling assistant. CalDAV already skipped transparent and cancelled events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Important
workingElsewhere is still treated as busy, but Microsoft's availability mapping treats it as free — so the comment's "matches Outlook" claim is wrong, and a full-day "Working elsewhere" entry still blocks that host's whole day, the same symptom #188 reports.
Reviewed changes
- Skip non-blocking
calendarViewentries —$selectnow requestsshowAs,isCancelled,responseStatus, andblocksTimedrops entries that are free, cancelled, or declined before they become busy intervals; everything else still blocks. - New coverage —
TestFreeBusy_skipsEntriesThatDoNotBlockTimeasserts the three fields are in$selectand checks that free/cancelled/declined are skipped while busy/tentative/oof still block.
ℹ️ Calendar-integration docs still describe only the endpoint
docs/ARCHITECTURE.md §10's Microsoft bullet says just "free/busy via /me/calendarView", while §24 asks for the matching section to be updated in the same PR as a behaviour change.
Technical details
# Document the new free/busy filter
## Affected sites
- docs/ARCHITECTURE.md:515-521 — Microsoft provider note mentions only the endpoint.
- docs/ARCHITECTURE.md:1311-1312 — §24: "when you change behaviour in an area above, update the matching section in the same PR".
## Required outcome
- One sentence in the Microsoft bullet: entries marked free, cancelled, or declined do not block; tentative/busy/oof do.deepseek-v4.1-flash | 𝕏
| // calendars, an OOO notice someone else sent), a cancelled meeting still on the calendar, | ||
| // and an invitation the owner declined all leave them available. Without this a single | ||
| // all-day "free" entry blocked a collective's whole day for every other host. Tentative, | ||
| // busy, out-of-office and working-elsewhere still block, as Outlook's own scheduling |
There was a problem hiding this comment.
The parity claim here doesn't hold: Microsoft's availabilityView maps workingElsewhere to 0 ("free or working elsewhere"), so Outlook's scheduling view treats it as available. Because blocksTime only special-cases free, a full-day "Working elsewhere" entry (a common WFH marker) still blocks that host's entire day — the exact symptom #188 reports for other all-day entries.
Technical details
# Treat workingElsewhere consistently with Outlook (or fix the comment)
## Affected sites
- internal/calendar/microsoft/freebusy.go:138 — comment asserts working-elsewhere blocks "as Outlook's own scheduling assistant treats them".
- internal/calendar/microsoft/freebusy.go:144 — `return !strings.EqualFold(showAs, "free")` keeps `workingElsewhere` in the blocking set.
- internal/calendar/microsoft/microsoft_test.go:127-134 — no `workingElsewhere` case, so the decision is not pinned by a test.
## Evidence
- https://learn.microsoft.com/en-us/graph/api/resources/scheduleinformation?view=graph-rest-1.0 — `availabilityView`: `0`= free or working elsewhere, `1`= tentative, `2`= busy, `3`= out of office.
## Required outcome
- Either treat `workingElsewhere` as non-blocking (same as `free`) so availability matches Outlook, or keep the conservative behaviour deliberately and correct the comment's rationale.
- Add `workingElsewhere` (and ideally `unknown`) to `TestFreeBusy_skipsEntriesThatDoNotBlockTime` so whichever choice is made stays locked in.
Fixes #188
$select=start,end,showAs,isCancelled,responseStatus, and a smallblocksTimefilter: skipshowAs == free,isCancelled, andresponseStatus.response == declined. Tentative, busy, out-of-office and working-elsewhere still block, matching Outlook's own scheduling assistant.Tests:
TestFreeBusy_skipsEntriesThatDoNotBlockTimealso asserts the$selectincludes the fields the filter reads (Graph omits anything not selected).