Repository navigation
feat(availability): add leave (urlop) as a fourth kind of entry - #399
Merged
Merged
Conversation
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
force-pushed
the
fm/oncall-leave-u-scout
branch
from
December 2, 2026 20:34
ebcee30 to
66c047c
Compare
… 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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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:
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:
The 14 decisions as answered on the board:
The confirmed design of step 1, with the corrections from the assessment:
What Changed
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; oneblocks_dutyrule covers both. Migration0051allows the new value; downgrading it turns leave into "nie mogę" and deletes the Undo snapshots. The API gainsentry_starts_on/entry_ends_onon calendar entries andon_leaveon current duties (always false for viewers and share links).DESIGN.mdare 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.
Evidence: Member flow log
Evidence: Coordinator flow log
Evidence: Visibility, short notice, phone and English log
Evidence: Blocking rules log
Evidence: Edge cases log (its e-mail steps 1-4 ran on a queue still holding older mail; use emails.txt for those)
Evidence: E-mail queue on an empty outbox
Evidence: Migration transcript
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
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.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 psqlLocal API, worker, mail server (Mailpit) and the production frontend build, driven with Playwright and Chromium as member, coordinator, admin, viewer and share linkMember flow: first-visit line, brush, hints, note field, saving leave, delayed save, failed save, weekend hint, Undo, collision box, swap requestCoordinator flow: risk chip, matrix band, legend, day panel, next collision, covering all three days, entry on behalf of a memberBlocking rules: swap, correction, generator, propose and publish against a person on leaveE-mails: outbox rows and messages received by Mailpit for a new collision, repaint, wider range, identical repaint and UndoToday's leave tile at 4x zoom in dark and light themes, before and after the CSS fixnpx vitest run src/styles.test.tsx(passes with the fix, fails when the CSS rule is removed)npm run buildafter the fix✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.