Skip to content

fix(microsoft): ignore free, cancelled and declined entries in free/busy - #189

Merged
shockalotti merged 1 commit into
Calnode:mainfrom
MohammadHadi2031:fix/msgraph-freebusy-showas
Oct 29, 2026
Merged

shockalotti merged 1 commit into
Calnode:mainfrom
MohammadHadi2031:fix/msgraph-freebusy-showas

Conversation

@MohammadHadi2031

Copy link
Copy Markdown
Contributor

Fixes #188

$select=start,end,showAs,isCancelled,responseStatus, and a small blocksTime filter: skip showAs == free, isCancelled, and responseStatus.response == declined. Tentative, busy, out-of-office and working-elsewhere still block, matching Outlook's own scheduling assistant.

Tests: TestFreeBusy_skipsEntriesThatDoNotBlockTime also asserts the $select includes the fields the filter reads (Graph omits anything not selected).

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>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 calendarView entries — $select now requests showAs,isCancelled,responseStatus, and blocksTime drops entries that are free, cancelled, or declined before they become busy intervals; everything else still blocks.
  • New coverage — TestFreeBusy_skipsEntriesThatDoNotBlockTime asserts the three fields are in $select and 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@shockalotti
shockalotti merged commit d6c7bc3 into Calnode:main Oct 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft calendars: "free", cancelled and declined events block availability

3 participants