Skip to content

feat(calendar): subscribe from the Outlook.com and Office 365 rows - #429

Merged
sydevs-bot merged 8 commits into
mainfrom
claude/feat-428-outlook-subscribe
Nov 18, 2026
Merged

sydevs-bot merged 8 commits into
mainfrom
claude/feat-428-outlook-subscribe

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Both Outlook rows now subscribe to the class's calendar feed, so every session appears and a cancelled one clears itself.
  • A class with no feed address keeps today's single-session compose link on both rows, rather than losing them.

Change outline

Flow — what the two Outlook rows resolve to

The row now has one entry point, and the subscribe-or-compose choice sits beside the facts that justify it.

 calendarLinkTargets(event)                     src/components/molecules/AddToCalendar/AddToCalendar.tsx
   Apple    → buildFeedSubscribeUrl             # webcal:, dropped with no feed
   Google   → buildGoogleCalendarUrl            # cid=webcal:, dropped with no feed
   Outlook  → buildOutlookCalendarUrl(event, 'live'|'office')
+    buildOutlookSubscribeUrl                   src/lib/ics.ts, module-private
+      feedAddress → https:// form onto `url`   # undefined with no feed
+    ?? outlookComposeUrl                       # was buildOutlookCalendarUrl, now module-private
+      occurrenceStart(schedule, from)          # one session, the fallback only
   Yahoo    → buildYahooCalendarUrl             # one session, always

Contract — the URL each Outlook row carries

-https://outlook.{live,office}.com/calendar/0/deeplink/compose
-  ?path=/calendar/action/compose&rru=addevent&subject=…&startdt=…&enddt=…
+https://outlook.{live,office}.com/calendar/0/addfromweb
+  ?url=<the class's https feed address>&name=<title>

Same two hosts, same scheme, still a target="_blank" navigation — so isSafeHref, the CSP table and the sandbox flags are all untouched.

Behaviour — the feed-address guard

 feedAddress(input)                             src/lib/ics.ts
-  inline /^https?:/i, a third copy of the guard
+  validateWebUrl(calendarFeedUrl?.trim())      # lib/url.ts, the guard shape/href.ts names
 buildFeedSubscribeUrl
-  strip with a second regex                    # would refuse what the guard admits
+  strip from the colon the guard admitted

Preview

Preview pending — no Cloudflare alias exists until the first build lands. Both previews are worth a look once they do:

  • The component library's Molecules → Add To Calendar story — all four cases, including "No feed address", which is the one the unit lane cannot render.
  • The app's registration confirmation, where the menu actually ships.

Test results

  • Lean gate: ✓ lint + typecheck + test:run (173 files, 2110 tests), re-run after the review commits
  • Targeted specs: 53 passed (src/lib/ics.test.ts, AddToCalendar.test.tsx)
  • Build: ✓ pnpm build + pnpm size were green on 230a440. The three review commits are comments, one export keyword and a spec retarget, so CI owns the re-run.
  • Every new assertion was watched failing first, against seven separately reintroduced defects: the resolver never subscribing, the resolver losing its fallback, the rows dropping instead of demoting, webcal: handed to url, the address guard skipped, and the subscribe URL anchored on from.

Manual verification

Acceptance criterion 3 and the last two checklist lines need a signed-in browser, which this run has no way to reach. Both hosts answer 417 to every scripted path, a bogus one included — re-measured 2026-11-18, so the ticket's claim still holds and nothing automated can settle this.

  1. Signed in to a personal Outlook.com account, open a weekly class in the preview and choose Outlook.com. It should open a subscribe prompt, not an add-event form, and three future sessions should appear afterwards.
  2. Signed in to a work (Microsoft 365) account, do the same with Office 365.
  3. If either opens an add-event form, that row goes back to the compose link — now a one-line change in src/lib/ics.ts, and buildOutlookSubscribeUrl can stay for whichever row still works.

Notes for reviewer

  • The route is observed, not documented. Microsoft publishes no subscribe address. The shape is the one the established add-to-calendar libraries ship, and the rejected sibling — deeplink/compose's own rru=addsubscription — is reported as superseded in a Microsoft Q&A thread.
  • Two variants I did not take, both worth trying if step 1 fails. Those libraries reportedly emit /addfromweb/ with a trailing slash, and encode name with %20 where URLSearchParams gives +. The ticket's Approach spells the route without the slash, so I followed it rather than deviating on a guess — and the same host's compose endpoint demonstrably accepts a URLSearchParams-encoded subject today.
  • buildOutlookCalendarUrl keeps its name and signature but changed meaning: it is the row's resolver now, and the compose shape is module-private outlookComposeUrl. Its existing specs pass unchanged, because they already pass a feedless event.
  • Dismissed from review: a suggestion to narrow buildOutlookSubscribeUrl's parameter to the two fields it reads — the uniform IcsEventInput signature is what lets calendarLinkTargets call all five builders alike.
  • Adopted from review: the drift argument above was inverted and is corrected; the row policy now lives in ics.ts's header alone, with each builder's doc saying only what it builds; and buildOutlookSubscribeUrl is module-private, tested through buildOutlookCalendarUrl.
Detail

Why the choice moved into lib/ics.ts rather than staying in the menu. It was a closure in calendarLinkTargets first. Two review lenses independently asked for it to move, and the deciding argument is this ticket's own: it anticipates reverting one or both rows on the hand test's evidence. With the choice in the component that revert spans two files; here it is one line in one file. The supporting tell is that two doc blocks in ics.ts were describing a policy neither file implemented. AddToCalendar.tsx's code diff is now zero — only its prose changed.

Why the webcal: swap stopped using a regex. Routing feedAddress through validateWebUrl left the strip on a separate /^https?:/i. The old code derived the strip length from the match that validated, so the two could not drift; split, a later widening of the shared guard would have made buildFeedSubscribeUrl refuse an address the guard admitted — dropping the Apple and Google rows rather than swapping the scheme. Slicing from the colon the guard already admitted cannot refuse on its own, so the swap goes wherever the guard goes, and it retires the third copy of the regex that src/lib/shape/href.ts:7 names as exactly two.

What the 417s mean. https://outlook.live.com/calendar/0/nonsense-path-xyz answers 417 just as addfromweb and the working deeplink/compose do, so a scripted probe cannot tell a real route from an invented one on either host. That is why this PR owes a click and not a test.

docs/embedding.md needed no edit. Its three calendar lines document sandbox flags and the webcal: protocol handler. Both Outlook rows still open a page in a new tab and still need allow-popups, so every sentence there is still true. CHANGELOG.md carries the host-visible change, and its #393 entry — which claimed both rows add one session only — was corrected, since it sits in the same unreleased section as the bullet reversing it.

Closes #428


Generated by Claude Code

Both Outlook rows composed a single-event deeplink/compose link, so
somebody on Outlook got the next session of a weekly class and then
nothing, while Apple and Google already subscribed to the class's own
feed. They now take Outlook's add-from-web route with that feed's
https:// address, so every session appears and a cancelled one clears
itself.

The compose link stays as the fallback for a class with no feed
address: unlike Apple and Google, which drop out, these two rows
compose their own URL from the schedule and still work without one.

feedAddress() is the shared, scheme-validated read of the field.
buildFeedSubscribeUrl keeps the webcal: swap for the calendar APPS;
Outlook on the web fetches the feed itself, so it gets https://.

Microsoft documents no subscribe route, and both hosts still answer
417 to every scripted path, a bogus one included (re-measured
2026-11-18), so only a signed-in click can tell a subscribe prompt
from the add-event modal. #428 carries that check.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXwrXvmSXEhUjMRr39
The CHANGELOG is one of the two documents an embedding site reads, and
what a visitor gets from those two rows changed. docs/embedding.md
needed nothing: it describes the sandbox flags each row needs, and both
rows are still target="_blank" links to the same two hosts.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXwrXvmSXEhUjMRr39
Per the /simplify pass, both the reuse and the altitude lens.

buildOutlookCalendarUrl keeps its name and signature and becomes the
Outlook row's one entry point, picking the subscription or the compose
link; the compose shape is now module-private. Every fact behind that
choice is in this file, and the revert the ticket anticipates is now
one file wide. AddToCalendar.tsx goes back to its original two lines.

feedAddress asks validateWebUrl instead of restating /^https?:/i.
shape/href.ts names the http(s) guards as exactly two, and giving a
third one a name was the moment to reach for the shared one.

IcsEventInput.from and occurrenceStart both still named Outlook as
recurrence-less. True now only on the compose fallback.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXwrXvmSXEhUjMRr39
Per the /code-review pass.

buildFeedSubscribeUrl validated with validateWebUrl and then stripped
with its own FEED_SCHEME, so the two could stop agreeing: widening the
shared guard would have turned a refusal into a malformed webcal: href
instead. The swap now drops whatever scheme the guard admitted, which
also retires the third copy of /^https?:/i.

The #393 CHANGELOG bullet said both Outlook rows add one session only.
It sits in the same unreleased section as the bullet reversing it.

The One-off story said every provider gets the same single date, while
that event carries a feed address.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXwrXvmSXEhUjMRr39
@sydevs-bot

sydevs-bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 18:41Z address-review · attempt 1 · session · done
  • 18:41Z address-review · attempt 1 · session
  • 18:34Z review-pr · attempt 1 · session · done
  • 18:34Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 18, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

The behaviour matches the ticket: both Outlook rows resolve to add-from-web with the class's https feed, and fall back to compose with none. The code is ~20 lines and sits where the ticket's revert plan wants it. The prose is what is oversized — 204 lines across 6 files, one policy written out eleven times, AddToCalendar.tsx changed with a zero-line code diff. AC3 stays open: if the click fails, both rows break for every class that has a feed, not only the fallback case.

Findings

  • should-fix src/lib/ics.ts:433 — the drift argument is inverted. The pattern it removed was the refusal.
  • should-fix src/lib/ics.ts:22 — eleven doc sites restate one policy. Each flip pays the sweep.
  • consider src/lib/ics.ts:486 — exported for its test alone, beside a private sibling with the same one caller.

What was checked

  • Ticket #428 against the diff: all three Approach bullets land. The one deviation — the choice in ics.ts, not calendarLinkTargets — is argued and is smaller.
  • Ladder: the diff adopts validateWebUrl (lib/url.ts), retiring the third copy shape/href.ts:7 counts as two. URLSearchParams is the platform's. No new dependency, and this file's header measures the build-vs-buy call (#105).
  • Whole-file pass over ics.ts: fold, occursOn, exclusionDates and the RFC 5545 hand-roll each carry a named reason to be custom.
  • docs/embedding.md:618,1393,1394 stay true — same two hosts, same scheme, same target="_blank", so no CSP or sandbox line moves.
  • The new CHANGELOG entry and the edited #393 one both sit under ## [Unreleased].
  • calendarFeedUrl readers (fetch.ts:702, RegistrationView.tsx:101, types/event.ts:232) hold no second copy of the guard.
  • .claude/workflow.json on main declares no previewUrl and no fixture: no preview links.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/lib/ics.ts Resolved
Comment thread src/lib/ics.ts Resolved
Comment thread src/lib/ics.ts Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 18, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 18, 2026
The comment claimed a second `/^https?:/i` beside `validateWebUrl` would
turn a refusal into a malformed href. It is the other way round: the
two-pattern form was the one that refused, returning `undefined` for an
address the shared guard admitted. The slice never refuses on its own,
which is what makes it agree with the guard.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXvUBVAc2MLoHu2E6i
It was exported for its own spec alone, beside a module-private sibling
with the same single caller. Both shapes are reachable through
`buildOutlookCalendarUrl`, which is what each row calls, so the specs now
go through it and the no-feed case asserts the demotion to compose
rather than an `undefined` no caller ever sees.

Both arms were watched failing: the resolver returning compose
unconditionally reddens three, and `feedAddress` dropping `validateWebUrl`
reddens the guard case.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXvUBVAc2MLoHu2E6i
Which rows subscribe was written out beside every builder, in the type,
in the anchor helper and twice in the menu. A flip pays that sweep, and a
missed site goes stale in silence. The file header owns it now and says
so; each builder's doc says only what it builds, and the menu's doc keeps
only what it decides — which rows render and which demote.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjXvUBVAc2MLoHu2E6i
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Three critic threads, all adopted and resolved. origin/main merged in clean — one commit behind, no conflict, pushed with the work.

Lean gate green on the merged branch: 173 files, 2110 tests. No securityReview path touched. AC3 still needs a signed-in click on each host.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 18, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review November 18, 2026 18:52
@sydevs-bot
sydevs-bot requested a review from Ardnived November 18, 2026 18:52
@sydevs-bot
sydevs-bot enabled auto-merge November 18, 2026 18:52
@sydevs-bot sydevs-bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Nov 18, 2026
@sydevs-bot sydevs-bot moved this from Awaiting to Pending in SYDevelopers Technical Roadmap Nov 18, 2026
Merged via the queue into main with commit a2118f5 Nov 18, 2026
61 of 65 checks passed
@sydevs-bot
sydevs-bot deleted the claude/feat-428-outlook-subscribe branch November 18, 2026 19:08
@sydevs-bot sydevs-bot moved this from Pending to Done in SYDevelopers Technical Roadmap Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

feat(calendar): subscribe from the Outlook.com and Office 365 rows

3 participants