Repository navigation
feat(invites): invite_delivery 'none' for integrations that send their own invite - #158
Conversation
|
OpenCode's response
|
|
All contributors have signed the CLA. ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Warning Your OpenCode API key has expired and the model you're configured to use is no longer available. The last 5 Pullfrog runs on Calnode have all failed, so this review did not happen. OpenCode returns "This API key has expired" for the key stored on your account, and the model "space-bunny-free" is not in their current catalog. No other provider key matches this model and the Router balance is empty, so there is nothing to fall back on. To fix it:
|
|
@pullfrog review this PR |
There was a problem hiding this comment.
ℹ️ No critical issues — one stale comment noted below.
Reviewed changes
- Third invite mode
none—booking.InviteByNoneis added to the domain constants and normalization, and the create/PATCH validation keeps the sender requirement oncalnodealone. - Guestless host events —
hostEventsGuestlesscentralizes thecalnode/nonecase forcalendarInviteeandapplyHostInvite;applyInviteDeliverysuppresses the booker's.icsentirely fornone. - Lifecycle paths — reschedule, cancel, reassign and the reconciler all read the booking's stored mode; reassign's
switchhandlesnoneexplicitly and the new host's event is created guestless. - Booking JSON + webhooks —
toBookingJSONalways emitsinvite_delivery, and the webhook field is opt-in (not indefaultFields), filled from the booking row inenrich. - Migration 00071 — widens the
event_types/bookingsCHECKvia a column swap rather than a table rebuild; the Down mapsnoneback tocalnode. I rango test ./internal/db/,./internal/handler/and./internal/webhook/, plus a standalone SQLite check of the swap with foreign keys on and a child row — values, child rows, theCHECK, andidx_bookings_no_doubleall survive. - Admin UI + docs — the new select option/explanation, webhook field catalog entry, README/CHANGELOG/ARCHITECTURE updates.
ℹ️ One mode-list comment was left on two values
bookableEventType.InviteDelivery's comment still documents only InviteByCalendar/InviteByCalnode, so it now contradicts the widened enum (and the equivalent comments in booking.go, event_type.go and the API error messages, which this PR did update).
Technical details
# Stale invite-delivery comment
## Affected sites
- `internal/handler/booking_handler.go:511` — `bookableEventType.InviteDelivery`'s doc comment still reads `(booking.InviteByCalendar/ByCalnode)`.
## Required outcome
- The comment names all three stored modes, matching `booking.CreateParams.InviteDelivery` and `eventTypeJSON.InviteDelivery`.deepseek-v4.1-flash | 𝕏
|
Fixed the stale comment on |
|
Two things happened here, and only one is a problem. Your code is green. On the new head CLA is blocking, and it is about commit authorship rather than the code. Your two earlier commits are authored as Either of these fixes it:
I cannot merge past the CLA and would not want to, since the signature is what lets us distribute your work. Nothing else is outstanding. |
1801ae2 to
b4e72f1
Compare
The append-only guard added in Calnode#161 compares the pull request's ledger with the tip of the base branch. Signatures are committed to main by the CLA bot, so any signature added after a PR was opened is absent from its head by construction. Comparing with today's main calls that "removed" and fails the PR. That is what happened to Calnode#176, Calnode#179, Calnode#158 and Calnode#159 at once: MohammadHadi2031 signed, the ledger on main grew from 11 to 12 entries, and every PR forked before that point was reported as revoking his signature. Nothing was removed. Compare against git merge-base HEAD origin/<base> instead, which only sees entries the PR's own branch actually had. A shallow clone cannot compute a merge base, so warn and skip rather than fail closed on an infrastructure limitation. Checkout now fetches full history for this job; the repository is 8MB. Verified against the real Calnode#176: base=main tip reports "MohammadHadi2031 (id 17288524)" as removed and exits 1; base=merge-base reports nothing and exits 0. A ledger with one signature genuinely deleted still fails, naming tgrahammer (id 3223680).
|
Could you rebase this onto current Two things worth knowing while you do it: The Migration numbering. This PR adds To be explicit about the review status: the code passed everything else and I've verified the migration behaviour against a copy (row counts, the double-booking index, cascades, FK enforcement, and the down migration mapping |
…r own invite Some setups send the booker's confirmation and calendar invite from their own system and read bookings over the API. Today they have two choices, and both put a second invite in the booker's inbox: 'calendar' makes the host's Google/Microsoft calendar invite the booker (from the host's mailbox, with a body of just "Booking ID: ..."), and 'calnode' requires Calnode's own email. The only way to get guestless host events and no invite was 'calnode' with no mailer, which the API refuses to set because the sender check fails. 'none' is that state, supported: - Host events are written without guests exactly as for 'calnode' (hostEventsGuestless), so no provider emails the booker. The reconciler and reassign follow it through calendarInvitee. - No Calnode email to the booker carries an .ics, whatever the host's calendar. The booker's emails themselves still go out if email is set up: the setting decides who sends the invite, not whether Calnode emails, and the mailer and notification settings already own that. - Host copies behave as for 'calnode' (booker left out, PUBLISH). - No sender or mailer is required to select it. - Like the other two modes it is copied onto the booking, and reschedule, cancel, reassign and the reconciler read it from there. Bookings now carry invite_delivery in their JSON (single, list, MCP), always present, so an integration can tell per booking whether the booker already holds an invite. Webhooks can select it as a payload field; it stays out of the default set, which reproduces the original payload. Migration 00071 widens the 00068 CHECK without a table rebuild. bookings has never been rebuilt (00037 avoided it for the same reason) and carries five child tables' foreign keys and the double-booking index; a 00042-style rebuild would need NO TRANSACTION and foreign_keys=OFF. The CHECK belongs to the column alone, so the migration adds a widened copy, fills it, drops the old column and renames the copy, inside goose's normal transaction. Down maps 'none' to 'calnode', which an older binary also treats as guestless.
ARCHITECTURE (who sends the invite, the 00071 column swap, webhook default set), README features, CHANGELOG Unreleased.
b4e72f1 to
d315b63
Compare
|
Merging this. The backend, migration and webhook field are all verified, and I rehearsed the migration against a copy of production data before agreeing to it: row counts unchanged across all nine tables, every stored Two follow-ups we owe you, so it is clear they are ours and not a gap in your work:
Thanks for the careful work on the migration especially, the column swap with the |
Follow-up to Calnode#158, which added invite_delivery 'none' without the wording and `guards agreed when it was designed. Four gaps, all in the event type editor: - The mode read "No one (you send your own)", a negation that looks like a mistake. It is now "Your own system", which reads as a deliberate choice. - Choosing it while email is not configured emails the booker nothing at all, and that is easy to do by accident and impossible to notice later, so it is confirmed once. The selection is held back until confirmed, and cancelling leaves the previous mode in place. - A permanent line says the setting applies to new bookings only, because the mode is copied onto a booking when it is created and later changes do not reach existing ones. - With an online location the booking still has a join link, and Calnode will not send it. The editor now says so and names location_value in the booking.created webhook, which is where an integration finds it. One implementation note: bits-ui keeps the clicked option as its internal selection even when the bound value is not changed, so after a cancel, re-picking the same option fired no change event and the dialog never reappeared. The Select is keyed on a counter that increments when a choice is declined, which remounts it against the current value. Verified in a browser: select, cancel, reselect, dialog reopens; confirm, the value applies; an online location shows the join-link warning.

Problem
We run Calnode with Microsoft 365 calendars and deliberately without Calnode email (no SMTP, no Resend). Our own system polls
GET /v1/bookings?scope=alland sends the booker its own confirmation with its own.ics. That is a common shape for anyone embedding Calnode as the scheduling engine behind an existing CRM or mail pipeline.With the default
invite_delivery = 'calendar', the host's Outlook calendar invites the booker, so the booker gets a second message from the host's mailbox whose body is only "Booking ID: " (calendar_event_booking_id). That is the invite the integration wanted to replace.What we actually want already exists internally:
invite_delivery = 'calnode'writes the host events without guests (calendarInviteereturns ""), and with a Noop mailer nothing reaches the booker. But that state is only reachable by editing the database, because switching an event type tocalnodeis refused unless a sender and a working mailer exist (inviteSenderReady). And an integrator has no way to tell from the booking JSON which channel a booking's invite went out on.What this changes
A third
invite_deliveryvalue,none, shown in the admin UI as Calendar invite → Sent by → No one (you send your own).calnode(new helperhostEventsGuestless, used bycalendarInviteeandapplyHostInvite). Google and Microsoft get no attendee, so they email nobody. The reconciler and reassign go throughcalendarInviteeand follow it without changes..icson any Calnode email to the booker, regardless of the host's calendar (applyInviteDelivery). Note this is stricter thancalendar, which attaches Calnode's.icswhen the host has no destination calendar.invite_deliveryanswers "who sends the calendar invite", not "does Calnode email at all". Whether Calnode emails is already decided by the mailer (configured or Noop) and the per-host notification settings. Folding "no email" into this setting would silently switch off reminders and reschedule notices for anyone who has email configured and only wants to own the invite. Operators who want silence keep the no-mailer setup.calnode: the booker is left out of the host's.icsand it goes out asPUBLISH, so the host's calendar client never holds the booker as a guest it could re-invite.none. TheinviteSenderReadycheck stays oncalnodeonly.invite_deliveryon bookings and webhooksinvite_delivery(calendar,calnodeornone):GET /v1/bookings,GET /v1/bookings/{id}, the create/reschedule/reassign responses and the MCP tools, which all go throughtoBookingJSON. It is always present (the column isNOT NULL), with ajsonschemadescription for MCP.invite_deliveryas a payload field (filled inenrichfrom the booking row, so every event type carries it without touching eachEnqueuecall). It is not indefaultFields, because that set is documented as reproducing the original payload and every booking has a value, so adding it there would change every unconfigured webhook. The field is listed in the admin webhooks page.Naming
nonebecause the column answers "who sends the invite", and the existing values name the sender (calendar,calnode). The answer here is nobody, from Calnode's side.noneis also the schema's existing "nothing happened" sentinel (payment_status = 'none', 00037). I consideredexternal, but it implies Calnode knows about or coordinates another sender, which it does not.Migration notes (00071)
00068 declared the allowed values as a column
CHECK, on bothevent_typesandbookings, and SQLite cannot alter aCHECK.I looked at the precedents before choosing:
event_typesto widenlocation_type, with-- +goose NO TRANSACTIONandPRAGMA foreign_keys=OFF, because aDROP TABLEwith foreign keys on cascades into the children.bookingsfor a new status value and added a separate column instead.A rebuild of
bookingswould have to carry its 23 columns verbatim, recreate five indexes including the double-booking guardidx_bookings_no_double, keep five child tables' foreign keys intact, and run outside a transaction with foreign keys off. There is no precedent for that, and a slip there fails silently. A separate flag column (00037 style) would work but splits one mode across two columns and needs a mapping layer in every query that reads the mode.The migration instead swaps the column, per table:
DROP COLUMNis allowed because nothing else in the schema referencesinvite_delivery: its onlyCHECKis its own, and no index, trigger, view or foreign key names it. The repo already relies onDROP COLUMNin the Down steps of 00057, 00064, 00065 and 00069.RENAME COLUMNrewrites theCHECKexpression along with the name (checked insqlite_masterafter migrating:CHECK (invite_delivery IN ('calendar', 'calnode', 'none'))). All of this runs inside goose's normal per-file transaction with foreign keys on; noPRAGMAtoggling, and neither table's indexes or child rows are touched.Trade-offs to be aware of:
DROP COLUMNrewrites the table, so it is O(rows), same order as a rebuild, once at startup.invite_deliverymoves to the last column position in both tables. No code usesSELECT *or positional inserts on these tables (sqlc is configured but has no generated package in the tree).CHECK(as 00042 does) and mapsnoneback tocalnode. An older binary treats anything other thancalnodeas calendar-sent, so leavingnonewould make the next reschedule or reconcile invite the booker from the host's calendar.calnodekeeps the host events guestless; with email configured, the old binary would then attach Calnode's.icson later updates.If you would rather have a 00042-style rebuild, or the 00037-style separate column, I'm happy to switch. The column swap seemed the smallest change that keeps a single, honest stored value.
Tests
New tests follow the existing
invite_delivery_internal_test.gofixture:TestInviteDelivery_noneNeedsNoEmail: create withnoneand PATCHcalendar→noneboth succeed with no sender and a Noop mailer;calnodeis still refused there.TestInviteDelivery_noneSendsNoInvite: the Graph/Google-like provider gets the event with no attendee; the booker's confirmation is sent and carries no.ics; the host copy does not name the booker.TestInviteDelivery_noneRescheduleAndCancelSendNoInvite: after switching the event type back tocalendarand disconnecting the host's calendar (the case where a calendar-sent booking would get Calnode's.ics), reschedule and cancel emails still carry none.TestInviteDelivery_noneReassignInvitesNobody: the moved event is guestless on the new host's calendar, and the booker's notice has no.ics.TestInviteDelivery_reconcilerHealsWithoutInvitingBooker: now runs forcalnodeandnone.TestInviteDelivery_bookingJSONReportsMode:"invite_delivery":"none"onGET /v1/bookings/{id}andGET /v1/bookings?scope=all.TestMigrate_inviteDeliveryNoneKeepsExistingModes(internal/db): from version 70 with seededcalendar/calnoderows, the migration keeps values, child rows and the double-booking index, acceptsnone, rejects unknown values, and defaults tocalendar.TestMigrate_inviteDeliveryNoneDownKeepsEventsGuestless: Down mapsnonetocalnode.TestBuildData_inviteDeliveryIsOptIn(internal/webhook): selectable, carried when selected, not in the default set.I checked the new handler tests fail when the
nonebranches inapplyInviteDeliveryandhostEventsGuestlessare removed (4 tests and the reconciler subtest go red).Results on this branch:
pnpm test:visualwas not run: nothing underfrontend/src/lib/components/ui/**,app.cssor the theme changed. I also ran the built binary against a fresh database without email configured: creating anoneevent type returns 201 (calnodereturns 400 as before), a public booking returns and lists"invite_delivery":"none", and in the admin editor the new option renders with its explanation and saves (PATCH 200, storednone).Docs
docs/ARCHITECTURE.md: the "Who sends the invite" paragraph coversnone, the 00071 column swap and why it is not a rebuild, and the webhook default set note.README.md: one feature line for the invite sender setting.CHANGELOG.md: two entries under Unreleased / Added.