Skip to content

Authenticated override for availability / min-notice on create and reschedule #270

Open

Description

@portfoliomanufaktur

validateBookingTime and validateRescheduleTime enforce min notice, max future days and the host's availability windows for every caller. For anonymous bookers that is right.

Request: an opt-in flag for authenticated host/admin requests (e.g. "skip_availability": true on POST /v1/bookings and PATCH /v1/bookings/{id}/reschedule) that skips those three checks. The atomic double-booking check stays in place.

Use case: one-off appointments agreed by phone outside regular hours, which still need the calendar event, video link and confirmation mail.

Happy to send a PR if the direction is fine.

Activity

  1. pullfrog commented on Nov 23, 2026

    @pullfrog
    Contributor
  2. shockalotti commented on Nov 23, 2026

    @shockalotti
    Contributor

    Thanks — the capability is right, the shape isn't yet. I'd take this, but not as a caller-controlled boolean on a public endpoint.

    The problem with skip_availability: true as proposed

    POST /v1/bookings accepts an API key or an OAuth token, and both authenticate as a workspace user — including ordinary members. So the flag would let any member book outside every host's hours, with nothing recorded about who did it. On a single-operator instance that costs nothing; on a team it's a silent way around the availability rules the team agreed on, and it's very hard to walk back once people rely on it.

    What I'd accept as a first slice

    1. Owner/admin only. A member sending the flag gets a 403, even though they're authenticated. If you're the only user, you'll never notice the restriction.
    2. Log it. The booking records that availability was bypassed and by whom. Otherwise "why does this meeting exist at 22:00?" has no answer six months later.
    3. Keep the double-booking check, exactly as you said — this skips min-notice, max-future and availability windows, never the conflict check.
    4. Decide reschedule explicitly, which is the part most likely to get missed. A booking created outside hours has to either accept the same flag when it's moved, or be refused with a clear message. Silently failing to reschedule it would be confusing, and silently allowing it would leak the bypass into a second endpoint.

    The framing I'd use

    This isn't "skip validation" — it's "create a booking the public calendar would never have offered". That's an admin action with an audit trail, not a request parameter anyone can set. Same flag, different contract, and it's the contract that makes it safe.

    One question before you start

    How do you call the API today — an owner API key, or a member account? That determines whether the admin-only gate needs a separate admin endpoint or can stay a field on POST /v1/bookings.

    Worth noting: availability overrides already exist and can open a specific date, but they mutate the public availability, so they don't substitute for this — they'd expose the widened hours to everyone. Your use case is genuinely different.

    If that shape works for you, say so and I'll write it up as the spec in this issue so the PR is measured against it rather than against the original wording.

  3. portfoliomanufaktur commented on Nov 24, 2026

    @portfoliomanufaktur
    ContributorAuthor
  4. portfoliomanufaktur commented on Nov 24, 2026

    @portfoliomanufaktur
    ContributorAuthor

    That shape works for me: owner/admin only, logged, and the conflict check stays. For reschedule I'd prefer the same flag under the same gate, since moving such a booking from the CRM is part of the use case; a clear refusal without the flag is fine.

    To your question: I call the API with an owner API key. I'm the only user on this instance, so there is no member account involved, and a field on POST /v1/bookings would be enough for me.

    Please go ahead and write it up as the spec.

  5. shockalotti commented on Nov 27, 2026

    @shockalotti
    Contributor

    Spec: skip_availability for owner/admin bookings

    Agreed shape, written down so a PR can be measured against it. This is the first slice only.

    Request surface

    • POST /v1/bookings — new optional boolean skip_availability, default false.
    • The reschedule endpoint — the same field, same gate, same meaning.
    • MCP create_booking — same field, so the two paths do not diverge (they already share createBookingForSlug).

    Who may use it

    Owner or admin only. A member sending it gets 403, not 400: they are authenticated and allowed to call the endpoint, just not to skip availability. Silent ignore is not acceptable — it would create the booking and look like it worked.

    What it skips, and what it does not

    Skips, for this request only:

    • minimum notice
    • maximum future days
    • the host's availability windows (weekly rules and date overrides)

    Does not skip:

    • the atomic double-booking / overlap check in booking.Service.Create — unchanged, still the last word
    • host resolution, required/optional host rules, calendar busy checks, questions, payment

    Implementation constraint

    The bypass is a parameter threaded through validateBookingTime / validateRescheduleTime, not a second code path. Those functions already take the routing mode and pools; adding one argument keeps every caller honest and stops a future entry point from forgetting the flag. A parallel "skip" function would drift within a release.

    Audit

    The booking must record that availability was bypassed and by whom. One column is enough:

    bookings.availability_override_by TEXT NOT NULL DEFAULT ''   -- user id; '' = no bypass
    

    Presence implies the bypass; the value names the actor; created_at already dates it. Written in the same insert as the booking, so it cannot drift from the fact it describes.

    Without this, "why does this meeting exist at 22:00?" has no answer six months later.

    Reschedule

    • Rescheduling a booking created with the override, without the flag → refuse with a clear, specific message ("this booking was created outside availability; resend with skip_availability"). Not a generic slot error, and not a silent success.
    • With the flag and the right role → allowed, and it rewrites availability_override_by to the actor doing the move.

    Not in this slice

    • Any UI control. The public booking page never sends it; an admin control can come later.
    • Bypassing the conflict check, ever.
    • Retroactive editing of ordinary bookings.

    Tests that matter

    1. Member + flag → 403, no booking created.
    2. Owner + flag, outside hours → 201, booking exists, availability_override_by set.
    3. Owner + flag, overlapping an existing booking → still rejected (conflict check intact).
    4. Owner without the flag, outside hours → existing refusal, unchanged.
    5. Reschedule of an override booking without the flag → specific refusal; with the flag → succeeds.

    Two notes from the report that shaped this

    • The reporter calls the API with an owner API key and is the only user, so the role gate costs him nothing.
    • Availability overrides already exist but mutate public availability, so they would expose the widened hours to everyone. They are not a substitute, which is why this is a separate mechanism.
  6. portfoliomanufaktur commented on Nov 28, 2026

    @portfoliomanufaktur
    ContributorAuthor

    Thanks, this matches our use case (owner API key, single user), and keeping the overlap check as the last word is exactly right.

    One question on reschedule: our bookings go out with the normal reschedule link. If a booking was created with skip_availability and the guest later uses the public reschedule page to move it into a regular, available slot, would that be refused as well? For us the ideal behaviour would be: moving into a slot that passes normal validation works without the flag and clears availability_override_by; only moving to a time outside availability needs the flag and the role.

    Calendar busy checks staying in place is fine for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions