Repository navigation
feat(availability): warn when leave or "nie mogę" leaves a role without reserve - #403
Merged
Merged
Conversation
…ut reserve One read counts, per day and role, the people qualified for the role who have neither "nie mogę" nor leave that day, against how many the day needs: one for PRIMARY, one for SECONDARY, two different people for the pair and, on a working day, one for the 11-19 shift. As many left as needed is "bez rezerwy", fewer cannot be staffed. A day speaks only when an entry brought it there, and people eligible for no role are not counted. - Saving an entry that blocks duty is never refused. Its answer gains the days it leaves a role the person can take without reserve, with who else is on leave then and whether a schedule covers the day; the calendar shows it as a neutral notice under the month, until the next stroke or its Undo. - Coordinators and admins get the same count in the calendar payload, from today on, as chips above the matrix on "Teraz" and on "Grafik": a warning for no reserve, an alarm for a missing person, days in a row as one chip that opens the first of them. Members are not sent the count, like eligibility. Docs in both languages.
SonarCloud reads the ternary inside the ternary of the notice's lead as a nested one (typescript:S3358), in both catalogs. The verb now agrees with the number of people through pluralFormPl and pluralFormEn, like the sentence after it.
|
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
The oncall project gained a new preference kind "U" (urlop, leave). The captain approved a 5-step plan; steps 1-3 (PRs 399, 400, 401) are merged. This is STEP 4: the overlap warning (T3, rule D13-A): when leave (U) or N leaves too few qualified people to staff a role on a day, the member who saves the leave gets a neutral notice (never a refusal), and the coordinator sees chips above the matrix and on "Teraz". The approved design and decisions are in ~/firstmate/data/oncall-leave-u-scout/report.md (section 4.5 T3 paragraph, D13, 6.2 step 4, 9, 11), critique evidence in data/oncall-leave-u-scout/critique/. Leave is team-visible only as "urlop", never with a reason or note (D14).
What the referenced report sections say, so this text stands without the report:
Section 4.5, T3, overlap warning. The member who saves the leave gets a neutral notice, never a refusal: "Zapisano. 10–11 gru urlop ma też Marek Nowak. Do PRIMARY i SECONDARY zostają wtedy 2 osoby, bez rezerwy. Koordynatorzy widzą to w grafiku." The coordinator gets chips above the matrix and on "Teraz": "10–11 gru: PRIMARY i SECONDARY bez rezerwy (2 osoby)" (warning) and "24 gru: brakuje osoby do SECONDARY" (alarm). For days not generated yet the text says so: "Grafik na te dni nie jest jeszcze ułożony. Generator będzie miał 2 osoby na PRIMARY i SECONDARY." The rule (D13-A): per day and role, count the people qualified for the role who have neither N nor U that day; "bez rezerwy" when exactly as many remain as the day needs, alarm when fewer. N counts like U. People eligible for no duty are not counted.
Decision D13, the rule behind the overlap warning, chosen option A: count who can still take each role. Per day and role: people qualified for the role without N or U that day. Warning "bez rezerwy" when exactly as many remain as the day needs; alarm when fewer. N counts like U. The member only gets a notice; saving is never blocked. Not chosen: warning whenever two or more people have leave on the same day, and an admin-set limit of people on leave at once.
Section 6.2, step 4, overlap warning (T3). One read that returns, per day and role in a range, how many qualified people have no blocking entry, against how many the day needs; the availability save response gains the notice for the member. Chips reuse
.riskand.chip-*. Rule per D13.Section 9, the captain's decisions that bear on this step. D8: the team views chosen are the "Urlopy" panel on "Teraz" (T1, step 2, merged), the overlap warning (T3, this step) and the morning e-mail (T5, step 5, a separate later step that is not part of this change). D13: A, count who can still take each role; "bez rezerwy" or alarm. D14: A, "urlop" is any whole day away from work, and the reason is never shown: the team sees only "urlop". D5: A, leave is entered like N, everyone for themselves and a coordinator or admin on behalf, with no approval. D4: A, the whole team sees U like N, the note stays private; viewers and share links see no availability. The order of the plan stands: step 4 is the overlap warning alone.
Section 11, what the UX assessment changed for this view. Before: a warning box shown to the member, "na urlopie będą 2 z 4 osób". After: a neutral notice to the member with the saved fact first, and chips with the role and the reserve for the coordinator, because the member cannot act on it and the coordinator can. From the critique evidence behind it: the rule must be one a person can check by hand (count the people eligible for PRIMARY or SECONDARY with no N or U that day, warn when the count equals what the day needs, alarm when it is lower); in a team of ten, two people on leave on the same day is routine and must not warn; days with no schedule yet get the same rule and the same marker, because that is when the warning is most useful; N entries are counted too, since the day is just as unstaffed whether the person has N or U; when a collision frame and the overlap notice both apply, the collision comes first.
What Changed
PRIMARYandSECONDARYare counted together as two different people, unless exactly one of them is short, in which case each is judged alone.11–19counts on working days only. Days with no such entries never warn, and days without a schedule follow the same rule.staffingfield.staffinglist for these roles only. The OpenAPI contract, the Polish and English texts and the user docs are updated.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change only adds read-only counts and notices: saving is never refused, the chip counts go only to coordinators and admins, and the round 1 wording fix is small and matches the decision.
Testing
No baseline commands had run before this step. I ran the real API, database and built frontend locally with made-up people and drove 13 scenarios in a browser: member notices, coordinator chips, privacy, role counting and edge cases. All passed, and the Polish wording matches the approved examples apart from minor formatting; screenshots and run logs are saved. My first undo check clicked the wrong toast, so I repeated it on the right one and it passed. I stopped the servers and database and removed the temporary files.
Evidence: Member notices run log
Evidence: Coordinator chips run log
Evidence: Rules and boundaries run log
Evidence: Share link run log
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
frontend/src/i18n/pl/mine.ts:138- The notice says a colleague is on leave "too" even when the saved entry is not leave.Example: Marek has leave on 10 Dec. Anna saves "nie mogę" for that day, and two people are left for the pair. Anna reads: "Zapisano: czw 10 gru „nie mogę”. czw 10 gru urlop ma też Marek Nowak." The word "też" implies that Anna also has leave, but Anna does not.
Cause: the server sends
also_on_leavefor both blocking kinds, andwhendoes not know which kind was saved.The approved sentence was written for saving leave. The wording for saving "nie mogę" is a copy decision. Suggested fix: pass whether the saved entry is leave (
staffing.command.brush === 'leave') and drop "też" / "too" when it is not.Same issue at:
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Started the real product locally: throwaway PostgreSQL 18.7,alembic upgrade head,python -m oncall.seed_demoplusscripts/seed_fixture.py, uvicorn on port 8000, and the production frontend build served byvite previewon port 5199node scripts/drive1.mjs: real browser, member notices (published days, days not generated yet, N and U mixed, collision order, everyone away, 24 Dec, English)node scripts/drive2.mjs: real browser, undo, coordinator and admin chips on Teraz and Grafik, chip click, no chips for member and viewer, calendar API responsesnode scripts/drive3.mjs: real browser, single-role shortages, team of ten, person with no role, saving on someone's behalf, erasing, past days, phone widthnode scripts/drive4.mjs: real browser, share link shows no reserve dataLooked at the screenshots of the notice, collision order, nobody-left notice, Teraz and Grafik chips, member view and phone layout✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.