Skip to content

feat(availability): add leave (urlop) as a fourth kind of entry - #399

Merged
lowicz merged 12 commits into
mainfrom
fm/oncall-leave-u-scout
Dec 2, 2026
Merged

lowicz merged 12 commits into
mainfrom
fm/oncall-leave-u-scout

Conversation

@lowicz

@lowicz lowicz commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Intent

Design a new feature for the oncall project: an additional preference value "U" (urlop, leave / vacation) alongside the existing preference entries. Requirements as the captain stated them:

  • U is treated the same as unavailability (N) when the schedule is planned/generated.
  • N is entered not only for leave: sometimes people mark N because an afternoon does not suit them. So N and U must stay distinct concepts.
  • Sometimes no N is entered at all, and a leave day is taken only after the schedule has already been generated. The design must cover recording U on a day that already has an assignment.
  • The feature is mainly useful for managing the whole team, not only the on-call duty itself (so think of leave as team-management data, not just a scheduling input).
  • Every decision goes to the captain through Lavish.
  • Before any implementation starts, the U leave design must be assessed with the UX/CX design skills used in earlier oncall redesign work (/impeccable critique, and the other installed design review skills such as web-design-guidelines), and the design corrected from that assessment first.

The captain confirmed the corrected U (urlop / leave) design on the Lavish board (14 decisions, round 2 D10-D14 all A, review ended with ok) and asked for the work to start. Implement STEP 1 ONLY of the decided plan (U as the fourth kind end to end, with the corrections from the UX/CX assessment). Steps 2-5 are separate later work; do not start them. No approval workflow, balances, half-days or integrations.

The decided plan, in substance:

  • Step 1 (this work): U as the fourth kind end to end: migration; one "N and U block duty" rule for generator, corrections, swaps, publication and fairness; brush with hint, tile, legends, gold mark, band with strip; collision flow with per-day rows, count and "Następna"; the "na urlopie" tag on the "Teraz" strip and duty cards; the weekend hint with one click; phone day-list line; first-visit line; e-mails with the word "urlop"; audit; English letters; docs PL and EN; DESIGN.md.
  • Step 2 (later): panel "Urlopy" on "Teraz". Step 3 (later): U in the past by a coordinator or admin, also for themself, with the "dopisany po fakcie" tag. Step 4 (later): overlap warning, who can still take each role per day. Step 5 (later): morning e-mail lines about leave.
  • Not chosen at all: a batch dialog for replacements during a leave, leave in the monthly report and CSV, a year screen, team ICS, a reminder e-mail before the duty day.

The 14 decisions as answered on the board:

  • D1 Data model: a fourth kind "leave" in the same availability ledger, not a separate absence register.
  • D2 Look of U: gold letter U plus a tinted band in the schedule matrix.
  • D3: whole days only.
  • D4: the whole team sees U; the note stays private (its author, coordinators and admins); viewers and share links see no availability.
  • D5: like N: everyone enters U for themselves, a coordinator on behalf, no approval.
  • D6: U on a day that already has a duty: warn and fix by hand as N today, permanently. The entry is saved, the duty stays with the person until a coordinator changes it, one duty at a time. No batch dialog.
  • D7: coordinators and admins may add or correct U in the past (step 3, later).
  • D8: team management: the panel on "Teraz", the overlap warning and a line in the morning digest (steps 2, 4, 5, later); no leave column in the monthly report.
  • D9: step 1 first, then the follow-ups in the given order.
  • D10: a duty on a leave day that nobody took over is said on the "Teraz" strip and the duty cards (step 1) and in the morning e-mail (step 5); no reminder e-mail.
  • D11: the weekend next to a leave: a hint after saving, with one click "Dodaj weekend do urlopu".
  • D12: past leave for oneself is allowed, audited and visibly tagged (step 3, later).
  • D13: the rule of the overlap warning (step 4, later).
  • D14: "urlop" is any whole day away from work; the team sees only "urlop", never a reason, and the app does not ask for one.

The confirmed design of step 1, with the corrections from the assessment:

  • Rule: one predicate answers "does this kind block duty" (N and U) for the generator, corrections, swaps, publication and fairness. U keeps everything N has: range painting, undo, on-behalf entry, privacy of the note, audit, e-mails, stale-draft detection and the collision flow. Blocking messages may keep "niedostępna" as the umbrella word for N and U.
  • Entering U on "Moje dyżury" / "Moja dostępność": brush order nie mogę, urlop, wolę nie, chętnie, eraser; the default stays "nie mogę"; on a phone the four segments and the eraser stay in one row. One hint line under the brush for the selected position tells N from U (N: you will not take a duty that day, for example a busy afternoon; when away all day choose "urlop"; U: away from work all day, blocks duty like "nie mogę", and the team sees leave in the schedule). A first-visit line above the brush announces the new "urlop" position, with "Zamknij"; it goes away for good when closed or after the first U (one localStorage flag); no tour, no modal. For U the note field is labelled as a note to the leave and its hint asks not to enter health reasons; the field is cleared when the brush changes kind. The tile carries a gold day number and the letter U, closed by the leave strip; the collision ring is the same as for N; a day that is today and in collision keeps both rings.
  • After a save, below the calendar and only once the save is confirmed: the weekend hint when the saved leave touches a weekend ("Weekend ... nie jest objęty urlopem", the generator may still assign a duty there) with "Dodaj weekend do urlopu"; and the collision box, whose title names the days ("W czasie urlopu masz dyżury: 7, 10 i 11 gru"), whose body says the leave does not lift the duties and that coordinators get an e-mail, and which has one row per colliding day: date, role marks and the state of that day (the button "Poproś o zamianę…" or a tag that a swap request is already sent and waiting). A day that got a replacement leaves the list. On short notice (the colliding duty is today or tomorrow) the box uses the error tone and tells the member the duty is still theirs and to call the coordinator. Toasts: saving with Undo, naming an entry that was replaced, and saying that duties handed over stay with their replacements when a leave is removed.
  • Reading U: in the schedule matrix the leave days of a person are one band in their row, the leave wash plus a strip along the bottom of the run; inside the band the letter U has no box; the today wash wins over the leave wash (the strip alone crosses the today column); a role mark inside the band is a duty during leave. The calendar legend names the collision ring by its shape and both entries; the matrix legend gains the U mark and a row for the band. On a phone the schedule is a day list and each day gains one line naming who is on leave. The day panel lists "Marek Nowak: Urlop (7 – 11 gru)" with the whole range of the entry.
  • U on a day with a duty, for coordinators: the risk chip above the matrix and on "Teraz" counts duties, not people ("4 dyżury osób na urlopie"; with N only "… mimo „nie mogę”"; with both it names both) and opens the first colliding day. The day panel shows one frame per person and day, not one per duty: "Kolizja: Marek Nowak ma SECONDARY i 11–19 mimo urlopu (7 – 11 gru)", the position "Kolizja 2 z 3 w tym urlopie.", one primary button "Zmień osobę na SECONDARY i 11–19…" and the link "Następna: pt 11 gru"; while the frame shows, the panel footer has no second primary button; after the last one a message confirms that all duties from that leave are covered. Coordinators and admins get the existing e-mail after the Undo window, worded for the kind ("Urlop koliduje z dyżurem: …"); a leave filed on behalf is announced as "Wpisano urlop w Twoim imieniu: …". In a draft the collision blocks proposing and publishing, as N does.
  • On the day itself, if nobody changed the duty: beside the holder's name on the "Teraz" strip and on the duty cards, for signed-in team members only, the tag "na urlopie" and "bez zastępstwa" under it.
  • Accessibility: U goes through the same mark component as the other kinds, the letter comes from the catalog and follows the language (English letters differ from Polish); the calendar tile names "urlop" and the collision for U exactly as for N; a matrix cell with a role mark on a leave or "nie mogę" day says "kolizja" in its accessible name; leave is never colour alone (letter, strip, word in the legend); the collision boxes are status regions; no motion is added.
  • Styling: three colour tokens for leave in both themes and no colour outside the tokens; DESIGN.md documents the leave colour, wash and strip.

What Changed

  • Rule and data: "Leave" (leave, shown as "urlop") is a new kind of availability entry. It blocks duty just like "nie mogę" in the generator, corrections, swaps, publication and fairness; one blocks_duty rule covers both. Migration 0051 allows the new value; downgrading it turns leave into "nie mogę" and deletes the Undo snapshots. The API gains entry_starts_on/entry_ends_on on calendar entries and on_leave on current duties (always false for viewers and share links).
  • Entering and seeing leave:
    • On "Moje dyżury": a gold "urlop" brush with a hint and a first-visit line, a one-click offer to add the weekend next to a leave, and a collision box with one row per day that shows swap requests already sent.
    • In the schedule: a gold band in the matrix, an "on leave" line in the phone day list, and the "na urlopie" / "bez zastępstwa" tags on the "Teraz" strip and duty cards.
    • For coordinators: the conflict chip now counts duties instead of people, and the day panel shows one conflict frame per person with a link to the next conflicting day.
  • E-mails, docs and fixes along the way: Leave e-mails say "urlop", and a later conflict that starts on the same day but involves different duties now gets its own e-mail (before, it was dropped as a duplicate). The note field now clears when the brush changes. English calendar letters now come from one shared list: N, L, W, C (before, the availability calendar used U, P, W). The Polish and English docs and DESIGN.md are updated.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: One shared rule makes leave block duty everywhere, viewers and share links still see no availability data, the migration keeps existing rows as they are, and the earlier review fixes hold in the current code.

Testing

I ran the real product locally (throwaway PostgreSQL, API, worker, mail server and production frontend build) and drove 18 leave scenarios in Chromium and through the API; no baseline commands had been run beforehand. All 18 pass. One flaw was found and fixed: the today ring hid the gold leave strip on today's tile. I rebuilt, re-checked the tile in both themes and added a regression test that fails without the fix. At 1440 px in Polish, the tag in the SECONDARY slot of the Teraz strip wraps under the name line instead of beside it, but it stays readable. Screenshots, e-mails and logs are saved; everything started for the test was stopped and removed.

  • Live validation: ✅ go - 18 of 18 scenarios driven live against the product
Scenario Result Live Evidence
An operator upgrades a PostgreSQL 18 database: old entries keep their kind, leave becomes allowed, unknown kinds stay refused, and downgrade turns leave into unavailable ✅ pass live migration.txt
A member sees the new-leave line, the brush order and hints, and a note field that changes its label and empties with the brush; the line stays gone after the first leave ✅ pass live 01-mine-before-save.png, member-flow.txt
A member paints 7-11 Dec as leave: nothing shows while saving or after a failed save; afterwards the box names 7, 10 and 11 Dec with one row per day ✅ pass live 02-mine-leave-saved.png, member-flow.txt
A member adds the weekend with one click as one entry, then undoes it ✅ pass live 03-mine-weekend-added.png, member-flow.txt
A member asks for a swap from a colliding day, and that row then says the request was sent ✅ pass live 05-swap-form.png, 15-row-request-sent.png
Toasts name a replaced entry and say that handed-over duties stay when a leave is erased; the duties do stay with the replacements ✅ pass live 06-toast-erase.png, member-flow.txt, day-itself-and-visibility.txt
The team reads leave in the matrix: band, unboxed U, legend row, and collision in the cell names ✅ pass live 10-matrix-coordinator.png, 11-matrix-legend.png, coordinator-flow.txt
A coordinator opens the '4 dyżury osób na urlopie' chip on Teraz, steps to the next collision, covers all three days, and gets the all-covered message only after the last one ✅ pass live 13-day-panel-frame.png, 14-day-panel-next.png, 16-covered-1.png, 16-covered-2.png, 16-covered-3.png
Adversarial: no false all-covered message when a leave is shortened; a leave running past the visible weeks shows its full dates; N only and mixed days change the chip wording ✅ pass live edge-cases.txt, 50-leave-past-range.png
Leave on today and tomorrow turns the box to the error tone with 'call the coordinator', and today's tile keeps both rings, the letter and the gold strip ✅ pass live 20-short-notice.png, 60-today-tile-before-dark.png, 61-today-tile-after-dark.png, 61-today-tile-after-light.png
Teraz shows 'na urlopie' and 'bez zastępstwa' to team members without a reload; not to viewers or share links, and not for a 'nie mogę' entry ✅ pass live 23-teraz-anna.png, 23-teraz-koord.png, 23-teraz-viewer.png, 24-share-link.png, blocking-rules.txt, edge-cases.txt
Adversarial: a teammate sees the leave but not its note, a viewer sees neither, and a member cannot file leave for a colleague or in the past ✅ pass live day-itself-and-visibility.txt, blocking-rules.txt, member-flow.txt
Adversarial: a person on leave is refused as swap replacement, as correction, by the generator, at propose and at publish ✅ pass live blocking-rules.txt, 40-draft-collision.png
Coordinators get the e-mail worded for the kind for every new collision, an identical repaint and an undone save send nothing, and the member hears about an entry on their behalf ✅ pass live emails.txt, emails-outbox.txt, email-leave-collision.png
A coordinator files leave on behalf of a member and gets the collision box with a link to the day ✅ pass live 53-on-behalf.png, day-itself-and-visibility.txt
On a phone the brush and eraser stay in one row (390 and 320 px) and the day list says who is on leave ✅ pass live 30-phone-home.png, 31-phone-brush.png, day-itself-and-visibility.txt
In English the letter is L, the texts are English, and the light theme reads well ✅ pass live 32-english-light-home.png, 33-english-light-mine.png
The audit log names leave, and the Polish and English guide pages describe it ✅ pass live blocking-rules.txt, 62-docs-pl.png, 63-docs-en.png

Leave saved: gold tiles, weekend hints and one row per colliding day

First-visit line, brush and leave note field

Colliding day with a swap request already sent

Matrix band and legend

Day panel: collision 1 of 3 and Następna

Message that all duties of the leave are covered

Short notice: error tone and call the coordinator

Teraz screen with the on-leave tags

Share link shows no leave

Phone: duty cards and the day-list leave line

Phone: brush in one row

English, light theme, letter L

Draft blocked by a leave

Leave entered on behalf of a member

Today tile before the fix (strip hidden)

Today tile after the fix (dark)

Today tile after the fix (light)

Leave collision e-mail as received

Evidence: Member flow log
## first visit, default brush
brush order: ["nie mogę true","urlop false","wolę nie false","chętnie false","Gumka (usuwa wpis z dnia) false"]
intro: 1
nie mogę => Nie weźmiesz dyżuru tego dnia, np. zajęte popołudnie. Gdy nie ma Cię w pracy cały dzień, wybierz „urlop”.
urlop => Nie ma Cię w pracy cały dzień. Blokuje dyżur jak „nie mogę”, a zespół widzi urlop w grafiku.
wolę nie => Wolisz nie mieć dyżuru tego dnia. Generator bierze to pod uwagę, ale może Ci go przydzielić.
chętnie => Chętnie weźmiesz dyżur tego dnia. Generator bierze to pod uwagę.
note label N: Powód do kolejnych wpisów
after switch note = "" label: Notatka do urlopu

Opcjonalna · widzą koordynatorzy i administratorzy. Nie wpisuj powodów zdrowotnych.
boxes before save: []
## save 7-11 Dec as leave with a note
boxes while the save is in flight: []
boxes after: ["Weekend 5 – 6 gru nie jest objęty urlopem | Generator może Ci wtedy przydzielić dyżur. | Dodaj weekend do urlopu","Weekend 12 – 13 gru nie jest objęty urlopem | Generator może Ci wtedy przydzielić dyżur. | Dodaj weekend do urlopu","W czasie urlopu masz dyżury: 7, 10 i 11 gru | Urlop nie zdejmuje dyżurów: są Twoje, dopóki ktoś ich nie przejmie. Koordynatorzy dostają o tym e-mail. | pon 7 gru | P | Poproś o zamianę… | czw 10 gru | S | 11–19 | Poproś o zamianę… | pt 11 gru | P | Poproś o zamianę…"]
toast: ["Zapisano: 7 – 11 gru „urlop” | notatka: wyjazd | Cofnij"]
intro after first U: 0
tile labels: ["pon 07-12-2026, Urlop, notatka: wyjazd, dyżur: PRIMARY, kolizja z dyżurem","wt 08-12-2026, Urlop, notatka: wyjazd","śr 09-12-2026, Urlop, notatka: wyjazd","czw 10-12-2026, Urlop, notatka: wyjazd, dyżur: 11–19, SECONDARY, kolizja z dyżurem","pt 11-12-2026, Urlop, notatka: wyjazd, dyżur: PRIMARY, kolizja z dyżurem","sob 12-12-2026"]
## add the weekend in one click
entries: [["leave","2026-12-05","2026-12-11","wyjazd"]]
boxes: ["Weekend 12 – 13 gru nie jest objęty urlopem | Generator może Ci wtedy przydzielić dyżur. | Dodaj weekend do urlopu","W czasie urlopu masz dyżury: 6, 7, 10 i 11 gru | Urlop nie zdejmuje dyżurów: są Twoje, dopóki ktoś ich nie przejmie. Koordynatorzy dostają o tym e-mail. | niedz 6 gru | S | Poproś o zamianę… | pon 7 gru | P | Poproś o zamianę… | czw 10 gru | S | 11–19 | Poproś o zamianę… | pt 11 gru | P | Poproś o zamianę…"]
## undo the weekend
entries: [["leave","2026-12-07","2026-12-11","wyjazd"]]
intro after reload: 0
## legend
Kropka: masz w tym dniu dyżur.
Obwódka: masz dyżur w dniu z wpisem „nie mogę” albo „urlop”.
N
Nie mogę
U
Urlop
W
Wolę nie
C
Chętnie wezmę
## ask for a swap on the 11 Dec row, through the screen
url http://localhost:5199/zamiany?data=2026-12-11&rola=primary
options 200 [{"member_id":"2e574d2e-b232-4a5f-bf04-1462bc55cf10","display_name":"Anna Kowalska","availability":null,"on_duty_that_day":false,"slots":[{"service_date":"2026-12-11","role":"primary"}],"blocking_violations":[],"rule_violations":[{"rule":"rest_after_run","message":"Mniej niż 2 dni przerwy po serii dyżurów on-call.","member_name":"Anna Kowalska","days":["2026-12-10","2026-12-11","2026-12-13"]},{"ru
## adversarial: the past and unknown kinds
leave in the past: {"s":422,"j":{"detail":"Nie można dodać dostępności w całości w przeszłości"}}
half day kind: 422
## replaced + erase toasts
Zapisano: 16 – 18 gru „urlop”

Zastąpiono: „nie mogę” czw 17 gru

Cofnij
Zapisano: czw 17 gru „nie mogę”
Cofnij
Wyczyszczono: 16 – 18 gru

Dyżury przekazane w czasie urlopu zostają u zastępców.

Cofnij
Zapisano: 16 – 18 gru „urlop”

Zastąpiono: „nie mogę” czw 17 gru

Cofnij
Zapisano: czw 17 gru „nie mogę”
Cofnij
entries: [["leave","2026-12-07","2026-12-11","wyjazd"]]
## a failed save shows no follow-up
weekend hints 0 | Nie zapisano: 21 – 25 gru. Spróbuj ponownie.

Błąd HTTP 500

Wyczyszczono: 16 – 18 gru

Dyżury przekazane w czasie urlopu zostają u zastępców.

Cofnij
Zapisano: 16 – 18 gru „urlop”

Zastąpiono: „nie mogę” czw 17 gru

Cofnij
Zapisano: czw 17 gru „nie mogę”
Cofnij
page errors ["Failed to load resource: the server responded with a status of 500 (Internal Server Error)"]
Evidence: Coordinator flow log
risk text on Teraz: ["4 dyżury osób na urlopie"]
chip: 4 dyżury osób na urlopie
leave cells: ["Marek Nowak, pon 07-12-2026, PRIMARY kolizja, Urlop","Marek Nowak, wt 08-12-2026, brak dyżuru, Urlop","Marek Nowak, śr 09-12-2026, brak dyżuru, Urlop","Marek Nowak, czw 10-12-2026, S 11–19 (SECONDARY kolizja, 11–19 kolizja), Urlop","Marek Nowak, pt 11-12-2026, PRIMARY kolizja, Urlop"]
legend: Legenda | Role | P | PRIMARY · 19:00 → 09:00, weekend całą dobę | S | SECONDARY · zastępstwo, ta sama pora | 11–19 | dyżur dzienny 11:00 → 19:00 w dni robocze | Dostępność | N | Nie mogę | U | Urlop | W | Wolę nie | C | Chętnie wezmę | Pasmo w wierszu osoby: urlop | Oznaczenia | P | po zamianie | P | po korekcie koordynatora | dziś | dzień bez obsady | weekend / święto (2X) | wydarzenie (kropka w komórce) | Klawisze | Strzałki przechodzą po siatce, PageUp i PageDown przeskakują o tydzień.
url http://localhost:5199/
frame: ["Kolizja: Marek Nowak ma PRIMARY mimo urlopu (7 – 11 gru) | Notatka: „wyjazd”. Kolizja 1 z 3 w tym urlopie. | Zmień osobę na PRIMARY… | Następna: czw 10 gru"]
primary buttons in view: []
after Następna: ["Kolizja: Marek Nowak ma SECONDARY i 11–19 mimo urlopu (7 – 11 gru) | Notatka: „wyjazd”. Kolizja 2 z 3 w tym urlopie. | Zmień osobę na SECONDARY i 11–19… | Następna: pt 11 gru"]
list line: ["U\nUrlop\nMarek Nowak: Urlop (7 – 11 gru) - wyjazd"]
form open: ["SECONDARY","Marek Nowak","SECONDARY","Marek Nowak","Marek Nowak","Ewa Dąb","Jan Maj","Marek Nowak","Kolizja: Marek Nowak ma SECONDARY i 11–19 mimo urlopu (7 – 11 gru)","Marek Nowak","powiązana z SECONDARY","Kolizja: Marek Nowak ma SECONDARY i 11–19 mimo urlopu (7 – 11 gru)","SECONDARY","11–19 · razem z SECONDARY","PRIMARY niedostępna: jedna osoba nie może mieć obu on-call tego dnia. 11–19 zaznaczona z polityki, bo Marek Nowak ma ją razem z SECONDARY.","Osoba na SECONDARY i 11–19","Ewa Dąb · SECONDARY, 11–19","Jan Maj · SECONDARY, 11–19","Ola Wiśniewska · SECONDARY, 11–19","Piotr Zieliński · SECONDARY, 11–19","Marek Nowak · już pełni tę rolę tego dnia"]
Evidence: Visibility, short notice, phone and English log
## member after the coordinator covered 7, 10 and 11 Dec
boxes []
## erase that leave: handed-over duties stay
200
[["2026-12-07","primary","Ewa Dąb"],["2026-12-10","late_shift","Jan Maj"],["2026-12-10","secondary","Jan Maj"],["2026-12-11","primary","Ewa Dąb"]]
## paints leave today-tomorrow (short notice) through the screen
boxes ["W czasie urlopu masz dyżury: 2 i 3 gru | Urlop nie zdejmuje dyżurów: są Twoje, dopóki ktoś ich nie przejmie. Koordynatorzy dostają o tym e-mail. | Dyżur dziś (SECONDARY + 11–19) jest nadal Twój. Zadzwoń do koordynatora. | śr 2 gru | S | 11–19 | Poproś o zamianę… | czw 3 gru | P | Poproś o zamianę…"]
box class box box-bad
now strip without any reload: ["na urlopie\nbez zastępstwa","na urlopie\nbez zastępstwa"]
today tile outline/shadow: ["rgba(101, 184, 255, 0.6) 0px 0px 0px 2px inset, rgb(255, 177, 150) 0px 0px 0px 2px","rgb(242, 209, 107)","avail-day avail-day-ur avail-day-today avail-day-conflict"]
## who sees the tag
anna tags ["na urlopie\nbez zastępstwa","na urlopie\nbez zastępstwa"]
anna calendar availability [{"member_id":"64d32c5c-bd74-4744-9434-d580a6b75ca6","kind":"leave","starts_on":"2026-12-02","ends_on":"2026-12-03","entry_starts_on":"2026-12-02","entry_ends_on":"2026-12-03","note":null}] | on_leave in published: {"\"on_leave\":true":2,"\"on_leave\":false":1}
errs []
koord tags ["na urlopie\nbez zastępstwa","na urlopie\nbez zastępstwa"]
koord calendar availability [{"member_id":"64d32c5c-bd74-4744-9434-d580a6b75ca6","kind":"leave","starts_on":"2026-12-02","ends_on":"2026-12-03","entry_starts_on":"2026-12-02","entry_ends_on":"2026-12-03","note":null}] | on_leave in published: {"\"on_leave\":true":2,"\"on_leave\":false":1}
errs []
viewer tags []
viewer calendar availability [] | on_leave in published: {"\"on_leave\":false":3}
errs []
## share link
422 {"detail":[{"loc":["body","starts_on"],"msg":"To pole jest wymagane.","type":"missing"},{"loc":["body","ends_on"],"msg":"To pole jest wymagane.","type":"missing"},{"loc":["body","expires_at"],"msg":"Extra inputs are not permitted","type":"extra_forbidden"},{"loc":["body","days"],"msg":"Extra inputs 
## note privacy
anna sees note: false sees kind: true
marek sees note: true sees kind: true
koord sees note: true sees kind: true
admin sees note: true sees kind: true
viewer sees note: false sees kind: false
## phone
cards ["na urlopie\nbez zastępstwa","na urlopie\nbez zastępstwa"]
day line ["Na urlopie: Marek Nowak","Na urlopie: Marek Nowak"]
brush tops (one row): [[34,100,1690],[102,168,1690],[170,236,1690],[238,304,1690],[315,359,1690]] doc overflow 0
brush at 320: [[34,95,1727],[97,136,1727],[138,194,1727],[196,247,1727],[258,302,1727]] overflow 0
## English, light
boxes ["You have duties during your leave: 2 and 3 Dec | Leave does not lift the duties: they stay yours until someone takes them over. The coordinators get an e-mail about it. | The duty today (SECONDARY + 11–19) is still yours. Call the coordinator. | Wed 2 Dec | S | 11–19 | Request a swap… | Thu 3 Dec | P | Request a swap…"]
tiles ["L","L"]
brush ["unavailable","leave","prefer not","willing",""]
strip ["on leave\nno cover","on leave\nno cover"]
## on behalf
boxes ["Weekend 12 – 13 gru nie jest objęty urlopem | Generator może wtedy przydzielić dyżur: Ola Wiśniewska. | Dodaj weekend do urlopu","Ola Wiśniewska ma w czasie urlopu dyżury: 15 gru | Wpis nie zdejmuje dyżuru. Zmień obsadę tego dnia w grafiku. | wt 15 gru | S | 11–19 | Pokaż dzień"]
errs [] [] [] []
Evidence: Blocking rules log
## share link
tags [] word urlop on page false Marek on page true
calendar 200 has leave: false
published 200 ["\"on_leave\":false","\"on_leave\":false","\"on_leave\":false"]
## viewer cannot file leave: 403
## member cannot file for a colleague: 403
## swap: Anna offers 2 Dec PRIMARY to Marek, on leave 2-3 Dec
200 [["Ewa Dąb",null],["Jan Maj",null],["Ola Wiśniewska",null],["Piotr Zieliński",null]]
200 [["Anna Kowalska",null],["Ewa Dąb",null],["Jan Maj",null],["Piotr Zieliński",null]]
POST 422 {"detail":"Zastępca jest niedostępny"}
## correction: coordinator puts Marek on a leave day (Ewa on leave 14 Dec, clean roster)
slot {"schedule_id":"9ec3ab32-bec4-45e4-8ad8-70c82716c470","schedule_version":4,"service_date":"2026-12-14","role":"primary","assignee_name":"Anna Kowalska","member_id":"2e574d2e-b232-4a5f-bf04-1462bc55cf10","is_override":false,"change_kind":null}
check {"detail":"Osoba jest niedostępna"}
save even when acknowledged 422 {"detail":"Osoba jest niedostępna"}
control, leave removed: {"violations":[],"ends_handover":null}
## generator 16-29 Dec with leaves: Marek 17-20, Ewa 21-27 ; N: Jan 18
run 202 
status completed
duties on blocked days (expect none): Marek [] Ewa [] Jan [] | total 36 conflicts []
## leave filed after the draft: propose must be refused
Ola duty 2026-12-19 secondary
draft conflicts [{"service_date":"2026-12-19","role":"secondary","assignee_name":"Ola Wiśniewska"}] stale 1
propose 409 {"detail":{"message":"Szkic zawiera osoby z twardą niedostępnością. Popraw wskazane komórki korektą w macierzy szkicu albo wygeneruj grafik ponownie","reason":"UNAVAILABLE","conflicts":["2026-12-19 · secondary: Ola Wiśniewska ma twardą niedostępność"]}}
screen text: ["na urlopie","na urlopie","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Urlop","Ola Wiśniewska\tDyżur w dniu „nie mogę” lub urlopu\t","Reguły twarde (jedna rola on-call na osobę i dzień, najwyżej 3 dyżury on-call w 7 dniach i 2 dni przerwy po serii, nierozdzielny blok dni wolnych, 11–19 tylko w dni robocze, kwalifikacje, „nie mogę” i urlop): 1 naruszenie. Pełna lista reguł w dokumentacji."]
## publish after proposing clean
propose clean 200 
publish 409 {"detail":{"message":"Grafik zawiera osoby z twardą niedostępnością; wygeneruj go ponownie","reason":"UNAVAILABLE","conflicts":["2026-12-19 · secondary: Ola Wiśniewska ma twardą niedostępność"]}}
## fairness still answers 200
## audit
200 ["\"summary\":\"Ola Wiśniewska: urlop 2026-12-19 – 2026-12-19\"","\"summary\":\"Ola Wiśniewska: usunięto „urlop” 2026-12-19 – 2026-12-19\"","\"summary\":\"Ola Wiśniewska: urlop 2026-12-19 – 2026-12-19\"","\"summary\":\"Ewa Dąb: urlop 2026-12-21 – 2026-12-27\"","\"summary\":\"Ewa Dąb: usunięto „urlop” 2026-12-21 – 2026-12-27\"","\"summary\":\"Marek Nowak: urlop 2026-12-17 – 2026-12-20\"","\"summary\":\"Marek Nowak: usunięto „urlop” 2026-12-17 – 2026-12-20\"","\"summary\":\"Ewa Dąb: usunięto „urlop” 2026-12-14 – 2026-12-14\""]
Evidence: Edge cases log (its e-mail steps 1-4 ran on a queue still holding older mail; use emails.txt for those)
N only: ["2 dyżury mimo „nie mogę”"]
N and U: ["3 dyżury mimo „nie mogę” lub urlopu"]
member box, mixed: Masz dyżury w dni z wpisem „nie mogę” albo „urlop”: 14 i 15 gru
Wpis nie zdejmuje dyżurów: są Twoje, dopóki ktoś ich nie przejmie. Koordynatorzy dostają o tym e-mail.
pon 14 gru
S
11–19
Poproś o zamianę…
wt 15 gru
P
Poproś o zamianę…
leave past the range: ["Kolizja: Marek Nowak ma SECONDARY i 11–19 mimo urlopu (14 gru 2026 – 6 sty 2027) | Zmień osobę na SECONDARY i 11–19… | Następna: wt 15 gru"] ["U\nUrlop\nMarek Nowak: Urlop (14 gru 2026 – 6 sty 2027)"]
## no false "all covered" when the leave is shortened
toast 0
## all-day adversarial: the tag leaves the strip when someone takes the duty over / when leave is erased
before 2
N today, tag must not show 0
## docs
/docs/uzytkownik/dostepnosc.html 24
/docs/en/uzytkownik/dostepnosc.html 26
## mail: e-mail for each new collision. clear, wait, then
1. N on a duty day [["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"]]
2. same day repainted as U [["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"]]
3. widened to a second duty [["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Niedostępność koliduje z dyżurem: Marek Nowak"],["koord@example.com","Niedostępność koliduje z dyżurem: Marek Nowak"]]
4. identical repaint stays silent [["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["koord@example.com","Urlop koliduje z dyżurem: Marek Nowak"],["admin@example.com","Niedostępność koliduje z dyżurem: Marek Nowak"],["koord@example.com","Niedostępność koliduje z dyżurem: Marek Nowak"],["admin@example.com","Urlop koliduje z dyżurem: Marek Nowak"]]
Marek Nowak wpisał(a) urlop obejmujący istniejące dyżury:
- pon 14-12-2026 · SECONDARY
- pon 14-12-2026 · 11–19

Sprawdź grafik i uzgodnij zmianę obsady: http://localhost:5199/
Evidence: E-mail queue on an empty outbox
1. N on a duty day: ["Niedostępność koliduje z dyżurem: Marek Nowak [Marek Nowak zgłosił(a) twardą niedostępność obejmującą istniejące dyżury: - pon 14-12-2026 · SECONDARY - pon 14-12-2026 · 11–19  Sprawdź grafik"]
2. same day repainted as U: ["Urlop koliduje z dyżurem: Marek Nowak [Marek Nowak wpisał(a) urlop obejmujący istniejące dyżury: - pon 14-12-2026 · SECONDARY - pon 14-12-2026 · 11–19  Sprawdź grafik i uzgodnij zmianę obsad"]
3. widened to a second duty day: ["Urlop koliduje z dyżurem: Marek Nowak [Marek Nowak wpisał(a) urlop obejmujący istniejące dyżury: - pon 14-12-2026 · SECONDARY - pon 14-12-2026 · 11–19 - wt 15-12-2026 · PRIMARY  Sprawdź graf"]
4. identical repaint (expect none): []
5. removed and filed again, same duties: []
6. new leave, then Undo within the window: ["Urlop koliduje z dyżurem: Marek Nowak [Marek Nowak wpisał(a) urlop obejmujący istniejące dyżury: - niedz 06-12-2026 · SECONDARY  Sprawdź grafik i uzgodnij zmianę obsady: http://localhost:519"]
   cancelled in the outbox: ["admin@example.com|pending|t","koord@example.com|pending|t"]admin@example.com|pending|Urlop koliduje z dyżurem: Marek Nowak|t
koord@example.com|pending|Urlop koliduje z dyżurem: Marek Nowak|t
Evidence: Migration transcript
## PostgreSQL 18.7, at 0050: an N row is stored, leave is refused
INSERT 0 1
ERROR:  new row for relation "availability" violates check constraint "ck_availability_kind"
DETAIL:  Failing row contains (acf506f5-5451-48ac-a651-27a909c7372f, 64d32c5c-bd74-4744-9434-d580a6b75ca6, leave, 2027-03-02, 2027-03-02, null, 2026-12-02 20:47:40.349047+00, null).
## upgrade to head
INFO  [alembic.runtime.migration] Running upgrade 0050_schedule_run_started_at -> 0051_availability_leave, Leave is a fourth kind of availability entry.
INSERT 0 1
## unknown kind is still refused
ERROR:  new row for relation "availability" violates check constraint "ck_availability_kind"
DETAIL:  Failing row contains (167a26e6-9ba6-43b2-b55e-f39269c24f8a, 64d32c5c-bd74-4744-9434-d580a6b75ca6, holiday, 2027-03-03, 2027-03-03, null, 2026-12-02 20:47:40.949347+00, null).
    kind     | starts_on  
-------------+------------
 unavailable | 2027-03-01
 leave       | 2027-03-02
(2 rows)

## alembic check
No new upgrade operations detected.
## downgrade
INFO  [alembic.runtime.migration] Running downgrade 0051_availability_leave -> 0050_schedule_run_started_at, Leave is a fourth kind of availability entry.
    kind     | starts_on  
-------------+------------
 unavailable | 2027-03-01
 unavailable | 2027-03-02
(2 rows)

## upgrade again, clean
INFO  [alembic.runtime.migration] Running upgrade 0050_schedule_run_started_at -> 0051_availability_leave, Leave is a fourth kind of availability entry.
DELETE 2
  • Outcome: ⚠️ 1 info across 1 run (16m46s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 info
  • ℹ️ backend/src/oncall/notifications/triggers.py:644 - Not a failure, for your information. If someone removes a leave and later files it again with the same colliding duties, coordinators get no second e-mail, but the box on the screen still says they do. Seen live: leave on 14-15 Dec was mailed, removed, filed again, and nothing new was queued. This follows the earlier decision that the duplicate check uses the kind plus the set of duties, so nothing was changed. If you want the second e-mail, free the key when the entry is removed.
  • Live validation: ✅ go - 18 of 18 scenarios driven live against the product
Scenario Result Live Evidence
An operator upgrades a PostgreSQL 18 database: old entries keep their kind, leave becomes allowed, unknown kinds stay refused, and downgrade turns leave into unavailable ✅ pass live migration.txt
A member sees the new-leave line, the brush order and hints, and a note field that changes its label and empties with the brush; the line stays gone after the first leave ✅ pass live 01-mine-before-save.png, member-flow.txt
A member paints 7-11 Dec as leave: nothing shows while saving or after a failed save; afterwards the box names 7, 10 and 11 Dec with one row per day ✅ pass live 02-mine-leave-saved.png, member-flow.txt
A member adds the weekend with one click as one entry, then undoes it ✅ pass live 03-mine-weekend-added.png, member-flow.txt
A member asks for a swap from a colliding day, and that row then says the request was sent ✅ pass live 05-swap-form.png, 15-row-request-sent.png
Toasts name a replaced entry and say that handed-over duties stay when a leave is erased; the duties do stay with the replacements ✅ pass live 06-toast-erase.png, member-flow.txt, day-itself-and-visibility.txt
The team reads leave in the matrix: band, unboxed U, legend row, and collision in the cell names ✅ pass live 10-matrix-coordinator.png, 11-matrix-legend.png, coordinator-flow.txt
A coordinator opens the '4 dyżury osób na urlopie' chip on Teraz, steps to the next collision, covers all three days, and gets the all-covered message only after the last one ✅ pass live 13-day-panel-frame.png, 14-day-panel-next.png, 16-covered-1.png, 16-covered-2.png, 16-covered-3.png
Adversarial: no false all-covered message when a leave is shortened; a leave running past the visible weeks shows its full dates; N only and mixed days change the chip wording ✅ pass live edge-cases.txt, 50-leave-past-range.png
Leave on today and tomorrow turns the box to the error tone with 'call the coordinator', and today's tile keeps both rings, the letter and the gold strip ✅ pass live 20-short-notice.png, 60-today-tile-before-dark.png, 61-today-tile-after-dark.png, 61-today-tile-after-light.png
Teraz shows 'na urlopie' and 'bez zastępstwa' to team members without a reload; not to viewers or share links, and not for a 'nie mogę' entry ✅ pass live 23-teraz-anna.png, 23-teraz-koord.png, 23-teraz-viewer.png, 24-share-link.png, blocking-rules.txt, edge-cases.txt
Adversarial: a teammate sees the leave but not its note, a viewer sees neither, and a member cannot file leave for a colleague or in the past ✅ pass live day-itself-and-visibility.txt, blocking-rules.txt, member-flow.txt
Adversarial: a person on leave is refused as swap replacement, as correction, by the generator, at propose and at publish ✅ pass live blocking-rules.txt, 40-draft-collision.png
Coordinators get the e-mail worded for the kind for every new collision, an identical repaint and an undone save send nothing, and the member hears about an entry on their behalf ✅ pass live emails.txt, emails-outbox.txt, email-leave-collision.png
A coordinator files leave on behalf of a member and gets the collision box with a link to the day ✅ pass live 53-on-behalf.png, day-itself-and-visibility.txt
On a phone the brush and eraser stay in one row (390 and 320 px) and the day list says who is on leave ✅ pass live 30-phone-home.png, 31-phone-brush.png, day-itself-and-visibility.txt
In English the letter is L, the texts are English, and the light theme reads well ✅ pass live 32-english-light-home.png, 33-english-light-mine.png
The audit log names leave, and the Polish and English guide pages describe it ✅ pass live blocking-rules.txt, 62-docs-pl.png, 63-docs-en.png
  • Throwaway PostgreSQL 18.7: alembic upgrade 0050_schedule_run_started_at, then upgrade to head, alembic check, downgrade and upgrade again, with rows checked through psql
  • Local API, worker, mail server (Mailpit) and the production frontend build, driven with Playwright and Chromium as member, coordinator, admin, viewer and share link
  • Member flow: first-visit line, brush, hints, note field, saving leave, delayed save, failed save, weekend hint, Undo, collision box, swap request
  • Coordinator flow: risk chip, matrix band, legend, day panel, next collision, covering all three days, entry on behalf of a member
  • Blocking rules: swap, correction, generator, propose and publish against a person on leave
  • E-mails: outbox rows and messages received by Mailpit for a new collision, repaint, wider range, identical repaint and Undo
  • Today's leave tile at 4x zoom in dark and light themes, before and after the CSS fix
  • npx vitest run src/styles.test.tsx (passes with the fix, fails when the CSS rule is removed)
  • npm run build after the fix
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

A member marks a day "urlop" (leave) beside "nie mogę", "wolę nie" and
"chętnie". Leave keeps the person off duty exactly as "nie mogę" does, in
the generator, corrections, swaps, publication and fairness, and stays a
separate entry: the team sees it in the schedule, a "nie mogę" stays a
private constraint on a day at work.

- backend: `AvailabilityKind.leave` with one `blocks_duty` rule, migration
  0051 replacing the vocabulary check, `on_leave` on today's duties for
  the team, e-mails and audit that say "urlop"
- member calendar: the brush position with a hint line, its own note
  label, a first-visit line, the weekend offered with one click, and a
  collision box with one row per day and the state of a swap already
  asked for
- schedule: a band with a strip in the person's row, legend rows, the risk
  chip counting duties, one collision frame per person and day with its
  position, a link to the next day and a confirmation after the last
- today: "na urlopie" and "bez zastępstwa" on the strip and the duty
  cards while nobody has taken the duty over; the phone day list names
  who is on leave
- letters follow the language (N/U/W/C, N/L/P/W); docs in both languages
  and DESIGN.md describe the new kind and its colour
@lowicz
lowicz force-pushed the fm/oncall-leave-u-scout branch from ebcee30 to 66c047c Compare December 2, 2026 20:34
… leave change

- name the union "leave, unavailable or both" once (`CollidingEntries`)
  instead of spelling it in each catalog function
- build the list of replaced entries before the sentence, so the toast
  text has no template string inside a template string
- in the migration upgrade test, prepare the refused row before the
  block that expects the refusal, so one call in it can raise
…ed. `ci-ok` failed only because the `frontend` job failed. **What failed:** one test out of 1687, `counts the seconds and names the per-pass budget` in `Generator.test.tsx`. It expected "solver 12 s / 15 s", but the CI page showed "solver 0 s / 15 s". **Cause:** a small bug in the generator screen that only sometimes broke the test. When you open the page while a generation is running, the screen first drew "0 s". It worked out the real seconds just after that. On a slow machine the test looked too early. This PR did not add the bug: it does not touch that counter or that test. **Rule that must hold:** a run in progress must always show the seconds since the solver started it. Two texts show this number (the step label and the line under the progress bar). Both read the same value, so one fix covers both. **Fix:** - `frontend/src/screens/Generator.tsx`: the seconds are now worked out before the screen is drawn (`useLayoutEffect` instead of `useEffect`). - `frontend/src/screens/Generator.test.tsx`: the test now stops the clock, so a slow machine cannot turn 12 s into 13 s. It also checks that no other number ever appears first. **Checked locally:** - The new check failed 5 of 5 times before the fix and passed 5 of 5 after. After that I only changed how the test stops the clock; the full run below includes that change. - All 1687 frontend tests pass, and the run with coverage exits with 0. - Lint, type check and build show no errors. I have not re-run CI on GitHub
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@lowicz
lowicz merged commit 15a73de into main Dec 2, 2026
18 checks passed
@lowicz
lowicz deleted the fm/oncall-leave-u-scout branch December 2, 2026 21:19
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.

1 participant