e46a14cc65f52b1c1b10738fdfb42d6a5b4a356a
64 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| d25778d2fa |
Mehrere Notfallkontakte, Planstelle nicht vor ihrer Einheit, Anstehend fuehrt in die Historie, Uebernahme, Meine Notizen
- Notfallkontakte: eigene Tabelle employee_emergency_contacts (Migration 20261019160000), beliebig viele je Person, angelegt, geaendert und entfernt wie Angehoerige (add_/update_/delete_emergency_contact, mit Historie und Protokoll). Bestand uebernommen. Verhaeltnis-Liste wie bei den Angehoerigen (Ehepartner, Lebenspartner, Kind, Sonstige mit Freitext). Neueinstellung, Wiedereintritt, Import und Mitarbeiterexport schreiben und lesen die Tabelle. - Planstelle beginnt nicht vor und nicht nach dem Bestehen ihrer Organisationseinheit: Ausloeser an om_positions (Migration 20261019150000), gilt fuer Anlegen, Aendern und Klonen. - Anstehend auf der Uebersicht: Klick oeffnet die Akte im Reiter Historie, bei einer Wiedervorlage im Reiter HR-Notizen (?tab=). - Uebernahme: Vertrag zeigt Besetzungsart und "Uebernahme Ja/Nein" aus der Historie; die Kachel Eintritte (YTD) zaehlt Uebernahmen mit. - Glocke: "Meine Notizen" schaltet bei hinzugewaehlten Kollegen auf nur die eigenen Notizen um. Rauchtest Schritt 18. Geprueft: lint, tsc, types:check, 921 Tests, Waechter |
|||
| b14d3f9aad |
Austritt und letzte Versetzung zuruecknehmen, Planstelle beim Eintritt berichtigen, Uebersicht Anstehend, Teilzeitvariante, Notiz erledigt von
Migration 20261019140000: - austritt_zuruecknehmen: Austrittsangaben leeren, Status neu ableiten, beendete Besetzung wieder oeffnen, wenn die Planstelle frei ist (sonst ohne Besetzung und mit Hinweis, dass eine andere gebraucht wird), Offboarding-Checkliste loeschen, Austritt aus der Historie nehmen und die Ruecknahme als eigene Zeile vermerken. Nichtantritt ausgenommen. - versetzung_zuruecknehmen: nur die letzte wirksame Versetzung, ohne spaetere Befoerderung; die Person kehrt auf die vorherige Planstelle zurueck, wenn diese frei ist, sonst Abweisung. delete_history_entry leitet die wirksame Versetzung dorthin um (Papierkorb in der Historie). - eintritt_planstelle_berichtigen: beim Eintritt gewaehlte Planstelle richtigstellen, solange keine Versetzung/Befoerderung folgte; keine Versetzung in der Historie. - app_planstelle_frei_ab: gemeinsame Pruefung (besetzt oder vorgemerkt). Oberflaeche: - Daten aendern: "Austritt zuruecknehmen" mit Rueckfrage; Abschnitt "Planstelle beim Eintritt". - Uebersicht, Karte Anstehend: Art "Anstehend" mit der vorgemerkten Historie aller Personen. - Teilzeitvariante auch im Reiter Stammdaten, "Keine" statt Strich; in den Formularen heisst der leere Eintrag "Keine (vertragliche Stundenaenderung)". - Notizen: bei erledigten steht, von wem und wann. Rauchtest Schritte 15-17. Geprueft: lint, tsc, types:check, 919 Tests, Waechter |
|||
| 87001a6f8f |
PLZ-Pruefung, Ein- und Austritt, Notizen, Planstelle anlegen, Offboarding-Vermerke
- PLZ gegen Ort (lib/plz.ts) aus dem Verzeichnis der RTR (lib/plz-at.ts, erzeugt von scripts/plz-verzeichnis.mjs, 2234 Postleitzahlen mit Postort und Bundesland). Gesperrt wird, was sicher falsch ist: unbekannte PLZ oder ein Ort, der Postort einer anderen PLZ ist. Ein Ortsteil, der kein Postort ist, bekommt einen Hinweis. Bundesland wird angezeigt. Neueinstellung, Wiedereintritt, Daten aendern (nur wenn die Adresse geaendert wird) und Import. - Berichte: Ereignistyp "Ein- und Austritt" (Eintritt und Austritt). - Neueinstellung: Planstelle wird zum Eintrittstag geprueft, sobald Stelle und Datum feststehen (besetzt oder vorgemerkt); ein Entwurf mit inzwischen vergebener Stelle sagt das. - Planstelle anlegen: Organisationseinheit mit Lupe, Kostenstelle gleich beim Anlegen (in einer Transaktion). - Mitarbeiterliste: Spalte Austritt zwischen Eintritt und Beschaeftigung. - Notizen: nach Faelligkeit sortiert; eigene Notiz loeschbar (delete_employee_note, Migration 20261019130000, Protokoll behaelt Text). - Offboarding-Vermerke: Chip retourniert, Garderobenschluessel retourniert, Sonstiges (Freitext). Rauchtest Schritt 14. Geprueft: lint, tsc, types:check, 917 Tests, Waechter |
|||
| 9637471f29 |
Austrittsdatum am Status, Behinderung eigene Ebene, Mutterschutz, geplante Vorgaenge aendern
- Statuschip: bei Ausgetretenen das Austrittsdatum in Klammern (Liste und Akte). - "Beguenstigt behindert" steht auf derselben Ebene wie der besondere Kuendigungsschutz und gilt auch ohne ihn; nennt der Personenkreis die Beguenstigung, ist das Kaestchen angehakt und gesperrt. - Personenkreis "Schwangerschaft" heisst in Anzeige und Export "Mutterschutz"; gespeichert bleibt der Wert. lib/ohne-gendern.ts wird dafuer zu lib/anzeige.ts (anzeige, anzeigeAuswahl). - Geplante Versetzung und Befoerderung lassen sich aendern: Stift in der Historie oeffnet Versetzen bzw. Befoerdern vorbelegt (Datum, Planstelle, Bezeichnung, Hay-Grade). Gespeichert wird als Abbrechen und neu Erfassen in einer Transaktion (geplantenVorgangErsetzen), damit dieselben Pruefungen gelten wie bei einer neuen; scheitert eine, bleibt die alte Vormerkung stehen. Ohne Migration. Geprueft: lint, tsc, types:check, 904 Tests, Waechter |
|||
| 5145ac76bc |
Neueinstellung speichert sich selbst und fragt beim Schliessen
Zwischenspeichern: - Zwei Sekunden nach der letzten Eingabe wird der Entwurf gespeichert, sobald Personalnummer oder Name erfasst sind (entwurfHatInhalt); ein nur geoeffneter und wieder geschlossener Assistent legt nichts an. - saveHireDraft mit `leise` ohne revalidatePath, damit die Uebersicht hinter dem Assistenten nicht alle paar Sekunden neu laedt; der Provider holt den Stand beim Schliessen. Ein neuer Entwurf entsteht gleich mit meiner Sperre und wird vom Takt aufgefrischt, sonst koennte ihn eine Kollegin oeffnen, waehrend er noch ausgefuellt wird. - Ein Speichern zur Zeit; die Kennung als Ref, damit ein zweites nicht einen zweiten Entwurf anlegt. Nach dem Anlegen der Person wird nicht mehr gespeichert. - Neben den Knoepfen steht, ob gespeichert ist. Beim Verlassen der Seite mit ungesicherten Eingaben fragt der Browser nach. Schliessen (X, Escape, Abbrechen): - Gibt es einen Entwurf oder ungesicherte Eingaben, fragt der Assistent im selben Fenster: "Weiter bearbeiten", "Als Entwurf behalten", bei einem hier entstandenen Entwurf auch "Verwerfen" (loescht ihn). Kein zweiter Dialog daneben: zwei offene Dialoge hoerten beide auf Escape. Escape bei offener Frage heisst weiter bearbeiten. Geprueft: lint, tsc, types:check, 864 Tests (neu: HireWizardEntwurf.test.tsx), Waechter. |
|||
| e1bbcc949f |
Geschlecht: divers, offen und inter
- Migration 20261015150000: gender_type um d, o, i erweitert (add value, aus demselben Grund wie bei worker_type: die Sicht it.mitarbeiter liest die Spalte). Die Funktionen wandeln mit ::gender_type um und nehmen die Werte ohne Aenderung an. - lib/geschlecht.ts fuehrt Kuerzel und Bezeichnung. Formulare (Einstellung, Daten aendern), Stammdaten, Zusammenfassung, Mitarbeiterexport, Berichtsfilter und Import lesen von dort. Die Anzeigen der Form gender === "m" ? "maennlich" : "weiblich" sind ersetzt; sie haetten jeden weiteren Wert als "weiblich" gezeigt. - Cornerstone fuehrt d/o/i als "not specified", LOLYO laesst die Anrede leer (beides schon bisher das Verhalten fuer unbekannte Werte). Geprueft: lint, tsc, types:check, 857 Tests (neu: geschlecht.test.ts), Waechter; Migration in der CI. |
|||
| d59fa2f82b |
Hay-Grade: leer statt Generic Grade, und leer ist die Vorgabe
"Generic Grade" (gespeichert als "-") sieht aus wie eine Bewertung und steht als solche im Cornerstone-Extrakt. "Noch nicht bewertet" heisst jetzt leer. Migration 20261015120000: - employees.paygrade darf leer sein und hat keine Vorgabe; jedes "-" wird leer. - Ebenso in ausstehenden datierten Aenderungen (Befoerderung, Vertragsaenderung) und in Entwuerfen. Sonst braeche der naechtliche Lauf an der Umwandlung in paygrade_type ab. - chk_hay_grade ohne "-". - Sieben Stellen in fuenf Funktionen per Anker (genau einmal): Vorgabe in hire_employee entfaellt; Wiedereintritt, Daten aendern und die Vertragsaenderung im Nachtlauf unterscheiden "nicht mitgeschickt" von "geleert" (case when ? then nullif); Befoerderung behaelt bei leerem Feld die bisherige Stufe; Protokolltext mit is distinct from. - Selbstpruefung: Bedingung, Spalte, keine "-" mehr in Bestand, Vormerkungen und Entwuerfen, neue Fassung in jeder Funktion, keine Umwandlung ohne nullif in irgendeiner Funktion. Oberflaeche: Auswahl mit "Kein Hay-Grade" an erster Stelle (kein Pflichtfeld mehr bei der Einstellung), Berichte gruppieren die nicht Bewerteten als "Kein Hay-Grade" vor HG09, Cornerstone-Extrakt "Grade ID" leer, Import ohne Vorgabe. Historieneintraege behalten "-" als Vorher-/Nachher-Wert; zuruecknehmen laesst sich ein solcher Eintrag nicht mehr. Geprueft: lint, tsc, types:check, 853 Tests, Waechter; Migration in der CI. |
|||
|
|
86177d648e |
Uebergabe-Bereinigung: Kommentare, Geheimnisse, CSP, Dokumentation
Kommentare beschreiben den heutigen Stand und warum er so ist, nicht mehr die Entwicklungsgeschichte: keine Datumsangaben zu Ereignissen, keine Vorfaelle an Testpersonen, keine Lieferantensicht, keine internen Namen oder Plattformen. In Migrationen nur Kommentare ausserhalb von Dollar-Quoting; Kommentare in Funktionskoerpern nur dort, wo ihr Text in keiner anderen Migration als Anker vorkommt. - Andreis Anpassungen aus windows-uebergabe nach master uebernommen. - LOLYO-Startpasswort kommt aus LOLYO_STARTPASSWORT statt aus dem Code; ohne Wert lehnt der Export mit Hinweis ab. - Beispiel- und erzeugte E-Mail-Adressen ohne Kundendomain. - Content-Security-Policy wird durchgesetzt; form-action fest mit login.microsoftonline.com, weil das Paket ohne Umgebungswerte gebaut wird. Geprueft im Browser: alle Seiten ohne Verstoss, Weiterleitung zu Microsoft geht durch. - migrate.mjs: einmalige Uebernahme der alten Buchfuehrung entfernt (seit 20260907100000 ohne Wirkung). - freischalten.ps1 vergibt und entzieht den HR-Zugang (-Entziehen) und protokolliert beides im Audit-Log. - docs/security-review.md -> docs/sicherheitskonzept.md: beschreibt den heutigen Stand ohne offene Punkte. README, entra-sso.md und deploy/windows/README.md ohne Widersprueche (Leserolle der IT, Freischaltung, Konto des Nachtlaufs), Abnahme-Checkliste statt "noch offen". Geprueft: lint, tsc, types:check, 823 Unit-Tests, Waechter (412 Dateien, keine Funde), alle 114 Migrationen auf leerem PostgreSQL 18 (zweiter Lauf leer), rauchtest.sql und vertragsangaben.sql bestanden. |
||
|
|
a9216b6a59 |
Uebergabestand fuer den Kunden wird aus master erzeugt
master bleibt die einzige Quelle. uebergabe/erzeugen.mjs baut den Branch windows-uebergabe aus master plus Zusatz-Branches, entfernt, was in uebergabe/ausschluss.txt steht (Docker-Betrieb, Testserver, CI, interne Unterlagen), streicht Abschnitte zwischen intern:start und intern:end und legt das Ergebnis als einen Commit auf den Ziel-Branch -- ohne die interne Historie. uebergabe/waechter.mjs prueft auf Arbeitsnotizen, interne Namen und Adressen, Projektjargon, Lieferantensicht, datierte Entwicklungsgeschichte, echte Kundenadressen und Passwoerter im Code. Laeuft in der CI auf master und als letzter Schritt beim Erzeugen. |
||
| 47db290821 |
Kommentare ohne Namen, Daten und Verweise nach innen
Vorbereitung der Uebergabe. Die Begruendungen bleiben vollstaendig stehen -- sie sind der Wert dieser Kommentare; entfernt ist nur, woher sie stammen. "Gemeldet von <Name> am <Datum>: eine halb ausgefuellte Verteilung sieht aus wie eine Angabe" -> "Eine halb ausgefuellte Verteilung sieht aus wie eine Angabe" Betroffen: 27 Namensnennungen in 21 Dateien, Verweise auf ein internes Testprotokoll (B.02, C.08, D.06, E.07, H.05, H.06, N.02), Datumsangaben, die eine Chronik der Defekte ergeben, und drei Verweise auf eine Datei, die nicht mitgeht. Datumsangaben als *Daten* bleiben: die Excel-Epoche, die Beispiele zur Datumserkennung, die Fixtures in den Tests. Zwei Funde nebenbei: actions/auth.ts beschrieb chk_passwort_pfad_endet als geltende Bedingung -- 20260908140000 hat sie entfernt. Der Kommentar sagte seither das Gegenteil dessen, was im Schema steht. tests/unit/reports.test.ts gruppierte nach "Suesswaren", einem Wert, den 20261007090000 abgeschafft hat. Der Test war gruen, weil groupKeyFor nur durchreicht -- er prueft jetzt einen Wert, den es gibt. README verspricht kein npm run test:e2e mehr: weder Skript noch Playwright sind vorhanden. |
|||
| a7b1b978c6 |
Arbeitszeitmodell, und die Teilzeitvariante bei der Einstellung
Beides aus den Meldungen vom 09.10.2026 -- das Modell von Max als "wichtiges neues Feature", die Variante von Lara. Stunden je Arbeitstag stehen als jsonb an der Person, neben den work_days, zu denen sie gehoeren. Die Regel "Summe gleich Wochenstunden, hoechstens zwoelf je Tag" liegt als CHECK in der Schema und nicht nur im Formular: sonst liesse jeder andere Weg in die Spalte -- Import, naechtlicher Lauf, Korrektur von Hand -- ein Modell zurueck, das nicht aufgeht. Ein CHECK darf keine Unterabfrage enthalten, ueber jsonb-Schluessel zu laufen braucht aber eine. Die Bedingung liegt deshalb in einer immutable Funktion. Gerechnet wird in numeric und in der Oberflaeche in Zehnteln: 7,7 mal 5 verfehlt als Gleitkommazahl die 38,5. Freiwillig, aber dann vollstaendig. Bei keiner der 800 uebernommenen Personen ist etwas erfasst; Pflicht hiesse, dass sich an keiner von ihnen mehr etwas aendern laesst. Wer anfaengt, muss aber fertig werden -- eine Summe, die nicht aufgeht, sieht aus wie eine Angabe und ist keine. Die Teilzeitvariante steht jetzt auch im Einstellungsassistenten, aber nicht im Wiedereintritt: rehire_employee schreibt sie nicht, und ein Feld, das sichtbar ist und beim Speichern fallengelassen wird, ist schlimmer als ein fehlendes. Nebenbei, beim Durchtesten gefunden: "Daten aendern" belegte das Land mit "Oesterreich" vor, wenn die Spalte leer war -- bei allen 784 uebernommenen Personen ist sie das. Jedes Speichern schrieb damit eine Aenderung "Land: leer -> Oesterreich" in die Historie, die niemand vorgenommen hatte. |
|||
| b55327d3b5 |
Ein erfasster Austritt wird berichtigt, nicht ein zweites Mal erfasst
Aus den Aenderungswuenschen vom 09.10.2026: erfassen ueber "x Austritt", nachtraeglich anpassen ueber "Daten aendern". Dasselbe war uns in den Daten begegnet -- an einer Testperson standen drei Austritte hintereinander, weil der Knopf erreichbar blieb, solange das Datum in der Zukunft lag. Eigener Vorgang und keine Korrektur in der Historie: lib/history.ts nimmt den Austritt vom Bearbeiten dort ausdruecklich aus, weil daran das Ende der Besetzung und die Statusspalte haengen. austritt_berichtigen verschiebt beides mit -- und weist einen spaeteren Austritt ab, wenn die Planstelle inzwischen neu besetzt ist. Der Teilindex faengt das nicht: er wacht nur ueber offene Besetzungen. Die Statusspalte wird vollstaendig neu hergeleitet statt nur auf "Ausgetreten" gesetzt. Wandert der Austritt in die Zukunft, ist die Person wieder beschaeftigt, und an status <> 'Ausgetreten' haengt, ob sie als Fuehrungskraft waehlbar ist. Ein Nichtantritt ist ausgenommen, in beide Richtungen: dort wurde die Besetzung entfernt statt beendet, und welche Planstelle es war, steht danach nirgends mehr. Die Funktion laeuft als definer, weil sie die vorhandene Austrittszeile in employee_history aendern muss -- dort gibt es absichtlich keine update-Richtlinie. Erste Anweisung ist require_hr_admin(). |
|||
| eb2b8843f2 |
Die fehlenden Felder bei der Neueinstellung, und Betriebsrat vierfach
Staatsbuergerschaft, Adresse, Postleitzahl, Ort und Land liessen sich erst nach dem Anlegen eintragen -- die Testerinnen mussten die frische Akte sofort wieder oeffnen (gemeldet ueber Lara, 09.10.2026). Dafuer war keine Migration noetig: hire_employee und rehire_employee nehmen diese Felder seit jeher entgegen, nur das Formular bot sie nicht an. Der Assistent folgte der Feldliste aus der Spezifikation, die Funktion der Tabelle -- und die Liste war kuerzer. Mit der Staatsbuergerschaft kommt die daran haengende Frage nach dem Aufenthaltstitel mit. Ohne sie waere dieselbe Luecke eine Stelle weiter: Staatsbuergerschaft erfassbar, die Pflichtangabe dazu wieder nur in "Daten aendern". Befristungsablauf heisst jetzt Zeitablauf. Wirklich umbenannt und nicht bloss anders beschriftet: exit_reason hat keinen CHECK, und im Bestand trug keine Zeile den alten Wert -- es gibt nichts, dem das rueckwirkend eine andere Bedeutung gaebe. Der Personenkreis "Betriebsraete & Ersatzmitglieder" zerfaellt in vier (Arbeiter/Angestellte, je mit Ersatzmitglied). Die eine betroffene Zeile bekommt keinen geratenen Wert, sondern einen leeren Personenkreis und einen Audit-Eintrag, der sagt was nachzutragen ist. Nebenbei: tests/unit/kuendigungsschutz.test.ts las einen fest eingetragenen Migrationspfad und haette nach dieser Aenderung die alte Datei geprueft. Er sucht jetzt selbst die zuletzt schreibende Migration. |
|||
| e77eaf7fba |
Erlernter Beruf und zustaendige HR im Report
- Neues freiwilliges Textfeld "Erlernter Beruf": Hiring Wizard (Person, Zusammenfassung), Daten aendern, Stammdaten, Wiedereintritt, Export, Historie. Gespeichert getrimmt, leer heisst nicht erfasst. - Reports: Aufteilen nach "Zustaendige HR" mit Gruppe "Nicht zugeordnet" und Vorlage "Headcount nach zustaendiger HR". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
|||
| 0e9d2f2296 |
VL, Bonusanspruch, zustaendige HR und getrennte Suesswaren-Kollektivvertraege
Vertrag: VL (1-8, freiwillig) und Bonusanspruch (Vorgabe Nein; bei Ja eine Bonusregelung: RL ab 01.01.2027, RL bis 31.12.2026, Aussendienst, Shop) direkt nach dem Hay-Grade -- im Einstellungsassistenten, im Wiedereintritt und in "Daten aendern", sichtbar im Reiter Vertrag und im Datenexport. Stammdaten: zustaendige HR. Auswaehlbar sind alle aktiven HR-Konten; die Datenbank prueft das. Historie und Audit-Log zeigen den Namen. Kollektivvertraege: Suessware Arbeiter, Suessware Angestellter, Handel. collective_agreement wird wie der Hay-Grade eine Domain ueber text. Der Bestand mit "Suesswaren" wird nach der Beschaeftigtengruppe aufgeteilt (Angestellte -> Angestellter, Arbeiter:innen und Lehrlinge -> Arbeiter), ebenso geplante Aenderungen und Entwuerfe. Die Funktionen werden an einzeiligen Ankern der laufenden Definition ergaenzt (Einstellung, Wiedereintritt, Daten aendern, Nachtlauf, Feldkarte). app_feld_karte hatte mit 100 Argumenten die Grenze von jsonb_build_object erreicht; die neuen Felder stehen in einem zweiten Objekt. Gegen eine frische Datenbank geprueft: alle Migrationen samt Selbstpruefung, zweiter Lauf leer, db/tests/rauchtest.sql und der neue db/tests/vertragsangaben.sql (9 Schritte) bestanden, Umstellung des Suesswaren-Bestands nachgestellt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
|||
| 2eda038c2e |
Kontierung auch bei besetzten Planstellen -- aus dem Organigramm heraus
Die Kostenstelle liess sich an genau einer Stelle aendern: auf der Seite Positionen, ueber die Karte einer Vakanz. Diese Seite zeigt aber nur unbesetzte und kuenftige Planstellen. Bei einer besetzten war die Kontierung damit nirgends zu erreichen -- im Bestand betrifft das 784 von 788, und dasselbe galt fuer ihre Taetigkeit. Die Angaben zu einer Einheit fuehren jetzt ihre Planstellen auf, besetzte eingeschlossen, mit Inhaber:in und Kostenstelle. Ein Klick oeffnet denselben Dialog wie auf Positionen, kein zweiter daneben. Was sich aendern laesst, entscheidet weiterhin die Datenbank: bei einer besetzten Stelle bleiben Einheit und Gueltigkeitsende gesperrt, weil ein Abteilungswechsel ueber eine Versetzung gehoert und nicht ueber die Stelle. Geladen wird erst beim Oeffnen und nur fuer diese eine Einheit. Alle 788 Planstellen in jede Zeichnung des Organigramms zu legen hiesse, fuer achtzig Einheiten zu laden, was man fuer eine braucht. EditPositionModal verlangt dafuer nicht mehr eine OpenPositionResolved, sondern nur noch die Felder, die er tatsaechlich liest. Die alte Signatur war der Grund, warum er nur dort aufzumachen war, wo unbesetzte Stellen entstehen. |
|||
| a3dde61ec1 |
Eine leere Organisationseinheit wieder entfernen
Der Papierkorb neben dem Plus, im Organigramm wie in der Liste, und nur dort, wo nichts darunter haengt. Ein Knopf, der beim Klick eine Absage erteilt, ist schlechter als kein Knopf -- die Datenbank prueft es trotzdem, denn sie sieht auch geschlossene Planstellen, die im Baum gar nicht gezeichnet sind. Abgewiesen wird mit Grund: untergeordnete Einheiten, Planstellen (geschlossene zaehlen mit), Kostenstellen, die darauf verweisen, und die Wurzel selbst. Geloescht und nicht geschlossen, und das ist eine bewusste Einschraenkung. delete_position macht seit dem OM-Umbau den Unterschied vor: besetzt gewesen → valid_to, nie besetzt gewesen → weg. Fuer Einheiten laesst sich davon heute nur die zweite Haelfte umsetzen, weil ein valid_to an einer Einheit zwar eingetragen, aber nirgends gelesen wuerde -- weder Organigramm noch orgMapsAbfragen, Berichte, Druck oder die Auswahl beim Anlegen einer Planstelle schraenken org_units auf den Stichtag ein. Die geschlossene Einheit staende ueberall weiter da, nur mit einem Datum, das niemand sieht. Das Schliessen zum Stichtag kommt, wenn org_units gegen den Stichtag gelesen wird -- dieselbe Arbeit, die auch das Verschieben braucht. |
|||
| a6b6a7d67c |
Eine Organisationseinheit aus dem Organigramm heraus anlegen
Bisher gab es dafuer nur den Import. Jetzt sitzt auf jeder Einheit im Organigramm -- in der Grafik wie in der Liste -- ein Plus, das eine untergeordnete Einheit anlegt, wahlweise gleich mit Leitungsplanstelle. Bewusst nur dieser eine Fall. Umbenennen, verschieben und schliessen fehlen nicht aus Zeitmangel: org_units.parent_id traegt kein Datum, ein Verschieben aenderte damit auch jede Auswertung auf einen vergangenen Stichtag, und der fruehere Stand waere danach nirgends mehr ablesbar. Anlegen stellt diese Frage nicht, weil vorher nichts da war -- und es kann dabei auch kein Kreis entstehen, was hier mehr wiegt als es klingt: die rekursive Abfrage in om_reporting_lines hat weder Tiefenbegrenzung noch Kreiserkennung. Die Leitungsplanstelle entsteht ueber create_position statt durch eine zweite Fassung derselben Logik -- dort haengen Jobkatalog, Nummernvergabe und die Pruefung "je Einheit genau eine Leitung". Die Orgnummer wird eingetragen, nicht vergeben. Vorgeschlagen wird die naechste freie Nummer der bestehenden Reihe, und nur dann, wenn sich im Bestand genau eine Systematik ablesen laesst -- eine plausibel aussehende, aber erfundene Nummer prueft niemand nach. Das Datum kommt nicht aus dem Stichtag der Ansicht. Wer sich die Struktur zum letzten Jahresende ansieht und auf Plus drueckt, will in aller Regel eine Einheit von heute anlegen. |
|||
| 779beb4478 |
Hay-Grade statt Verwendungsgruppe A--F
A--F stammte aus der Spezifikation, nicht vom Kunden: sechs erfundene Stufen mit erfundenen Beschreibungen. Der Kunde bewertet nach Hay und hat die Liste geschickt -- 13 Stufen plus einen Generic Grade. Dieselbe Spalte fuellt im Cornerstone-Extrakt die Grade ID. Solange dort A--F steht, ist die Datei in jeder Zeile falsch, ohne dass es beim Erzeugen auffaellt: das Zielsystem kennt diese Kennungen nicht. Der Typ heisst weiter paygrade_type, ist aber jetzt eine Domain ueber text mit CHECK statt eines Aufzaehlungstyps. Ein Enum laesst sich nicht umschreiben -- Werte entfernen geht gar nicht, und add value darf im selben Vorgang, der den neuen Wert schreibt, nicht benutzt werden. Wichtiger: die rund zehn SQL-Funktionen, die den Wert nach paygrade_type umwandeln, bleiben unveraendert gueltig. Jede von ihnen neu zu erzeugen hiesse, zehnmal die Gelegenheit zu haben, aus einer veralteten Vorlage zu kopieren. Zwei Funktionen muessen doch angefasst werden, beide per Punktaenderung an der laufenden Definition statt per Kopie aus einer Datei: der Vorgabewert B in hire_employee und die Beschriftung im Protokoll von promote_employee. Der Bestand bekommt den Generic Grade. Aus A--F liesse sich kein Hay-Grade ableiten: andere Einteilung, andere Anzahl. Geraten saehe im Extrakt genauso aus wie erhoben. |
|||
| c3e19606e2 |
Die Cornerstone-ID als eigenes, freiwilliges Feld
Cornerstone fuehrt jede Person unter einer eigenen Kennung. Der Export dorthin trug in "User ID" und "Username" bisher die Alpenwerk-UUID -- richtig, solange es nichts Besseres gab, aber nicht die Kennung, unter der Cornerstone die Person kennt. Jetzt steht dort diese Spalte. Freiwillig, weil die Zuordnungstabelle des Kunden fuer 434 der 784 Personen keine Kennung liefert. Eindeutig, weil eine Kennung genau einer Person gehoert. Als Text, weil fuehrende Nullen in einer numerischen Spalte verlorengingen. Ohne hinterlegte Kennung bleiben User ID und Username **leer**. Ein Rueckfall auf die UUID braechte zwei Kennungsarten in eine Datei, ohne dass es auffiele, und legte in Cornerstone eine zweite Person neben der bestehenden an. Eine fehlende Angabe soll fehlen; dafuer gibt es einen eigenen Test. Fuenf Funktionen mussten mit -- dieselbe Liste und derselbe Grund wie bei der Firmen-E-Mail: hire_employee und rehire_employee teilen sich den Schritt "Person", change_employee_data macht das Feld aenderbar, apply_due_pending_changes sorgt dafuer, dass eine datierte Aenderung nicht verfaellt, app_feld_karte haelt den Eintrag in der Historie richtigstellbar. Die Migration ist wieder erzeugt, nicht abgeschrieben, und prueft jede der fuenf einzeln. Erfasst wird das Feld in der Akte, in "Daten aendern", bei Einstellung und Wiedereintritt sowie ueber den Massenimport; es steht im Mitarbeiterexport und fuellt im Cornerstone-Export User ID und Username. |
|||
| e5aa527473 |
Angehoerige berichtigen, und beide Abschnitte sehen gleich aus
Angehoerige liessen sich bisher nur anlegen und entfernen. Ein Tippfehler im Namen war nur zu beheben, indem man die Person loeschte und neu anlegte -- zwei Eintraege in der Akte fuer eine Korrektur, und der erste sagte "entfernt", was nicht stimmte. Jetzt steht in jeder Zeile ein Stift, wie beim Notfallkontakt. update_employee_dependent kommt bewusst **ohne** Stichtag. Hinzufuegen und Entfernen tragen einen, dort passiert etwas zu einem Zeitpunkt. Eine Berichtigung nicht: der Wert war schon vorher falsch, und ein "wirksam ab" hiesse, die Person habe bis dahin anders geheissen. Der Eintrag in der Akte nennt deshalb Vorher und Nachher statt eines Datums. In "Daten aendern" standen fuer den Notfallkontakt drei Eingabefelder, waehrend die Angehoerigen darueber als Tabelle mit Knoepfen erscheinen -- zwei Bauformen fuer denselben Zweck, direkt untereinander. Dort steht jetzt derselbe Abschnitt wie im Reiter "Stammdaten"; beide laufen ueber das "Wirksam ab" des Formulars, wie die Angehoerigen es schon taten. Damit schreibt auch nur noch eine Stelle diese drei Spalten. Vorher schickte das Formular sie zusaetzlich im eigenen Aufruf mit. |
|||
| 37650ee9a4 |
Befoerderung wahlweise auf eine neue Planstelle -- und der Nachtlauf, der sie ausfuehrt
Bei "Befoerdern" steht jetzt die Wahl: selbe Planstelle oder eine neue.
Bei "neu" wird sie aus den freien gewaehlt, dieselbe Auswahl wie die
Zielplanstelle bei der Versetzung, und die Stelle schlaegt ihre
Taetigkeit als neue Bezeichnung vor -- nur als Vorschlag, denn
job_title darf von der Planstelle abweichen.
Die Zielstelle muss frei sein, mit derselben Meldung wie bei der
Versetzung. Ausgenommen ist die eigene: darauf sitzt die Person schon,
und "bereits besetzt" waere eine Falschaussage ueber sie selbst.
Dabei ist ein aelterer Fehler aufgefallen. transfer_employee legt fuer
ein kuenftiges Datum einen Eintrag in pending_org_changes mit
target_position_id an. Der Nachtlauf hat die Besetzung dort zur
Umstellung auf Planstellen (20260727120200) umgehaengt; zuletzt stand in
diesem Zweig nur noch
update employees set job_title = coalesce(payload->>'new_title', ...)
also die Fassung von *vor* jener Umstellung -- und new_title kommt in
diesem payload gar nicht vor. Eine auf spaeter datierte Versetzung wurde
am Stichtag auf "applied" gesetzt und bewegte niemanden: die Person blieb
auf ihrer alten Planstelle, im Organigramm unveraendert, ohne Meldung.
Eine der Migrationen dazwischen hat die Funktion aus einer alten Vorlage
neu geschrieben -- dieselbe Falle wie bei der Gruppe `role` und bei der
Anmerkung zum Austritt.
Beide Zweige haengen die Besetzung jetzt um, und die Selbstpruefung
zaehlt nach, dass es zwei sind. Nebenbei bekommt promote_employee den
festen search_path und app_current_user_id() statt auth.uid().
|
|||
| 57acbfae9d |
Die Firmen-E-Mail als eigenes, freiwilliges Feld
employees.email ist die private Adresse (20260811140000). Sie taugt nicht als Dienstadresse und darf auch nicht als solche benutzt werden: der Honestly-Export geht an einen fremden Anbieter, der damit im Namen des Arbeitgebers einlaedt. Die Spalte "Email" stand dort deshalb seit jeher leer, mit einem Vermerk in lib/honestly.ts, dass die Firmenadresse im Datenmodell fehlt. Jetzt gibt es sie, und die Spalte fuellt sich. Eindeutig, aber freiwillig -- mehrere Personen ohne Adresse stoeren den Index nicht, weil null nie gleich null ist. Geschrieben wird ueber `case when ? then nullif` statt `coalesce`: eine Dienstadresse muss sich auch wieder entfernen lassen. Vier SQL-Funktionen mussten mit, weil `create or replace` die ganze Fassung ersetzt und ein ausgelassenes Feld dort still verschwindet: hire_employee und rehire_employee (beide teilen sich den Schritt "Person" -- das Formular haette das Feld gezeigt und den Wert weggeworfen), change_employee_data (sonst nicht aenderbar), apply_due_pending_changes (sonst verfiele eine auf spaeter datierte Aenderung) und die Feldkarte (sonst waere der Eintrag in der Historie nicht korrigierbar). Die Selbstpruefung am Ende prueft jede einzeln. |
|||
| 8bb80d3bd2 |
Der Wiedereintritt oeffnet den Assistenten, vorbefuellt
Aus dem Gespraech vom 17.09.2026. Migration 20260917130000. Der kleine Dialog fragte Datum und Planstelle und liess alles andere stehen, wie es beim Austritt war. Nach zwei Jahren Abwesenheit ist das selten noch richtig — Anschrift, Wochenstunden, Kollektivvertrag, oft auch der Name. Wer es bemerkte, musste erst wiedereinstellen und danach "Daten aendern" oeffnen: zwei Vorgaenge fuer einen, und in der Akte stand dann eine Vertragsaenderung am Tag des Wiedereintritts, die niemand vorgenommen hat. rehire_employee nimmt jetzt den ganzen Satz entgegen und schreibt ihn in einer Transaktion. Erst einstellen und dann aendern waeren zwei Transaktionen, und scheitert die zweite, steht die Person wieder im Dienst — mit den Daten von damals und ohne dass es jemand merkt. Jedes Feld mit coalesce: fehlt ein Schluessel, bleibt der bestehende Wert. Das haelt den schlanken Aufruf am Leben und ist zugleich die Bedingung dafuer, dass der Assistent nur schickt, was er auch zeigt — Anschrift, Staatsbuergerschaft und Aufenthaltstitel fragt er naemlich nicht, so wenig wie bei einer Neueinstellung. Die Planstelle und das Eintrittsdatum sind bewusst leer: die alte Stelle kann besetzt oder entfallen sein, und ein vorbelegter Platz, den es so nicht mehr gibt, waere schlimmer als ein leeres Feld — er sieht nach einer Antwort aus. Dazu die Pruefungen der Neueinstellung, die hier fehlten: existiert die Planstelle, gilt sie zum Datum, ist sie frei. Die Personalnummer steht fest und wird nur gezeigt. Sie zu pruefen faende zwangslaeufig einen Treffer — die Person selbst — und sperrte das Formular mit einer Meldung, die stimmt und trotzdem in die Irre fuehrt. Ein eigenes Bauteil statt eines Schalters im HireWizard: kein Entwurf zu speichern, keine Angehoerigen anzulegen (die stehen schon in der Akte), keine Nummer zu pruefen, andere Funktion am Ende. Geteilt werden die Schritte, und das ist der Teil, der wirklich geteilt gehoert. RehirePanel ist damit weg. |
|||
| 6ab78d4b27 |
Uebernahme: extern auf intern ist ein eigenes Ereignis
Aus dem Gespraech vom 17.09.2026. Migrationen 20260917110000 (Enum-Wert) und 20260917120000 (Logik) — getrennt, weil ein in derselben Transaktion angelegter Enum-Wert dort noch nicht benutzt werden darf. Die Besetzungsart (extern/intern) wurde bisher nur bei der Neueinstellung gesetzt und war danach unerreichbar. Eine Angabe, die mit dem ersten Tag erstarrt, obwohl gerade ihr Wechsel der Vorgang ist, um den es geht. Sie steht jetzt in "Daten aendern". Wechselt sie von Extern auf Intern, entsteht das Ereignis "Uebernahme" — in der Personalakte und im Protokoll, und im Berichtemanager als Ereignistyp auswertbar. Der umgekehrte Weg bekommt ausdruecklich keines: eine Uebernahme zurueckzunehmen gibt es fachlich nicht. Zwei Eintraege und nicht einer: die Vertragsaenderung haelt fest, dass ein Feld sich geaendert hat und worauf (und laesst sich darueber zuruecknehmen), das Ereignis, dass dieser Wechsel eine Uebernahme war. Nur das zweite laesst sich zaehlen. Eine auf spaeter datierte Uebernahme erzeugt das Ereignis sofort mit pending_id, wie die Vertragsaenderung daneben; der Nachtlauf schreibt am Stichtag nur noch die Spalte. Die Selbstpruefung haelt fest, dass er kein zweites Ereignis schreibt — sonst staende die Uebernahme doppelt in der Akte und jede Auswertung zaehlte sie zweimal. Im Assistenten erscheint das Feld nicht: dort steht die Besetzungsart im Schritt "Position", und zweimal danach zu fragen waere eine Einladung, zwei verschiedene Antworten zu geben. |
|||
| 9ded472d25 |
Freiwillig oder unfreiwillig wird erhoben, nicht abgeleitet
Migration 20260917100000. Ruecknahme einer eigenen Entscheidung, nach der
Erklaerung des Kunden am 17.09.2026.
Wir hatten den Anstoss aus der Beendigungsart abgeleitet — Kuendigung AN
gilt als freiwillig, Kuendigung AG als unfreiwillig. Das schien sauberer,
weil es zwei Felder ausschliesst, die einander widersprechen koennen.
In Oesterreich stimmt es nicht. Die einvernehmliche Aufloesung ist hier der
Regelfall und sagt ueber den Anstoss nichts aus: sie kann von der Person
ausgehen ("ich moechte kuendigen", worauf einvernehmlich aufgeloest wird,
damit das AMS zahlt) oder vom Dienstgeber ("ich will die Trennung, dafuer
gibt es eine Abfindung"). Dieselbe Beendigungsart, zwei gegensaetzliche
Antworten — und das ist genau die Unterscheidung, auf die es bei einer
Fluktuationsanalyse ankommt. Die Ableitung haette die Haelfte der Faelle
still falsch einsortiert.
Im Formular steht jetzt die Beendigungsart oben mit allen Werten, darunter
"Freiwillig oder unfreiwillig". Keine der beiden schraenkt die andere ein.
Der abgeleitete Hinweis unter der Beendigungsart ist weg — er erschien von
selbst und sah aus wie ein Fehler des Formulars.
Die Angabe ist freiwillig: der Bestand traegt sie nicht, und ein
Befristungsablauf geschieht auf niemandes Betreiben. Ob sie fuer gewoehnliche
Austritte Pflicht werden soll, ist eine Frage an den Kunden.
rehire_employee raeumt sie mit dem Austritt weg. Die Funktion ist dabei
ausgeschrieben worden; die Selbstpruefung haelt fest, dass die beiden
Umstellungen, die sie schon hinter sich hatte (app_current_user_id statt
auth.uid, fester search_path), dabei nicht verlorengehen — genau das ist der
Fehler, den ein create-or-replace aus einer alten Vorlage leise macht.
|
|||
| 9ad2954970 |
Anmerkungen vom 16.09.: Uebersicht gegliedert, Personalnummer prueft frueher
1) Die Kacheln stehen jetzt in drei Gruppen — Personalstand, Personalbewegung, Recruiting & Vakanzen — in der Reihenfolge aus dem Entwurf des Kunden. Acht Zahlen nebeneinander sind acht Zahlen; sie beantworten aber drei verschiedene Fragen, und ohne Ueberschrift muss man jede Beschriftung einzeln lesen, um das herauszufinden. "Aktives Dienstverhaeltnis" steht vorn: es ist die Bezugsgroesse fast jeder Personalkennzahl. 2) Der Namensfilter in "Anstehend" ist jetzt immer da. Die Schwelle "erst ab neun Eintraegen" war in der Bedienung falsch — das Feld erschien bei 180 Tagen und verschwand bei 30, und ein Bedienelement, das je nach Zeitraum da ist oder nicht, wirkt wie ein Fehler. 3b) Der Filter heisst jetzt "Aktives Dienstverhaeltnis (Aktiv + Langzeitabwesenheit)" — derselbe Name wie die Kachel, die dorthin verlinkt. 6) Die Personalnummer wird gegen die Datenbank geprueft, waehrend sie eingetippt wird, und nennt bei einem Treffer die Person, die sie schon hat. hire_employee weist sie weiterhin ab — das bleibt die verbindliche Pruefung, denn zwischen Frage und Anlegen kann jemand anderes dieselbe Nummer vergeben. Nur kam diese Abweisung bisher nach sechs Schritten Eingabe, und das Feld steht im ersten Schritt. Gemerkt wird dabei die gepruefte *Nummer* samt Ergebnis, nicht ein Ja/Nein: so ist die Sperre eine Ableitung aus dem, was im Feld steht, und es gibt keinen Zustand, dessen Zuruecksetzen man vergessen koennte. Zu 4) geprueft, nichts geaendert: die FTE-Kachel rechnet bereits Summe der Wochenstunden der heute Aktiven durch 38,5. Der Berichtemanager rechnet dieselbe Formel, nur als Summe der Einzelquotienten geschrieben. |
|||
| b9da3f3411 |
Planstellen klonen — ausser den leitenden
Anforderung 11 aus dem Workshop. Migration 20260915160000. In der Fertigung sind Planstellen reihenweise gleich: zwoelf "Maschinenbediener:in" in derselben Abteilung auf derselben Kostenstelle. Von Hand angelegt sind das zwoelf Gelegenheiten, die Taetigkeit unterschiedlich zu schreiben — und ab der zweiten Schreibweise steht sie zweimal im Katalog und jede Auswertung nach Taetigkeit ist falsch. Der Klon nimmt Einheit, Taetigkeit (denselben Katalogeintrag) und die zum Stichtag geltende Kontierung. Nicht mit kommt die Besetzung: eine Planstelle ist ein Platz, keine Person, der Klon ist frei. Leitungsplanstellen sind ausgenommen, und zwar mit einer eigenen Meldung. Je Einheit gibt es genau eine, und ein Unique-Index sichert das ab — ohne die Pruefung waere ein Klonversuch entweder "duplicate key value violates unique constraint" oder, mit stillschweigend fallengelassenem is_chief, eine Planstelle, die anders ist als ihre Vorlage, ohne dass es jemand angefordert hat. In der Liste fehlt der Knopf dort; das ist Bequemlichkeit, die Regel steht in der Funktion. |
|||
| cf0ea51f47 |
Mitarbeiterart als zweite Achse neben der Beschaeftigtengruppe
Anforderung 9 aus dem Workshop. Migration 20260915140000.
Im Dokument standen die beiden untereinander:
Arbeiter, Angestellte, Lehrlinge
Standard / Praktikant / Geringfuegige Beschaeftigung / Altersteilzeit
Die erste Zeile gibt es schon als worker_type, Lehrling seit 20260910140000.
Die zweite ist eine andere Frage: nicht *als was* jemand angestellt ist,
sondern *in welcher Form*. Beide gelten gleichzeitig — ein Praktikant ist
Arbeiter oder Angestellter, nicht statt dessen. In eine Liste gepresst
muesste man sich fuer eine der Antworten entscheiden und verloere die andere.
NOT NULL mit Vorgabe "Standard": jede Person ist in irgendeiner Form
beschaeftigt, und "nicht erfasst" waere keine Aussage, sondern eine Luecke,
die sich durch jede Auswertung zieht. Der Bestand bekommt damit einen
sichtbaren, korrigierbaren Ausgangswert statt eines leeren Feldes.
Die vier Funktionen wurden vollstaendig neu geschrieben. Die Selbstpruefung
haelt deshalb auch die Felder der vorigen Migration fest: eines beim
Uebertragen zu verlieren waere ein Fehler, der nirgends auffiele — die
Oberflaeche schickte den Wert weiter, und die Funktion ignorierte ihn.
|
|||
| c25c16e372 |
Kuendigungsschutz bekommt einen Personenkreis, die Behinderung eigene Felder
Anforderungen 5 und 5a aus dem Workshop. Migration 20260915120000.
Bisher gab es ein Kennzeichen und ein Enddatum. Das beantwortet "darf hier
ohne Weiteres beendet werden?" — nicht aber, *warum* jemand geschuetzt ist,
und davon haengt ab, wer zustimmen muss. Nachzusehen war das nur im
Papierakt, also dort, wo unter Zeitdruck niemand nachsieht.
Zwoelf Personenkreise als CHECK auf text und nicht als Aufzaehlungstyp: die
Liste ist Rechtslage und aendert sich mit dem Gesetz, ein Typ liesse einen
zurueckgenommenen Wert fuer immer stehen. Die Oberflaeche liest dieselbe
Liste aus lib/kuendigungsschutz.ts; ein Test liest die Migration und haelt
beide gegeneinander, damit die begruendete Doppelung keine stille wird.
Die begueenstigte Behinderung bekommt Kennzeichen, Grad, Beginn und Ende —
vier Spalten und nicht eine zusammengesetzte, weil in Excel danach
gefiltert und summiert wird. Datenbankseitig sind sie *nicht* an den
Personenkreis gekettet: eine solche Bedingung scheiterte genau dann, wenn
jemand den Kreis korrigiert und der Grad noch dransteht. Die Oberflaeche
stellt den Zusammenhang her.
Dazu zwei Dinge, die auf dem Weg auffielen:
* Der Nachtlauf wendete bei einer auf spaeter datierten Aenderung nur
Person und Vertrag an — die ganze Gruppe "role" fiel weg. Betriebsrat,
Dienstwagen, Kollektivvertrag, Arbeitstage, Teilzeit und
Kuendigungsschutz wurden erfasst, in der Historie vermerkt, protokolliert
und am Stichtag nicht geschrieben. Sichtbar wurde das nie. Die neuen
Felder haetten den Fehler geerbt; er ist jetzt fuer alle behoben.
* Der Mitarbeiter-Export filterte ohne Stichtag ueber die Spalte `status`,
mit Stichtag ueber die Ableitung. Der Export nach "Ausgetreten" liess
damit genau die Leute aus, die gerade ausgetreten sind.
|
|||
| 99e4357c02 |
Let colleagues finish each other's drafts, one at a time
Seeing a colleague's draft turned out to be half a feature: the point of sharing it is to finish it while they are away. So writing is allowed now -- but never by two people at once. A draft is a single JSONB field. Whoever saves writes the whole state, not the changed field, so two open wizards overwrite each other completely and the second person sees nothing wrong: their own state is right there on screen. That is why writing stayed with the owner until now, and a lock is what makes giving that up safe. The lock lives in the row (locked_by, locked_at) and is enforced by the update and delete policies, not by the application. It expires, and that is the important half: releasing happens when the wizard closes, and a closed laptop never closes a wizard. Without expiry one crashed tab would take a draft away for good -- worse than the problem being solved. The wizard refreshes its lock while open so a long form does not lose it mid-way. Delete had to widen too, which reads like more than was asked for: the wizard deletes the draft once the person is hired. Without it the hire would go through and the draft would sit there forever. The card still only offers delete on your own drafts. Four of five mutations against the lock go red. The fifth -- dropping `!open` from the refresh guard -- does not, because freigeben() already nulls the ref the interval checks. The condition stays as the readable statement of intent, now with a comment saying so. Not run against a live database here; the CI migration job is the first real execution. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| eeaf210e78 |
Let the same choice open notes and drafts
The picker in the bell now governs both lists, so note_subscriptions is renamed to colleague_subscriptions -- a name that only mentions notes would mislead the next reader. Reading and writing a draft now reach differently far. hire_drafts_owner (for all) is split into four policies: select lets in your own drafts and those of the people you added, while insert/update/delete stay with the owner. A draft is unfinished work with no lock and no history; two people writing into the same row would overwrite each other silently. That split forces a change in the actions: a policy does not reject a write, it lets it hit no rows. saveHireDraft and deleteHireDraft now read the row count instead of reporting success over a row that never changed. The card shows a foreign draft with its author and without Fortsetzen or Loeschen -- offering a button that reliably ends in a database error is a promise without cover. check-schema-types.mjs learns `alter table ... rename to`; without it the drift check reports one rename as two errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| e8e675fd07 |
Turn the note filter around: yours by default, colleagues added
Yesterday's version had it the other way — everyone visible, untick to
hide. The decision from the business side is the opposite: you see your
own notes, and you tick the colleagues you also want. So note_mutes
becomes note_subscriptions and the predicate flips from `not exists` to
`exists`.
The existing rows are not carried over. The meaning inverts rather than
the sign: converting faithfully ("everyone except the muted") would write
almost the whole roster into the new table and reproduce exactly the state
the change is meant to end. Anyone opening the setting tomorrow would
think it had not taken effect. The table is a day old; what is lost is a
few ticks from trying it out.
What this costs is worth saying plainly: the silent case that could not
happen under exceptions can happen now. Do not tick a colleague and you
will not see her follow-ups — not while she is on holiday either. That is
the flip side of the decision, and it is written down in the migration
rather than discovered later.
Each note now says who wrote it. Own notes read "von mir" rather than
repeating your own name, which would sit on every second line and tell
nobody anything. The flag is computed on the server: the user id is
already there, and threading it through four components for one word is a
poor trade. The counter on the button follows the same turn — "+2" for
what you added, nothing when you added nothing.
Verified: 21 tests, five mutation-checked (restoring `not exists`,
dropping the own-notes clause, inverting the default, hiding the author,
and printing your own name instead of "von mir" each turn them red). 489
tests, typecheck, lint, schema drift and build clean. The migration is
reviewed but not run — no reachable database here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|||
| 99b1df9735 |
Choose whose notes reach your bell
The bell is a shared pile: every active HR person sees every open note, regardless of who wrote it. That was agreed and it stays the default — this narrows it, it never widens it. You can now untick colleagues whose notes you do not want to see. What gets stored is the *exceptions*, not the selection. The difference shows the day someone new joins HR: had the selection been stored, she would be invisible to everyone until each person ticked her, and nobody would notice her follow-ups piling up. This way she is visible from day one and hiding her is a deliberate act. Same reasoning that made notes a shared inbox in the first place — the silent gap is worse than a row too many. Own notes always come through: `note_mutes` rejects a self-reference, and the predicate says so again rather than depending on a check constraint staying put. Notes with no author come through too — hiding one because nobody knows who wrote it is exactly the loss this list exists to prevent. The rule lives in lib/notes.ts as one SQL expression because two places need it: the bell in the header and the "Anstehend" card on the dashboard. Two copies drift, and then the card counts something the bell does not show. No SQL function and no audit row, unlike anything that touches employee data — this is a personal display preference, and an audit trail recording every tick would make finding real changes harder. Same pattern as saved reports and hire drafts, and the owner policy on note_mutes means a row for someone else cannot be written even with invented values. The checkbox flips immediately and flips back if saving fails; the list gets clicked through several at a time and a round trip per tick feels like hesitation. Verified: 19 tests, five mutation-checked (or→and, dropping the own-notes clause, inverting `not exists`, inverting the default, and losing the email fallback each turn them red). Typecheck, lint, schema drift, 477 tests and the build are clean. Not seen in a browser: login goes through the company account and the database is unreachable — the migration is reviewed but has not been run. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| c6cff9656e | Passwort-Anmeldung: Provider, Formulare, drei Zustaende der Shell | |||
| b87c8ad64c |
Remove Supabase
The database moved to a container of our own; the platform is gone. This takes out what was left of it — and, where the leftovers were load bearing, moves rather than deletes. Moved, not deleted: supabase/migrations/ -> db/migrations/ the schema's source of truth supabase/build-org.ts -> scripts/build-org.ts lib/supabase/types.ts -> lib/types.ts 52 import sites repointed The bookkeeping needed care. It lived in `supabase_migrations.schema_migrations`, and simply renaming the schema would have left the runner facing an empty table: it would have called all 67 migrations pending and replayed them against a database that is long since current. So the runner now creates `migrationen.schema_migrations` and, once, copies the old rows across — guarded so a second run does nothing and a fresh database skips it entirely. Only then does migration 20260907100000 drop the old schema. Deleted: the CLI config, the seed, the historical schema/function dumps (nothing read them), scripts/umzug-von-supabase.sh (the move is done), and both Supabase packages plus the CLI. Nothing in the application imported them — the build now succeeds with no environment variables at all, which is the proof. Integration tests: six of them signed in through Supabase Auth and asserted against the anon key and the service role. That model is gone, so the tests were not portable — they are deleted. session-context and employee-status-filter already ran on pg and are untouched; om-reporting is ported to a direct connection because it guards a real risk (the reporting line rule exists twice, once in SQL and once in TypeScript). CI: the integration job started a Supabase stack. It now runs a postgres service, applies deploy/db-init and every migration to an empty database — that was the valuable part, and it still holds — then checks that a second run is a no-op, which is what proves the bookkeeping works. Docs: security-review.md audited a service-role key, a cookie adapter and auth.users, none of which exist. Restating findings about removed components would suggest today's system had been reviewed; it has not. It now records what was removed and says a fresh review is due. data-model.md was already marked obsolete and described the pre-OM schema; azure-migration.md was a plan for a route not taken. Both deleted. Verified: npm ci, typecheck, lint, 445 tests, build — all clean without the packages. Integration tests skip cleanly with no database. Migration SQL and the runner are reviewed but NOT executed: no Docker here, and the old instance no longer resolves. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| f85731dde5 |
Give exits their own checklist, next to the entry one
The offboarding list was a checkbox fieldset inside the exit panel — four items, never sent anywhere. Nothing in terminateEmployee's payload carried them; ticking a box there recorded exactly nothing. It's replaced with the same kind of list the entries got: its own tab, appearing the moment an exit is recorded, with one item per row, a comment on each, and — unlike the fieldset — a record of who touched it and when. The eleven items come from the same printed sheet as the entry list. Nine are plain checkboxes. Two are text fields under "Vermerke": remaining vacation and the balance transferred for payout — the sheet names "Überleitung Salden für Auszahlung" twice, once as a task to do and once as the actual figure, and those are genuinely two different questions, kept as two items. Where the sheet still says "GKK" rather than today's "ÖGK", it's left as written — that's the name the process runs under internally, not a typo. No Show gets no list. Never having worked a single day, there's no IT access to revoke, no GKK registration to undo, no Dienstzettel to collect — an empty checklist there would be a label with nothing behind it. Both the tab and the auto-creation on exit check for this specifically, not just the "Ausgetreten" status that No Show shares with a real exit. Rehiring the same person hides the tab again — the data stays, since it happened, but a checklist for someone currently working has nothing to point at. The engine (what counts as done, how progress is computed) moved into lib/checklist.ts so onboarding and offboarding can't drift into two different ideas of "done" the way two independent copies eventually do; lib/onboarding.ts and lib/offboarding.ts bind it to their own item list, and the tab UI is a single ChecklistPanel bound the same way. Checked against the real database: a real exit creates all eleven items in the same transaction as the exit itself; a No Show creates none; rehiring flips the tab off while the old answers stay queryable. One false alarm during that check turned out to be the user's own clicks on a real employee's onboarding list, made in the browser while trying the earlier feature — left untouched, not test debris. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| 82d07f0d95 |
Put the onboarding checklist where the file is
The list existed on paper: one printed sheet per entry, twenty-five
boxes. What is on it is known only to whoever holds the sheet — it
cannot be searched, cannot be covered for while someone is away, and
says nothing about who ticked what.
Not every box on the sheet is a checkbox, and the differences carry
meaning, so the field kind is derived from the thing rather than
flattened:
Haken — the normal case. The Meldezettel is there or it is not.
Ja/Nein — Prämienanspruch had *two* boxes on the sheet, and that is
not decoration: "nein" is a finding, "not asked yet" is not.
One checkbox cannot say both.
Text — shoe, shirt and trouser size. The value is the point;
ticked off it would be worthless.
Every item takes a comment, and every item records who last touched it
and when — the part the sheet could never do.
Saved on click, not on submit. A checklist is worked through over days,
between other things; a save button at the end is where half a morning
goes missing.
The items live in lib/onboarding.ts, not in a table: a checklist is a
company process, not a master record. Stored per person is only the
answer, under the item's key — so an item dropped later leaves its old
answers standing instead of taking them along, and a file from back then
stays readable.
A list is created by hire and rehire, in the same transaction as the
hire itself: a hire without a checklist would be a half-recorded hire.
Rehire only adds what is missing and never clears an old tick — what
genuinely has to be redone is HR's call, and a program deciding it would
be guessing. People hired before this feature have no list and get a
button to start one.
Checked against the real database end to end: hire creates 25 open
items; checkbox, ja/nein, size and comment all land; a comment-only edit
leaves the tick alone; rehire tops the list up and keeps what was done.
The probe employee was removed afterwards — audit rows first, since the
log has no delete policy.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|||
| e30923e781 |
Give a position a cost centre
There was none anywhere in the model, so no personnel-cost figure could be produced at all, and an open position could not say whose budget it would charge — which is the first question asked about a vacancy. It hangs on the position, not on the person: the seat costs money even when nobody sits on it. That is exactly the vacancy case. And not on the org unit either, although it usually follows from one — a single seat can be charged elsewhere (project, shared function) without the unit moving. As its own dated assignment table rather than a column, because reassigning is an event with a date. Last year's costs have to stay where they were incurred; as a column, every change would silently rewrite every past report. Half-open [valid_from, valid_to), like position_assignments and om_positions — in SAP OM this is A011. 25 cost centres seeded from the org tree: one per company, division and department, with teams charging to their department, because a team is a span of control and not a budget. All 823 positions were assigned from their own start date, none left over. The number is the first five digits of the org number, so it can be traced rather than looked up. Reassignment refuses three things, each checked: the same cost centre again, a switch on the day the current one started (that period would never have been in force, and the range constraint says so), and a date before the position exists. Verified against the real data, which turned up a defect worth keeping: a position that starts in the future is charged only from its start, so asked about today it had no cost centre — and future positions are exactly what the vacancy list is for. It is now read at the position's own start date. Two audit entries from the probe could not be deleted through the application (the log has no delete policy — correctly), so I removed them with the admin connection. Still open, and the reason this is only the first of the three fields I proposed: location and planned FTE. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| f5ace8af2e |
Make the part-time arrangement a state you can report on
Last step moved the four part-time arrangements out of the absence list and recorded the reason in the history text. That answered "what happened" but not "who is in one right now", and the profile showed nothing at all. So it becomes a real field: teilzeit_art, with an optional end date. The objection I raised then still holds — a state goes stale, because nobody goes back to note when a Bildungsteilzeit ended. teilzeit_bis is the answer to it: with an end date a report decides for itself what is still running instead of trusting that someone maintained the row. Left empty it means "open end", which is an honest thing to say. It runs through the ordinary change machinery rather than beside it. It sits in app_feld_karte, so it shows up in the history as a field with before and after, and can be corrected there like any other. The description suffix from last step is gone — writing the same thing twice is how two versions start disagreeing. Reporting: filter by variant, by "in one at all", and by when it ends; group headcount by variant, where the absence of one reads "Keine" rather than a dash, because in a report that is an answer and not a gap. Plus columns in the export and the import. One gap found while rehearsing, and only because the probe happened to pick a return date in the future: a scheduled return carries its payload through pending_org_changes, and that payload did not include the variant. Someone would have come back on reduced hours in April with the reason gone. The daily run now carries it too. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| e6554e7982 |
Move the part-time arrangements out of the absence list
Bildungsteilzeit, Elternteilzeit, Pflegeteilzeit and Wiedereingliederungsteilzeit were offered as kinds of long-term absence. Recorded that way, the person counted as absent: they dropped out of headcount, their reporting line fell to a stand-in, and reports stopped counting them — while they were in the building every week, just for fewer hours. A part-time arrangement is not an absence; it is a change of hours. They now sit where they belong. Wiedereingliederungs- and Elternteilzeit appear when recording a return from absence, as the reason someone comes back on reduced hours — both typically begin exactly when the absence ends. Bildungs- and Pflegeteilzeit appear under "Daten ändern" beside the hours, next to the ordinary contractual change. The reason is recorded with the change, not as a state on the person. A state would have to be maintained, and nobody goes back to note when a Bildungsteilzeit ended; a field that quietly goes stale is worse than none. In the history it stands next to the value it explains, and stays readable for good. The check constraint on absence_type is deliberately untouched. Three people carry the old values right now — two Pflegeteilzeit, one Wiedereingliederungsteilzeit. Forbidding them would make existing rows illegal. They are gone from the list of choices; the history stays readable. Those three are worth revisiting, but that is a data decision, not a code one. Rehearsed against real data: an hours change with a reason and one without, a reduced return with a reason and an unchanged one — checked by reading both new history rows rather than "the latest", since now() stands still inside a transaction and made an earlier probe report a false negative. I also overwrote tests/unit/absence.test.ts instead of extending it. The original cases are restored; the diff is 49 added lines and 3 changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| 6681dcda77 |
Flag people who cannot simply be dismissed
Works council members, expectant mothers, parents on leave, registered disabled employees, apprentices — each has its own rules that come before a dismissal. The tool does not judge whether one is lawful, but it must not stay quiet about it either, and looking it up on the contract tab is exactly the step that gets skipped under time pressure. So: a checkbox, an optional end date, and a red warning at the top of the termination panel naming the date — or saying plainly that no end was recorded. It shows for a no-show too; the protection runs from the start of the contract, not the first day worked. The date is optional on purpose. A works council mandate has a known end, a pregnancy does not, and a mandatory field would force an invented number. A constraint says only what cannot be: an end date without the flag, which would be a leftover nobody could interpret. The field goes the whole way through — hire, data change, contract sheet, export, report criteria (as a yes/no and as a date range), and the import. A field that exists in one screen and not the next is how people stop trusting the numbers. Terminating is now offered for planned entries as well, labelled "Nicht angetreten", with No Show preselected. Without it a person who never turned up stayed a planned entry forever, since nothing else can end one. One finding worth recording: tsc has been reporting success on a broken program. A generated file under .next got corrupted when a build ran against a live dev server, and its syntax errors suppressed semantic checking everywhere else — two genuine type errors in this change went unreported until I typechecked with .next excluded. The file is removed and the ordinary typecheck is meaningful again. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| 08d2740690 |
Let planned changes be taken back and corrected too
Deleting and correcting a history entry stopped at the present: anything not yet effective stayed put. That was not a principle, it was a missing link. A planned change lives as a payload in pending_org_changes, and nothing tied it to the history row — only a person and a date, and the data already holds an Eintritt and a Vertragsänderung sharing one. So employee_history now carries pending_id, set by change_employee_data when it schedules something. One planned change can carry two history rows: Stammdaten and Vertrag are kept apart but scheduled together. Taking one back therefore strips only that group's fields from the payload, and cancels the operation only when nothing is left. Correcting one rewrites its group and the effective date, and touches no employee data — the change has not happened yet. An entry stays on its side of the present. Pulling a planned change into today, or pushing an effective one into the future, would mean adjusting the employee record and the pending payload in opposite directions; that is what the real operations are for. Existing rows were linked where exactly one running operation matched the person and date and no other row had claimed it. All five of them matched. Anything ambiguous would have kept the old refusal, which now says the actual reason. The edit dialog surfaced a bug in useDialogFocus that predates it: the effect depended on the identity of onClose, which almost every caller rebuilds on render, so it re-ran after each keystroke and its cleanup pulled focus back to whatever opened the dialog. Any dialog with a text field would have accepted one character. It never showed because until now no dialog kept its own state next to its own onClose. Rehearsed against real data: a two-row planned change corrected, one row taken back with the operation continuing on the rest, the second taken back with the operation cancelled, and both refusals. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| 6297288c13 |
Let an entry be taken back, along with what it did
HR can now delete a history entry, but only where deleting one is an honest thing to do — and deleting it also undoes it. The rule they asked for is the interesting part: the last valid change wins. Deleting an entry walks its fields one at a time. If a later entry touched the same field, the current value stays — that later change is the one in force. Otherwise the field goes back to what the deleted entry recorded as its "before". So the middle of three entries can be removed without an old value overwriting a newer one. Four kinds of entry refuse to be deleted, each saying why in the place the button would have been. Eintritt anchors the timeline. Transfers, promotions, absences and exits moved positions and status — they have proper operations for that, and guessing backwards is how you corrupt an org chart. Anything not yet effective hangs off a planned change, and that link is not trustworthy: there is no key between a history row and its pending row, only a person and a date, and the data already has an Eintritt and a Vertragsänderung sharing one. Matching on the date would eventually cancel a change nobody meant. And entries from before the history carried values have nothing to fall back to. Confirmation is not "are you sure" — that question gets a reflex yes by the third time. The dialog says what will be different afterwards: which field goes back to which value, and which one stays because something later claimed it. employee_history keeps its append-only policies; delete_history_entry is SECURITY DEFINER and checks the permission itself in its first line. The audit log keeps the deletion with the values that were removed, and the audit log genuinely cannot be edited. The rule lives twice — in SQL and in lib/history.ts. The database is the authority; the copy exists so the UI can hide a button that would fail and print the reason instead. Rehearsed against real data in a rolled-back transaction first: the later change held, the untouched field reverted, all four refusals fired. Also corrected in the data catalogue: I had written that require_hr_admin was called by nothing. It guards all sixteen mutating functions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| c23df08648 |
Ask for the optional things separately, and stop claiming numbers are issued
A round of interface corrections from use, plus one schema change behind them. The private email address is now optional. It was NOT NULL — the wrong default for a private detail: someone without one had to invent one, and invented data in a personnel file is worse than missing data. Both fields are relabelled to say whose they are, "Private E-Mail" and "Private Telefonnummer", because the company address does not exist until the person starts. Uniqueness stays; several NULLs coexist in a Postgres unique index, which is exactly what is wanted. The summary step still promised that "Personalnummer und Firmen-E-Mail-Adresse werden automatisch vergeben". Neither is true any more. Removed rather than reworded — the step lists what was entered, and a banner claiming otherwise is worse than no banner. Dependents move into the wizard as step three, optional. They can only be attached after the hire, because add_employee_dependent needs an id that does not exist while the form is open, so they are collected in the draft and written afterwards. That puts them outside the transaction the person is created in: if one fails the person still exists, so the message names who is missing instead of failing silently, and the SV number is checked in the step rather than after. The emergency contact gets its own step, second to last, and its relationship is a dropdown of the common ones rather than free text — otherwise "Gattin", "Ehefrau" and "Frau" end up side by side and nothing can be counted. "Sonstige" is there because a closed list would otherwise be presumptuous. On the master-data tab it now sits below the dependents rather than above: both are people around the employee, and this is the one you reach for in a hurry. Returning from a long absence: the choice read "unverändert", which made you open the file to find out what you were agreeing to. It now reads "Wie vor Abwesenheit (38,5 h)" with the hours actually worked, and the alternative is "Reduziert" — whose hours field starts empty on purpose. A number already filled in gets confirmed rather than read off the agreement it comes from. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |
|||
| 9d754359e0 |
Enter the personnel number, tell the two kinds of company car apart, record who to call
Three requests from use, one of which changes the schema's mind about
something.
The personnel number is no longer issued. It was GENERATED ALWAYS AS
IDENTITY, which refuses a supplied value outright — but it has to match Loga
and Interflex, and a number this application invents is unknown there, so the
same person ends up with two. Identity dropped, entered everywhere instead:
in the wizard, in the import, and validated against a duplicate with a
message that names the number.
Worth stating plainly: the column had no unique constraint. The identity
prevented collisions as a side effect, and once the value comes from outside
that side effect is gone. The constraint is the point now, and it was
missing.
Company cars distinguish Verbrenner from Elektro, tied to has_dienstwagen by
a CHECK so "E-KFZ" cannot appear against someone without a car. The list
filters on it — with, without, only electric, only combustion — which is the
question the report was really about; it was answerable before only through
an export and manual work.
Emergency contact is name, phone and relationship. Relationship stays free
text: the examples given — Gattin/Gatte, Schwester/Bruder, Freund — are not
a list that closes without telling someone their arrangement does not count.
Name and phone are all-or-nothing, in the database and in both forms: a name
without a number helps nobody, a number without a name does not say who
answers.
Two mistakes of mine on the way, both caught by checks I had written into
the migrations rather than by me:
- The first CHECK on the car type would have permitted exactly the case it
was written against. `art in (…)` yields NULL rather than false when the
column is null, and a CHECK counts NULL as satisfied. It needs an
explicit `is not null` in front.
- The constraint was added before the backfill, so it rejected every
existing row with a car.
Existing cars are recorded as Verbrenner, which is an assumption — but a
visible one: "Elektro" appears nowhere nobody confirmed it.
hire_employee and change_employee_data both had to learn the new columns.
They name their columns one by one, and what is missing there is dropped in
silence — the interface would have collected the fields and thrown them
away, which is what happened to the email address this morning.
Verified against the live database, all rolled back: a hire without a number
is refused, a duplicate is refused naming it, a freely chosen one goes
through; E-KFZ plus contact arrive intact; a contact without a phone is
refused. A change records both, with before and after in the audit detail.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|||
| f28fd2da60 |
Let a rehire choose the position, and make it work at all
Clicking "Wiedereinstellen" could never succeed. rehire_employee has always
demanded a position and refuses without one, but the panel offered only a
date and sent only a date — so every rehire ended on an error the dialog
gave no way to fix.
The panel now picks from the open positions, the same list and layout the
transfer panel uses, and warns before submitting when the date falls outside
the chosen position's validity. The old position is deliberately not a
silent default: it may since have been filled, ended, or gone.
Behind that sat a second fault, hidden by the first: the status assignment
status = case when v_date <= current_date then 'Aktiv' else 'Geplant' end
is text, and the column is employment_status. Postgres refuses that outright,
so the function would have failed even with a position. It surfaced only once
the earlier check stopped firing — the same pattern as hire_employee this
morning, where three faults sat in a queue.
rehire_employee also placed people without checking anything. It now applies
the rule from 20260810100000: the date must lie in the position's validity,
and no assignment may still stand. A rehire could otherwise land on an
occupied position and be caught by the partial index, with a message that
explains nothing.
My first verification of the cast was wrong and passed a broken state:
plpgsql converts silently when assigning to a variable, so the probe proved
nothing. Redone as an UPDATE against a column, which is the case that fails.
Verified end to end against the live database, rolled back: Stefan Egger
returns as Aktiv on a free position, with the assignment and the
Wiedereintritt entry. Without a position, on an occupied one, and on one not
yet valid, it is refused — each with its own message.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|||
| a87c688c0a |
Show positions that do not exist yet, and let them be corrected
Two gaps in the positions view, both reported from use.
A position dated into the future was invisible. loadOpenPositions required
valid_from <= today, so a position decided now and effective at the quarter
boundary appeared nowhere until the day it began. The database already held
one — 60000824 "Neue Position", effective 01.09. — created through the
application and shown on no screen since.
Future positions now have their own section rather than joining the vacancy
list. They are a different statement: "nobody is here" and "this does not
exist yet" should not be counted together, and a position starting 01.10.
read as a vacancy nobody was filling.
Positions could only be created and deleted. Fixing a typo in the job title
meant deleting and recreating — with a new position number, which appears in
job postings, budgets and audit entries, and whose trail then breaks.
update_position keeps the number and records old and new values per field,
using the audit detail added earlier today.
Three things it refuses, as guards rather than remarks:
- Moving an occupied position to another unit. That is a transfer, with
history and reporting line, and belongs to the person — otherwise
someone changes department silently.
- Ending an occupied position, which would leave an assignment without
one.
- A second chief position in a unit, or an end before the start.
Verified against the live database, all rolled back: each guard fires with
its own message, the permitted edits go through, the audit entry carries the
changed fields. Open positions stay at 9 and the future one now appears in
its own section.
ESLint caught me priming the dialog's fields from an effect. Replaced by a
key on the component, so React rebuilds it per position and the fields
initialise from props — which also removes the flash of the previous
position's values on second open.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|||
| e44f71a60d |
Stop offering positions that are already spoken for, and let hiring work again
Two reports, four defects, all of them in the way of ordinary use.
A position with a signed starter is not vacant. loadOpenPositions asked "is
anyone on it today?", so three positions whose new holders begin in
September and October were listed as open, labelled "vacant for 2 days".
That same list feeds the hire wizard, so it invited filling a position a
second time — discovered at the partial unique index, after the second
interview. Vacancy now means no assignment that still stands, including one
that has not started. An assignment that ended still frees the position.
Hiring was broken three times over, each fault hidden behind the previous
one:
1. hire_employee cast to ::weekday[], a type that no longer exists — it
was replaced by text plus a CHECK constraint and the function was never
updated. apply_due_pending_changes had the same problem with
::relationship_type, which would have broken the nightly run.
PL/pgSQL resolves types in embedded statements at execution time, so
both functions were created without complaint and failed only in use.
2. Fourteen functions called auth.uid(). The application connects as a
role with no rights on the auth schema, so every write — hire,
transfer, promote, exit, notes, positions — failed with "permission
denied for schema auth". They now use app_current_user_id(), which is
where #23 was heading anyway. Its own fallback also caught only
"function missing" and now catches the privilege error too, so a call
without session context returns null instead of raising.
3. The audit line built a name as `payload->>'a' || ' ' || payload->>'b'`.
`||` binds tighter than `->>`, so Postgres reads
`payload ->> ('a' || ' ' || payload) ->> 'b'`. The ACL failure above
had aborted analysis before the parser ever reached it.
And the wizard collected an email, showed it in the summary, and dropped it:
the server action's signature had no such field. employees.email is NOT
NULL, so every hire that got past the three faults above would have failed
there. It is now passed through and required in step one, rather than
refused by the database at the end of step four.
Verified against the live database, each rolled back: a hire now creates the
employee, the assignment, the history entry and an audit line reading "Probe
Einstellung"; open positions drop from 13 to 10, and the three that
disappear are exactly the ones with a starter.
Migrations rewrite the affected functions in place rather than restating
them — retyping 165 lines of working PL/pgSQL to change two words is the
larger risk. Each one asserts the result afterwards.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|||
| 2ba9b37aa7 |
Hand the front door to Entra, and keep the keys out of the build
Auth.js replaces GoTrue. The sign-in still goes to the same Entra tenant,
but nothing sits between the app and the identity provider any more — the
code exchange, state, nonce and the session cookie are ours.
lib/auth/session.ts stays the only place that knows where a user id comes
from, which is why this was one file and not fifty. What it returns is now
app_users.id. app_upsert_user() maps the Entra `oid` onto it, and for an
address that already has a profiles row it adopts that id instead of
minting a new one — otherwise everyone would have been signed in and cut
off from their own notes, drafts and audit trail at the same time.
That upsert is the one write that cannot have a session context yet: the
id is what it produces. It runs as a SECURITY DEFINER function that may
touch app_users and nothing else, which is a far smaller lever than the
service key that used to answer this class of problem.
The proxy no longer checks HR rights. It has no database connection, and
putting role/is_active in the token would have frozen the claim until the
next sign-in. The check moved to where it can read the current truth: the
app layout on every render, requireHrUser() for the export routes, and
underneath both, RLS.
Two things only came out by running it:
- `export const proxy = auth(…)` is not a function declaration, so
Next.js never found it and every request 404'd. `next build` reported
success and listed the proxy. In the function config form auth() also
returns the handler as a promise, so it needs an await. The proxy test
now mocks it as a promise for that reason — a friendlier mock would
let the same bug back in.
- A missing AUTH_MICROSOFT_ENTRA_ID_ISSUER silently falls back to
/common/, and the redirect really did go there. That would let any
Microsoft account sign in, including a private one, and it would never
look broken. It now refuses to start in production.
Neither build nor image needs credentials any more: the pool is created on
first use, the auth config is evaluated per request, and there are no
NEXT_PUBLIC_* values left to bake in. One image now runs in every
environment.
Verified: typecheck, lint, 187 tests, build, and by hand in the browser —
/employees redirects to /login, and the sign-in button reaches the Entra
page with PKCE and the callback URL that goes into the app registration.
Not verified against a real database; there is still no DATABASE_URL.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|