Two Copies Of The Cancellation Window

Decide what you would do from the brief alone, including whether you would change anything at all. Everything below it is available, but the exercise stops working if you open it first.

The brief you were given

The scheduling service and the claims service each contain their own thirty-line implementation of "is this cancellation inside the fee window". The implementations agree. A proposal to extract a shared library is on the table. Decide.

The trap — the fix that looks like good design and is not

Extracting @clinic/scheduling-rules and having both services depend on it. The duplication is visible, the extraction is an afternoon, and "single source of truth" ends the discussion before it starts — this is the trap that has the most institutional support behind it. What arrives six months later is a change that is correct for claims and wrong for scheduling, so the library grows a parameter to serve both, and from then on every release of it must be coordinated across two teams and two deploys. The failure is quiet and slow: nobody ever attributes next year's release friction to a thirty-line function extracted for good reasons.

Read this even if you are confident. It is here rather than behind a button because it is the answer most teams actually ship, it passes review, and the cost of it does not arrive until the change after this one.