T10: Sirius provider (events, iCal URL) #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "t10-sirius"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
T10: Sirius provider (
fit.sirius.events,fit.sirius.icalUrl)Stacked on #8 (
t9-usermap) → … → #1. Merge those first.What
src/providers/sirius.ts, built against the Sirius API v1 docs:fit.sirius.events: the personal timetable viaGET /people/{username}/events.from/to(default today + 7 days, Europe/Prague), an optionaltype(lecture, tutorial, laboratory, exam, assessment, course_event) andincludeCancelled.include=courses,teachers), parallel, sequence number,originalwhen a schedule exception moved it, and capacity/occupied.truncatedis accurate.tosemantics aren't documented, so it requests one extra day and filters by Prague-local start date. That's correct either way.fit.sirius.icalUrl: the ICS subscription URL…/people/{username}/events.ical?access_token=<Sirius calendar token>. The token comes fromGET /people/{username}.links.students(other students' usernames) is never parsed or returned.fit.sirius.icalUrl. The function docs and the outputnotetell the assistant to treat it as a private link. Astra agrees this is intentional and acceptable.src/lib/dates.ts:pragueDate,addDays,daysBetween, with DST and midnight tests.linkedsection isn't documented, so it's parsed defensively: arrays or id-keyed maps are accepted, anything else is ignored.invalid_argumentsbefore any upstream call. 404 ("no events in scope") returns an empty list.Verified
bun run lint && bun run typecheck && bun run test: 143 tests, 18 of them for Sirius and dates. They cover the default range and query params, mapping, sorting, hiding cancelled events, no student data, filters, filtering out the extra day, pagination and truncation (including exactly 500, and extra-day records), 404, oddlinked, range validation, username validation, the iCal URL, unexpected shapes, and Czech and English search.bun run dev+curl /api/functionslists both functions.linkedshape,tosemantics and the.icalURL format.Astra review (gpt-6-astra)
Fixed: (P2)
truncatedwas true for exactly 500 events, and the extra-day records could inflate it. Now it fetches up to 6 pages and setstruncatedonly when more than 500 events matched or pages are left unfetched. Tests added for exactly 500 (with and withoutmeta.count) and for extra-day overflow.Confirmed: returning the Sirius calendar token in the private iCal URL is intentional and doesn't expose FIT OAuth credentials.
🤖 Generated with Claude Code