L40 EXAMPLE WRITE-UP 2 OF 2 - BRIEF D (reminder times)
This example was written for the course. It meets the standard. The test
counts in it are real: they come from running the course's reference
evaluation set against a typical first attempt and the final version.

----------------------------------------------------------------------
1. RESULT
reminder_time(appointment, booked_at) returns the latest moment, Monday
to Saturday 09:00-18:00, that is at or before 48 hours ahead of the
appointment, or None when no such moment falls at or after the booking
(the front desk phones instead). It passes all 11 cases in my evaluation
set and matches my hand calculation for all 10 sample bookings. The one
thing to know before using it: it works in clock time only and has not
been checked across a daylight-saving change.

2. EVIDENCE
2a. 11 test cases, written from my acceptance criteria before I read any
    generated code. Expected times worked out by hand with a November
    2026 calendar open. Kinds: 1 normal; 2 at the exact 09:00 and 18:00
    edges; 4 where the 48-hour mark is outside sending hours (evening,
    early morning, Sunday, early Monday); 1 Saturday; 3 about the
    booking time (after the mark, exactly at the mark, the evening
    before an early mark). I expected the first version to fail at
    least the evening, Sunday and booking cases.
2b. First generated version: 4 of 11 passed. It moved any reminder
    outside sending hours to the NEXT allowed time, so a 19:00 mark
    became 09:00 the next day, after free cancellation had ended. It
    sent Sunday reminders on Monday morning for the same reason, never
    returned None, and treated 18:00 as outside hours. I categorised the
    first three as specification errors: my first request said "only
    send between 09:00 and 18:00" and did not say which direction to
    move. I added assumption A1 ("never after the mark") to the
    specification, regenerated, and corrected the 18:00 edge by hand
    (# CHANGED in the code). Final version: 11 of 11.
2c. I worked out all 10 rows of L39_D_appointments.csv by hand before
    running the program on them. All 10 agree. C-107 (booked 30 minutes
    after its mark) correctly comes back as "phone the client".
2d. The criterion Dee cares about most is AC2: a reminder is never
    later than the 48-hour mark. Test "mark 19:00": appointment
    Thu 12 Nov 19:00, booked 3 Nov; expected Tue 10 Nov 18:00; got
    Tue 10 Nov 18:00.

3. LIMITATIONS
3a. All 11 cases and all 10 sample rows are in November 2026, with no
    clock change and no public holiday in range. The set says nothing
    about those.
3b. Assumptions nobody confirmed: that "between 09:00 and 18:00"
    includes both ends; that a later reminder is better than an earlier
    one when both are allowed; that a reminder sent the minute a
    booking is made is acceptable. In real work I would ask Dee all
    three before the clinic used this.
3c. Known gap: if the clocks change in the 48 hours before an
    appointment, the real gap is 47 or 49 hours. Not handled.
3d. Not checked: what the texting service does with the time I give it
    (time zone, delays). I also did not test bad input such as
    "11/11/2026"; the function raises an error on it, which I have not
    turned into a clear message.

4. WHAT WOULD CHANGE YOUR MIND
If the clinic's real bookings include any client charged for a late
cancellation after a reminder from this function, the function or my
reading of the policy is wrong, and I would stop using it until I found
which. If Dee says "between 09:00 and 18:00" means until 17:59, every
result that lands on 18:00 changes: five of my tests and four sample
rows (C-102, C-103, C-105, C-108).

5. AI-USE RECORD
Label:            AI allowed — keep a record
Assistant:        a general chat assistant, free tier (exact name and
                  version copied into my project record)
Date(s):          10 and 11 November 2026
Prompts:          P1 my full specification with A2-A4, asking for the
                  function only; P2 the same with A1 added after the
                  first run; P3 "explain line 14 to me" (the while loop).
                  Full text pasted in my project record.
What I kept:      the structure of the function and the while loop.
What I changed:   the 18:00 comparison (> instead of >=), by hand,
                  because test "mark exactly 18:00" failed.
What I verified:  every evaluation result by running the tests; every
                  sample row by hand calculation; the weekday of every
                  date I used, against a calendar.
----------------------------------------------------------------------
