Skip to content

feat(office): wire interview scheduling to real data - #562

Merged
thinkclay merged 1 commit into
mainfrom
claude/scheduling-client
Aug 11, 2026
Merged

thinkclay merged 1 commit into
mainfrom
claude/scheduling-client

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Completes the client half of #540. The API landed in #561; this is the SDK (Scaffald/sdk#17, merged) and the screen.

One backend change first

The two list routes now take application_id as optional. #561 required it, which was the wrong shape: the office scheduling screen is organisation-wide — "Upcoming Interviews" spans every open application, exactly as the mock it replaces did — so there was nothing useful for the screen to call. With no application_id, the routes list across every organisation the caller can act for. A caller with no organisations gets an empty list rather than a 403; a personal account should see an empty schedule, not an error.

Verified against a live local database with two organisations: each admin's org-wide read returns only their own rows, and a cross-org probe by application id 404s.

The screen

  • Slots and links come from /v1/employer/scheduling, with loading, error and empty states — none of which existed.
  • Candidate names are resolved by joining the org's applications. The scheduling tables carry application_id and nothing about the person, so the name is looked up rather than denormalised into the scheduling rows.
  • Both modals write. "Propose Time" and "Create Link" previously opened forms whose submit button only closed the modal — a user could believe they had scheduled an interview with a candidate who would never hear about it. They now validate and POST, with errors surfaced inline.
  • Stat tiles derive from real slots. no_show folds into completed: it exists in the database but not in this screen's status union, and it is a finished interview, not an upcoming one.

Two bugs found while wiring

The copied link was dead. The row rendered schedule.scaffald.com/<token>. That host does not exist — the real route is /schedule/[token]. Any recruiter who used the Copy button sent a URL that resolves to nothing.

Expired links showed as Active. Status read is_active alone. That flag is the employer's kill switch, not the clock, so a link past expires_at still read "Active" while the candidate could no longer redeem it. Expiry is now checked too.

What is still sample data, and why

USES_SAMPLE_DATA narrowed to CALENDAR_USES_SAMPLE_DATA rather than disappearing, and the notice moved from the whole screen onto the Calendar Connections tab.

Connections and availability are not blocked on a missing CRUD endpoint. core.calendar_connections stores access_token_encrypted / refresh_token_encrypted / provider_account_id for Google and Outlook — that is an OAuth integration. Availability windows feed slot generation, which does not exist either. Those two write paths stay disabled rather than silently discarding input.

So #540 is done and this closes it. The calendar integration is not, and the label stays until it is.

Verification

  • The existing test file said to replace its sample-data assertions with real ones rather than delete them quietly. It now holds 12 tests covering the transform, both write paths, the URL and the expiry logic.
  • Mutation-checked: dropping the no_show remap, judging links by is_active alone, or restoring the fabricated host each turns a test red.
  • 248 office + utils tests pass (6 pre-existing skips, 0 failures). Note the full scf-core suite OOMs on this machine — that is the pre-existing vitest memory limit, not this change.
  • Driven from a real browser session against a live API: cross-origin preflight, bearer auth, and both list endpoints, returning only the caller's organisation.
  • All test fixtures removed; interview_slots, scheduling_links and interview_bookings are back to zero rows.

Closes #540.

Completes the client half of #540. The scheduling API landed in #561; this
is the SDK and the screen.

Backend change first: the two list routes now take `application_id` as
*optional*. #561 required it, which turned out to be the wrong shape — the
office scheduling screen is organisation-wide ("Upcoming Interviews" spans
every open application, as the mock it replaces did), so with no
application_id the routes list across every organisation the caller can
act for. A caller with no organisations gets an empty list rather than a
403; a personal account should see an empty schedule, not an error.

Screen:

- Slots and links come from `/v1/employer/scheduling`. Loading, error and
  empty states, none of which existed.
- Candidate names are resolved by joining the org's applications. The
  scheduling tables carry `application_id` and nothing about the person, so
  the name is looked up rather than denormalised.
- Both modals write. "Propose Time" and "Create Link" previously opened
  forms whose submit button only closed the modal, so a user could believe
  they had scheduled an interview with a candidate who would never hear
  about it. They now validate and POST, with the errors surfaced.
- Stat tiles derive from real slots. `no_show` is folded into completed —
  it exists in the database but not in this screen's union, and it is a
  finished interview, not an upcoming one.

Two bugs found while wiring:

- The link row rendered `schedule.scaffald.com/<token>`. That host does not
  exist; the real route is `/schedule/[token]`. A recruiter who copied that
  link sent a dead URL. Copy now yields a URL that resolves.
- Link status read `is_active` alone. That flag is the employer's kill
  switch, not the clock, so an expired link showed as "Active". Expiry is
  now checked too.

`USES_SAMPLE_DATA` narrowed to `CALENDAR_USES_SAMPLE_DATA` rather than
disappearing, and the notice moved from the whole screen onto the Calendar
Connections tab. Connections and availability are still placeholders, and
not because a CRUD endpoint is missing: `core.calendar_connections` stores
`access_token_encrypted` / `refresh_token_encrypted` /
`provider_account_id` for Google and Outlook, which is an OAuth
integration. Availability feeds slot generation, which does not exist
either. Those two write paths stay disabled. So #540 is done; the calendar
integration is not, and the label stays until it is.

Verification: the existing test file said to replace its sample-data
assertions with real ones rather than delete them, so it now has 12 tests
covering the transform, both write paths, the URL and the expiry logic.
Mutation-checked — dropping the no_show remap, judging links by is_active
alone, or restoring the fabricated host each turns a test red. 248 office
+ utils tests pass. The routes were also driven from a real browser
session: cross-origin preflight, auth and both list endpoints, returning
only the caller's organisation.
@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results


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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ats): wire interview scheduling to real slots, availability and bookings

1 participant