Welcome to the team responsible for the company calendar. Requests arrive from employees, are scored for relevance, and are scheduled in batches around protected commitments. Times are timezone-free integer minutes since…
Welcome to the team responsible for the company calendar. Requests arrive from employees, are scored for relevance, and are scheduled in batches around protected commitments. Times are timezone-free integer minutes since midnight.
This repository has four reported problems, listed below as tickets. Fix as many tickets as you can in 45 minutes. Each ticket is checked separately, and you are not expected to finish every one.
You may use the AI assistant and normal repository tools. Treat the assistant like a junior developer: establish a plan, inspect its work, run the tests, and retain ownership of the result.
blike_calendar/
database.py SQLite persistence (requests + events), find_by_idempotency_key
directory.py internal employee lookup
models.py domain types (BusinessTier, MeetingRequest, CalendarEvent, RequestStatus)
scheduler.py scheduling around protected events; conflict arbitration
scorer.py deterministic stand-in for an opaque relevance model
service.py request intake (SchedulingService: submit_request, accept, reject)
tests/visible/ shipped regression tests
conftest.py puts the repository root on the import path for pytest
submit_request is idempotent on (requester_key, idempotency_key).Occasionally the same meeting request appears twice. It is most common when the requester's connection is unstable and the client retries before receiving a response. Slow, sequential retries normally return the original request, so a naive sequential test can pass while the real problem remains.
Do not redesign scheduling or relevance scoring as part of this ticket.
Employees are being double-booked: a scheduled meeting lands in a slot already held by a protected calendar event. Requests are supposed to be scheduled in batches around protected commitments, never on top of them.
schedule_batch never accepts a request that overlaps a protected event.State the overlap invariant in your own words before changing code. Do not change the scoring model as part of this ticket.
Executive assistants report that a STANDARD request sometimes wins a slot over an EXECUTIVE one. Scheduling is meant to prefer the higher business tier, breaking ties in favour of the earlier submission. The relevance scorer is a deterministic stand-in; the ranking it produces is what the scheduler consumes.
business_tier is scheduled first.submitted_at.Do not change persistence or the request intake path as part of this ticket.
Audit found requests that moved from REJECTED back to ACCEPTED with no error. A rejection is final; once a request is rejected it must stay rejected.
Do not change the scheduler or scorer as part of this ticket.
pytest tests/visible. Every shipped test fails on the starter code and passes once the bug it covers is fixed.blike_calendar/ are submitted; the shipped tests in tests/visible run as they are.Adapted from treasure567/bloomberg-practice (round-2/meridian @ 8de07d5), used with the author's permission.
Visible test command
pytest tests/visibleThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
calendar-duplicate-requests-and-protected-slots
Changes under src/ are evaluated.