Repository navigation
feat(calendar): subscribe to a class's feed from the calendar menu - #395
Conversation
The menu could not subscribe anyone to anything. Apple got a downloaded file that often sat in Downloads unopened, Google got a one-off `action=TEMPLATE` link the viewer then owned a copy of, and a session the host cancelled stayed in everyone's calendar for good. SahajCloud now serves a token-addressed `.ics` feed per class, so Apple and Google subscribe to that address instead: the class keeps itself current, and a cancellation clears itself within a day. The address is read off the event document, never composed here — it carries a signed token only SahajCloud can mint, so a class without one offers the download row alone rather than an inert subscribe row. `webcal:` joins the href allowlist, which is the first scheme there that reaches neither `SafeUrlSchema` nor `validateWebUrl`, so the docblocks say so. The download moves to its own last row and takes `download_ics` as its own label, which the Apple row used to carry as a sub-label. The two Outlook rows keep today's single-session link: Microsoft documents no subscribe route, both hosts answer 417 to every path a script can try, and only a signed-in click can settle which of the two plausible shapes works. That is the treatment the goal already gives a service with no subscribe route, and it costs the goal's Outlook line until somebody runs that click. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjV6phUf3k281RgeBQJ
… subscribe Four corrections from the branch review. Dropping every row when a class has no feed address took Outlook.com, Office 365 and Yahoo with it. Those three compose their own URL from the schedule and worked before this branch, so only Apple and Google — the two that genuinely have nothing to subscribe to — are withheld now. The host-facing copy claimed all four of those rows subscribe. Only Apple and Google do, so `CHANGELOG.md` says that, and the embedding guide's new troubleshooting row no longer sends a sandboxed host looking for a protocol handler behind two ordinary links. The `ics.ts` docblock counted its own link-outs wrong, and the href spec still pinned the retired `action=TEMPLATE` link as a live production href. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjV6phUf3k281RgeBQJ
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 516e98a | Nov 12 2026, 06:11 PM |
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Smaller than the problem: a template-link path is deleted and replaced by a scheme swap, and the eager graph did not grow. Contracts hold — the hand-copied payload-types.ts hunk is byte-identical to sydevs/SahajCloud#1134's own, and neither in-tree consumer of docs/embedding.md sandboxes an iframe, so the sandbox rewrite reaches nobody downstream.
The criterion D deviation is right — keep it. The literal reading would retire Outlook.com, Office 365 and Yahoo, three rows that need no feed address and work today, to honour wording written when all five were expected to subscribe.
Genuinely unfinished: no row carries a sub-label, so the menu never says which rows subscribe. Blocked on the CMS, and the shortcut: names the trigger.
Findings
should-fix—buildAppleCalendarUrlis a zero-behaviour alias, named for a specificity the string lacks.src/lib/ics.ts:420should-fix— the Preview section says no alias exists.sahajatlas-designdeployedc4dfb0f4at 00:07, before the body was written, and that Ladle story shows the four menu cases.consider—target="_blank"on thewebcal:row.AddToCalendar.tsx:112
What was checked
Read whole on the branch: ics.ts, href.ts, event.ts, AddToCalendar.tsx, Link.tsx. Ladder: buildFeedSubscribeUrl has no platform or repo equivalent, and no helper the template link used is left dead. The widened ALLOWED_SCHEME reaches Link, Button and ActionRow; every CMS value arriving there is /^https?:/i at SafeUrlSchema or validateWebUrl, so only our own swap mints a webcal:. Consumers: WeMeditateWeb/lib/atlas-embed.ts and the WordPress shortcode.php both script-embed, and neither repo contains the word sandbox. Preview unreachable — the deploy comment links build logs, not an alias.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`buildAppleCalendarUrl` was `buildFeedSubscribeUrl` under a second name, and the name claimed a specificity the string does not have: Google's `cid` carries the very same address. `calendarLinkTargets` calls the builder directly, and the Calendar.app paragraph moves onto it, where the scheme swap it explains lives. The spec asserting the alias equalled its target had nothing left to assert. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYumo7KjBNkz1CR7Yt
The Apple row opens a `webcal:` address the operating system handles. A new tab has nothing to show, and in a sandboxed host page `target="_blank"` makes `allow-popups` a condition of reaching the handler at all — a flag spent on a tab nobody sees. The app's other protocol-handler hrefs (`tel:`, `mailto:`) carry no target either. `opensPage` on `CalendarLinkTarget` carries the distinction, so the four rows that do open a page keep their new tab and a sixth row has to state which it is. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYumo7KjBNkz1CR7Yt
The sandbox guidance said `allow-popups` covers every calendar row but the last, and that both subscribe rows open a protocol handler. Neither is true now: the Apple row navigates in place, so no flag reaches it at all, and Google Calendar is an ordinary page — the `webcal:` address only rides in its query string. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjYumo7KjBNkz1CR7Yt
|
Both critic threads adopted, plus one point from the review body. Pushed
Lean gate green: 166 files / 2012 tests. The new per-row assertion was watched failing against 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Ready to review with sydevs/SahajCloud#1131. It merges after sydevs/SahajCloud#1131 does: auto-merge is armed once that closes, after its contract re-sync lands here. 🤖 sydevs dispatcher |
|
@sydevs-bot Answer: It's not clear to me what actually serves the subscription URLs. Surely there must be some endpoint on our end that actually serves the most recent information otherwise how does Google and Apple query us for cancellations? If there isn't how are cancellations served? Explain in simple terms. |
Reading this file, it is not discoverable that an endpoint exists behind the feed address at all, and a reviewer went looking for one. The builder swaps a scheme and stops, so the sentence names where freshness comes from: SahajCloud serves the address, and the subscriber's calendar re-reads it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY3HTqsPxazf8iBqSo
|
The endpoint is real — it lives in SahajCloud, not here. sydevs/SahajCloud#1134 adds A cancellation travels like this:
That is the difference from the old Google link, which handed over a copy the viewer kept. Pushed 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
The reviewer chose option B on the seed thread: the sub-labels carry too little for the cost of a schema key, a seed line and a shipped migration. Nothing read them yet — sydevs/SahajAtlasWeb#395 was to wire them after this deploys — so dropping them now costs no consumer. Gone with them: the schema entries and their `maxLength`, the English seed line, the guarded data-only migration and its re-stamped snapshot, and the int spec that held both migration directions. The schema spec's key count returns to 260. `pnpm db:migrations:create --skip-empty` writes nothing, so no DDL was pending behind the removed migration. The menu's five brand rows keep their own labels, and "Download .ics file" is untouched. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVQhj3rLtXKGRn43G6
|
@sydevs-bot address |
…r them The shortcut told the next reader to add `event.actions.calendar_keeps_updated` and `event.actions.calendar_next_session_only` once SahajCloud deployed them. sydevs/SahajCloud#1134 dropped both keys instead, so that trigger can never fire and the instruction would send somebody after strings nobody will mint. What is worth keeping is why the rows are silent and where new copy starts. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVM2ikGXPGgNqJGohH
|
Dropped the sub-label ⚠ The ticket's criteria D and F are no longer reachable from this repo, and nor is the goal's Yahoo success line. All three name those keys. Body updated to say so.
The provisional 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
calendarLinkTargets' docblock no longer tells the next reader to wire two sub-label keys: feat(events): serve a token-addressed calendar feed for a class SahajCloud#1134 dropped both rather than ship them.Change outline
Components — the menu, and which rows depend on what
The two subscribing rows are the only ones that need an address, so a class without one loses exactly those two. The other three compose their own URL from the schedule and worked before this branch.
Flow — where the address comes from, and what it may not be
getEventDoc(id) src/config/api/fetch.ts select { …, webUrl + , calendarFeedUrl } # defaultPopulate: false upstream EventDocSchema.parse + calendarFeedUrl: SafeUrlSchema # https? only, .nullish().catch(null) RegistrationView src/views/RegistrationView/RegistrationView.tsx calendarExport = { id, title, schedule, location, url + , calendarFeedUrl } RegistrationForm → AddToCalendar buildFeedSubscribeUrl(input) src/lib/ics.ts + read off the document, never composed from input.id + ^https?: → webcal: # else undefined + one builder, both subscribing rows # Google percent-encodes it onto cidContract — one more scheme at the href gate
⚠
webcal:is the first entry that reaches neither upstream URL guard: it is an address this repo builds by swapping the scheme on acalendarFeedUrlthose guards already parsed ashttp(s). The docblock says so rather than implying a check that does not cover it, anddocs/rules/data-layer.md§ "isSafeHrefis the sink-level gate" says the same. The JSX-anchor inventory stays at three — the rows render through theLinkatom.Contract — what a host can observe
Preview
sahajatlas-design, the Ladle playground, builds on every push to this branch — the Cloudflare comment on this PR carries the latest one and links its build. The app's own preview is published byci.yml'sversions upload, not by Workers Builds.Data: not seeded yet. ⚠ No preview can show a working subscribe row, now or later: the feed is served by SahajCloud's production host, and the addresses in the Ladle story are fictional. Verifying a subscribe needs a deployed preview pointed at production SahajCloud, after sydevs/SahajCloud#1134 deploys — see Manual verification.
Contract impact
src/types/payload/payload-types.tsis hand-copied from the producer branch, and is provisional. It is acontractSyncpath, sopnpm types:cms— which reads SahajCloud'smain— would revertcalendarFeedUrlright now and leavepnpm typecheckfailing. Do not run it on this branch before feat(events): serve a token-addressed calendar feed for a class SahajCloud#1134 merges; the dispatcher re-syncs it here afterwards.recoverLostJobs(SahajCloud#1122). Both are optional declarations no code here reads, and the contract sync rewrites the whole file after the merge — editing a generated file by hand to chase part of that drift would be worse than letting the sync do all of it.docs/embedding.md's two in-tree consumers (WeMeditateWeb/lib/atlas-embed.ts, the WordPress plugin's templates) read parameters and CSP, neither of which changed, and neither sandboxes its iframe.Test results
.claude/skills/pr-prep/check.sh— lint, typecheck, typecheck:tests, 166 unit files / 2013 tests, re-run withorigin/mainmerged inics.test.ts(41),href.test.ts,event.test.ts,fetch.test.ts,AddToCalendar.test.tsx,translations.test.tspnpm build+pnpm size— embed 329.2 KiB against a 330 KiB budget, 0.8 KiB spare (the subscribe builders replaced a heavier template-link path, so the graph did not grow). Measured before the review round, which removed an alias and one JSX attribute.Every new assertion was watched failing against the defect it covers: the scheme swap and each of its refusals, the id-composition refusal,
cidcarrying the webcal form with no template parameters left, the five-row order, the two rows that drop without an address against the three that do not,webcal:at both predicates in both casings, and the per-row new-tab list against an Apple row set back toopensPage: true.Manual verification
Everything below needs a deployed preview pointed at production SahajCloud, after sydevs/SahajCloud#1134 has merged and deployed. Google and Microsoft fetch the feed server-side, so
localhostcannot answer them, and the address does not exist until that deploy.webcalURL landing in the Calendar-Name field, so check which field it fills.outlook.live.comwith a personal account and onoutlook.office.comwith a work account, try…/calendar/0/addfromweb?url=…first, then…/calendar/0/deeplink/compose?path=/calendar/action/compose&rru=addsubscription&url=…, each with thewebcal://and thehttps://form ofurl=. A shape is settled only by a subscribe dialog listing more than one session. Record which combination worked on which host.pnpm build && pnpm review:embed, then open the sandboxed page. Every row opens something or says why, and the download row is the only one needingallow-downloads. Repeat withallow-popupsremoved: the four page rows must fail and the Apple row must behave as it did with the flag, which is what the troubleshooting table now claims.Notes for reviewer
Two things this branch could not finish, one the producer settled, and one judgement call.
rru=addeventlink and add the next session only, which is the treatment the goal's decisions already give a service with no subscribe route. ⚠ It costs the goal's Outlook success line until step 2 above is run. No candidate shape is shipped unexercised: a link that might open an add-event modal is worse than the one that demonstrably works.calendarLinkTargets' docblock said to add them once that PR deployed; it now records the decision and says new copy starts on SahajCloud. ⚠ The goal's Yahoo success line — "the menu says plainly that it adds only the next session" — stays outstanding, and so do the ticket's criteria D (the fourcalendar_keeps_updatedrows) and F (both keys in the snapshot). Neither is reachable from this repo.src/types/payload/is provisional — see Contract impact. That is this PR's half of the set's merge order, not an oversight.Detail
Why
buildGoogleCalendarUrlwas replaced rather than extended. Itsaction=TEMPLATE+recur=RRULE:+ctz=link added one event the viewer then owned a copy of, so a session the host cancelled stayed in their calendar for good — the complaint the goal is about.cid=subscribes instead. Nothing in the repo still emits the template shape, which is whyhref.test.ts's "real production href" row for it was replaced rather than kept.Why the Apple row is an anchor now, and not a button or a new tab. It no longer synthesises anything: it opens the
webcal://address in place and macOS or iOS hands it to Calendar.app.target="_blank"would open a tab with nothing to show, and in a sandboxed host page it would makeallow-popupsa condition of reaching the handler at all — which is whyopensPageexists rather than one blanket target. The download row keeps the<button>precisely because it does synthesise a file.Why the scheme swap refuses a non-
http(s)address instead of rewriting it. The swap is a rewrite, so anything else would be guesswork about a string somebody else minted.EventDocSchemaalready refuses a non-http value, which makes this the second of two checks, deliberately.Why the sub-label note is prose rather than a
shortcut:. Ashortcut:records a limit somebody can later lift, and names the trigger that lifts it. This one's trigger — SahajCloud deploying two keys — can never fire now that the producer dropped them, so keeping the marker would send a future reader after strings nobody will mint. The cross-repo pointer stays in the replacement sentence, which is the part that was load-bearing.The docblock claim the goal asked to settle.
src/lib/ics.tssaid Apple resolves an IANA TZID without aVTIMEZONE, which SahajCloud's own builder docblock contradicts. Apple no longer reads anything this file emits — it subscribes to the feed, which shipsVTIMEZONE— so the claim is gone and the docblock says which rows each builder serves instead. Both hand-rolled arguments (#105, #52) and theicalRuleargument are kept: the download row still needs them.Security review ran twice (
.claude/workflow.json'ssecurityReview.triggerPatterncoverssrc/lib/shape/hrefandsrc/config/api/) and found nothing above its bar either time. The first pass confirmed:ALLOWED_SCHEMEstill has one definition and two readers,hasAllowedScheme's only consumer is theLinkatom's plain-anchor-vs-router choice (where a protocol handler taking the plain branch is the correct outcome), no other predicate conflates "has a scheme" with "is http", every path that can reachbuildFeedSubscribeUrlis parsed bySafeUrlSchemafirst — including the live-preview postMessage arm, which also needs the SahajCloud origin and a verified token — ajavascript:ordata:payload cannot survive the swap, andgetEventDocstill does not select the privateonlineUrl. The second pass covered droppingrel="noopener noreferrer"with the target: there is no auxiliary context left forrelto constrain, so nowindow.openerand no reverse tabnabbing; the signed token sits in the href, not in a Referer, and awebcal:handoff issues no HTTP request from the browser at all; andisSafeHrefstill runs before any flag is consulted (Link.tsx), so the historical "a flag short-circuits the guard" defect cannot reopen. ⚠ No third pass ran: the only change since is a code comment, and theorigin/mainmerge carriessrc/lib/report.ts(a trigger path) solely as already-merged #396 content.Closes #393
Generated by Claude Code