Repository navigation
feat(calendar): subscribe from the Outlook.com and Office 365 rows - #429
Conversation
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
left a comment
There was a problem hiding this comment.
🧐 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-fixsrc/lib/ics.ts:433— the drift argument is inverted. The pattern it removed was the refusal.should-fixsrc/lib/ics.ts:22— eleven doc sites restate one policy. Each flip pays the sweep.considersrc/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, notcalendarLinkTargets— is argued and is smaller. - Ladder: the diff adopts
validateWebUrl(lib/url.ts), retiring the third copyshape/href.ts:7counts as two.URLSearchParamsis 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,exclusionDatesand the RFC 5545 hand-roll each carry a named reason to be custom. docs/embedding.md:618,1393,1394stay true — same two hosts, same scheme, sametarget="_blank", so no CSP or sandbox line moves.- The new CHANGELOG entry and the edited #393 one both sit under
## [Unreleased]. calendarFeedUrlreaders (fetch.ts:702,RegistrationView.tsx:101,types/event.ts:232) hold no second copy of the guard..claude/workflow.jsononmaindeclares nopreviewUrland nofixture: no preview links.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
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
|
Three critic threads, all adopted and resolved.
Lean gate green on the merged branch: 173 files, 2110 tests. No 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
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.
Contract — the URL each Outlook row carries
Same two hosts, same scheme, still a
target="_blank"navigation — soisSafeHref, the CSP table and the sandbox flags are all untouched.Behaviour — the feed-address guard
Preview
Preview pending — no Cloudflare alias exists until the first build lands. Both previews are worth a look once they do:
Test results
test:run(173 files, 2110 tests), re-run after the review commitssrc/lib/ics.test.ts,AddToCalendar.test.tsx)pnpm build+pnpm sizewere green on 230a440. The three review commits are comments, oneexportkeyword and a spec retarget, so CI owns the re-run.webcal:handed tourl, the address guard skipped, and the subscribe URL anchored onfrom.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.
src/lib/ics.ts, andbuildOutlookSubscribeUrlcan stay for whichever row still works.Notes for reviewer
deeplink/compose's ownrru=addsubscription— is reported as superseded in a Microsoft Q&A thread./addfromweb/with a trailing slash, and encodenamewith%20whereURLSearchParamsgives+. 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 aURLSearchParams-encodedsubjecttoday.buildOutlookCalendarUrlkeeps its name and signature but changed meaning: it is the row's resolver now, and the compose shape is module-privateoutlookComposeUrl. Its existing specs pass unchanged, because they already pass a feedless event.buildOutlookSubscribeUrl's parameter to the two fields it reads — the uniformIcsEventInputsignature is what letscalendarLinkTargetscall all five builders alike.ics.ts's header alone, with each builder's doc saying only what it builds; andbuildOutlookSubscribeUrlis module-private, tested throughbuildOutlookCalendarUrl.Detail
Why the choice moved into
lib/ics.tsrather than staying in the menu. It was a closure incalendarLinkTargetsfirst. 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 inics.tswere 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. RoutingfeedAddressthroughvalidateWebUrlleft 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 madebuildFeedSubscribeUrlrefuse 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 thatsrc/lib/shape/href.ts:7names as exactly two.What the 417s mean.
https://outlook.live.com/calendar/0/nonsense-path-xyzanswers 417 just asaddfromweband the workingdeeplink/composedo, 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.mdneeded no edit. Its three calendar lines document sandbox flags and thewebcal:protocol handler. Both Outlook rows still open a page in a new tab and still needallow-popups, so every sentence there is still true.CHANGELOG.mdcarries 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