Commit Graph

11 Commits

Author SHA1 Message Date
002472741a Bezeichnungen ohne Gendern in Oberflaeche und Exporten
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m0s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m27s
CI / Ausrollen (push) Successful in 5s
Fachlich vorgegeben: nicht gendern, auch in den Exporten. Gespeichert
bleibt der Wert der Datenbank ("Angestellte:r", "Arbeiter:in",
"Praktikant:in", "Ehepartner:in", "Lebenspartner:in") - er steht in
Aufzaehlungstypen, Pruefbedingungen, der Historie und der Sicht fuer die
IT. Uebersetzt wird nur die Anzeige.

lib/ohne-gendern.ts: eine Regel ueber den Text (":innen", ":in", "e:r",
"e:n"), damit auch Texte aus der Datenbank wie "Angehoerige:r
hinzugefuegt" und Feldnamen der Historie ohne Gendern erscheinen.
Auswahllisten senden weiter den gespeicherten Wert.

Angewendet in Formularen, Historie, Protokoll, Berichten und Filtern,
Mitarbeiter- und Ereignisexport, Importvorlage; der Import nimmt beide
Schreibweisen an. Feste Texte (Menue, Liste, Notizen, Anmeldung)
direkt umformuliert.

Geprueft: lint, tsc, types:check, 885 Tests, Waechter
2026-10-19 12:24:29 +02:00
muena
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.
2026-10-14 09:42:51 +02:00
3a22081595 Geplante Aenderungen stehen jetzt im Audit-Log statt daneben
Auf Wunsch von Max: die Seite bekommt keinen eigenen Eintrag in der
Seitenleiste mehr, sondern ist der zweite Reiter des Audit-Logs unter
/audit/geplant. Beide beantworten dieselbe Frage — was mit den Daten
geschieht —, das Log rueckwaerts, diese Seite vorwaerts.

Die Reiter sind Links und keine tablist: dahinter stehen zwei Adressen,
keine zwei Zustaende einer Seite.
2026-10-13 13:53:02 +02:00
cf5956d375 Eine Seite, die sagt was ansteht, was ausblieb und ob der Lauf noch geht
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 12m27s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m48s
CI / Ausrollen (push) Successful in 7s
Von innerhalb der Anwendung liess sich keine der drei Fragen ueber den
naechtlichen Lauf beantworten: ob er gelaufen ist, was er uebernommen hat,
woran etwas gescheitert ist. Genau deshalb blieb der Totalausfall vom 26.08.
bis zum 13.10.2026 unbemerkt -- sieben Wochen ohne eine einzige wirksam
gewordene datierte Aenderung, und nirgends stand ein Fehler.

Zwei Ergaenzungen in der Datenbank, beide klein:

nachtlauf_protokoll fuehrt eine Zeile je Lauf -- wann, wie viele uebernommen,
wie viele danach noch ueberfaellig. Ohne sie sind "nichts zu tun gehabt" und
"gar nicht gelaufen" von innen nicht zu unterscheiden, und das war der Kern
des Problems. Die zweite Zahl wird nach der Schleife gezaehlt und braucht
deshalb keine neue Variable im Rumpf.

pending_org_changes bekommt letzter_fehler, letzter_versuch und
fehlversuche. Der Fehlschlag steht damit an der Vormerkung selbst und nicht
nur als Fliesstext im Audit-Log: "diese Versetzung geht seit dem 3. Oktober
nicht durch, hier ist die Meldung, zehn Versuche". Der Audit-Eintrag bleibt
daneben bestehen -- er ist fuer die Personalabteilung, die Spalten sind fuer
die Seite, die das abraeumt.

Ergaenzt wird wieder an zwei Ankern der laufenden Definition, mit Nachzaehlen
auf genau ein Vorkommen. Der erste Anker ist der Ausnahmeblock aus
20261013100000 und dadurch eindeutig. Keine Startzeile ins Protokoll: ein
leeres Protokoll heisst "seit dieser Migration ist noch kein Lauf
durchgegangen", und das soll die Seite dann auch sagen.

Die Seite selbst ordnet nach Dringlichkeit, nicht nach Datenmodell -- wer sie
oeffnet, weil etwas nicht passiert ist, findet die Antwort oben: laeuft er
noch, was ist liegengeblieben, was steht an, was hat er getan. Eine
ueberfaellige Zeile ohne vermerkten Fehler wird eigens benannt ("der Lauf hat
diesen Vorgang bisher nicht angefasst") -- das ist der Zustand von August bis
Oktober, und er sieht anders aus als ein Fehlschlag. Die Unterscheidung ist
die halbe Diagnose.

In lib/geplante-aenderungen.ts steht die Logik, die sich ohne Datenbank
pruefen laesst. Die Grenze fuer "ein Lauf ist ausgeblieben" liegt bei 26
Stunden und nicht bei 24: Laufzeit, Uhrendrift und zweimal im Jahr die
Zeitumstellung. Bei 24 stuende die Seite an jedem Maerzsonntag grundlos auf
Alarm, und eine Warnung, die regelmaessig grundlos erscheint, wird nach dem
dritten Mal nicht mehr gelesen.

Der Typ der Zeile wird aus der Abfrage abgeleitet statt danebengeschrieben.
Die von Hand gepflegte Fassung war schon beim ersten Anlauf falsch
(personnel_number ist eine Zahl); abgeleitet kann das nicht entstehen.
2026-10-13 10:42:03 +02:00
8016d317be Das Logo ohne Feld auf Rosa, und kein Schwarz mehr auf der Marke
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m16s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m15s
Zwei Dinge, die beim Ansehen aufgefallen sind.

**Das Rechteck auf dem Panel.** Das Logo bringt sein rosa Feld selbst mit, und
auf der rosa Flaeche stand es als Rechteck in leicht anderem Ton darauf. Der
Ton war dabei derselbe — verschoben hat ihn die Lichtblende, die ueber der
Panelflaeche liegt und unter dem Logo endete.

Das Manual kennt fuer den Schriftzug zwei Faelle, und sie brauchen
verschiedene Dateien: auf Weiss gehoert er nach §4.1 in ein rechteckiges rosa
Feld, in einem grossflaechigen rosa Umfeld dagegen wird er nach §3.1 nur mit
Freiraum integriert — die Flaeche ist ja schon da. Es gibt deshalb jetzt
manner-logo-auf-rosa.svg ohne eigenes Feld, und die rosa Flaechen benutzen es.
Damit bleibt nichts mehr uebrig, wo die Blende enden koennte.

Die Blende selbst ist weg. Sie war Weiss auf Rosa und hellte die Markenfarbe
so weit auf, dass sie kaum noch die Markenfarbe war; geblieben ist ein feines
Raster und eine leichte Tiefe zur unteren Ecke, beides aus ink.

**Schwarz auf der Marke.** "Uebersicht", "Berichte" und der Rest der Kopfzeile
standen in ink. Das traegt zwar (7.47:1), sieht aber aus wie Text, der aus
Versehen auf der Marke gelandet ist. Alles Geschriebene auf Rosa steht jetzt
in brand-700: 6.60:1, und es ist dieselbe Paarung, aus der der Schriftzug
selbst besteht — blaue Lettern auf rosa Feld.

Dabei noch eine Schwaeche gefunden: das Abzeichen an der Glocke kam als
danger-solid auf dem rosa Band nur auf 2.78:1 und blieb unter den 3:1, die
WCAG 1.4.11 fuer ein bedeutungstragendes Element verlangt. Mit danger-text
sind es 3.26:1, und die Ziffer darin steht mit 7.12:1 besser als vorher.

**Und ausgemistet.** Die Logodatei wog 74 kB, weil die Vorlage aus Seite 3 des
Manuals gezogen wurde und die ganze Seite mitgenommen hat: 219 Elemente, die
den Fliesstext jener Seite zeichnen ("Der Manner Schriftzug ... darf nicht
veraendert werden"), unsichtbar rosa auf Rosa oder ausserhalb des Beschnitts.
Das eigentliche Logo sind vier Pfade. Beide Fassungen wiegen jetzt 18,7 kB.

Lint, Typen, Schemaabgleich, 552 Tests und der Build sind sauber. Im Browser
nicht gesehen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 23:44:01 +02:00
3987e8f54f Rosa fuehrt, Blau bedient
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m1s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m1s
Die Flaechenverteilung war verkehrt herum. Blau lag auf dem Groessten, was die
Anmeldeseite zu vergeben hat, und Rosa nur in Andeutungen daneben — bei einer
Marke, deren Schriftzug auf Rosa steht und deren Manual Rosa zuerst nennt.

Sichtbar wurde es am Logo. Es bringt sein rosa Feld selbst mit, weil §1.2 den
Schriftzug nur zur Gaenze auf Rosa zulaesst. Auf einer blauen Flaeche steht
dieses Feld als ausgeschnittenes Rechteck darauf. Auf Weiss ist es dagegen
richtig — §4.1 verlangt fuer weissen Untergrund genau das, ein rechteckiges
rosa Feld. Falsch war also nicht das Logo, sondern die blaue Flaeche darunter.

Rosa bekommen jetzt: das Panel der Anmeldeseite und das Band ueber der
Anwendung aus Kopfzeile und Logokopf der Seitenleiste. Beide zusammen sind ein
durchgehender Streifen, in dem das Logo aufgeht statt darauf zu liegen — was
§3.1 mit "in einem grossflaechigen rosa Umfeld eingebettet" meint.

Blau bleibt, was es ist: Knopf, Link, Fokusring, ausgewaehlter Eintrag. Das ist
dasselbe Verhaeltnis, aus dem der Schriftzug besteht — blaue Lettern auf rosa
Feld — und es ist das einzige, das traegt. Weiss auf Rosa sind 2.18:1.

Auf den rosa Flaechen steht deshalb nichts Weisses und nichts Gedaempftes mehr.
ink kommt auf 7.47:1, brand-700 auf 6.60:1; ink-muted lag bei 2.33:1 und ist
aus Kopfzeile, Glocke und Logokopf verschwunden. Gestuft wird ueber Groesse und
Gewicht statt ueber Transparenz — eine aufgehellte Schrift ist genau das, was
auf dieser Flaeche durchfaellt.

Das Raster auf dem Panel ist von Weiss auf ink gewechselt: auf Rosa war es
nicht mehr zu sehen.

Lint, Typen, Schemaabgleich, 552 Tests und der Build sind sauber. Im Browser
nicht gesehen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:47:26 +02:00
99b1df9735 Choose whose notes reach your bell
Some checks failed
CI / Lint, Typen, Tests, Build (push) Failing after 5m49s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m24s
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>
2026-09-09 20:03:24 +02:00
79f0e19bf8 Org assignment history, mobile support, and a correctness pass
Data model
- employee_assignments records org placement over time (valid_from/valid_to),
  written by a trigger on `employees` rather than inside each RPC: ~70
  `update employees` statements spread over fifteen migrations mean per-call
  bookkeeping would miss paths today and again with every future RPC. A
  partial unique index enforces the one-open-interval invariant the trigger
  relies on when closing the current row.
- The Organigramm gains a Stichtag (default today). Membership comes from
  entry/exit/karenz, past placement from the new history, future placement
  projected from pending_org_changes. Placements predating the migration are
  backfilled with today's values and flagged as such in the UI, since
  employee_history only ever stored free text and cannot be reconstructed.

Correctness
- Reports and exports silently truncated at PostgREST's 1000-row cap
  (db.max_rows); employee_history is already past it at ~800 staff. Every
  whole-table read now pages explicitly.
- XLSX date cells were a day early: ExcelJS converts a Date to an Excel
  serial straight off getTime(), so a Date built at local midnight lands on
  the previous day's serial in any positive-offset zone.
- Date handling is pinned to Europe/Vienna throughout, and date-only strings
  are formatted without a Date round-trip. The dashboard's YTD window was
  built by round-tripping a local Date through toISOString(), which shifted
  it a day early and dropped 31 December entirely.
- Export routes parsed measure/group/split/eventType with unchecked `as`
  casts, so an unknown value reached column headers as `undefined` and the
  Content-Disposition filename. Parsed against the label maps now, with the
  filename slugged as a backstop.
- toXlsx keyed columns by header text, silently dropping the second of any
  two columns sharing a name — split columns take their header from data.
- The org chart tree walks had no cycle guard; nothing in the schema forbids
  a manager_id cycle, and one would hang the tab rather than misreport.
- The login page reflected ?error= verbatim, letting anyone put arbitrary
  text on the real sign-in screen; messages are looked up by code now.
- React Flow needs elementsSelectable on, or it sets pointer-events:none on
  the whole node and the expand control stops responding.

UI
- Mobile: the shell was unusable below lg — a fixed 236px margin pushed
  content off-screen with no mobile navigation at all. The sidebar is now a
  drawer, dvh replaces vh, safe-area insets are honoured, inputs are 16px so
  iOS stops zooming on focus, and form grids stack.
- Org chart nodes redesigned: per-kind accent stripes and icons, vacant
  roles called out, expand control moved to the bottom edge carrying the
  child count.
- Pagination is windowed; it previously rendered one link per page (54 for
  the employee list, unbounded for the audit log).
- Positions page reduced to open positions with a single "Besetzen" action.
- The employee Organisation tab links into the org chart focused on that
  person, reusing the chart's existing search-match highlighting.

Also included, uncommitted until now
- Dependants, HR notes, academic titles, split address fields, position
  validity and role/employment fields, with their migrations and UI.
- Docker/compose deployment setup, data-model and security-review docs.
2026-07-24 23:38:10 +02:00
901c5c426e Consolidation pass: HR-only access, effective-dated mutations, data integrity guards, test suite
Reworks the app from a two-role (hr_admin/manager) model to a single
HR-only role gated by profiles.is_active, fixes transfer/promote/karenz/
reorg RPCs to actually defer future-dated changes via a new
pending_org_changes table instead of writing them immediately (applied
by a daily Vercel Cron route), makes reorg undo append-only instead of
deleting history, adds Karenz-return and history-date integrity guards,
deprecates the salary column, and adds explicit schema grants + perf
indexes needed to run against a fresh (non-hosted) Postgres instance.

Adds vitest unit + integration test suites (the latter against a real
local Supabase instance) covering all of the above, plus lint/typecheck/
build wiring (`npm run check`).
2026-07-14 20:32:20 +02:00
f91a69147e Phase 3: Hire wizard, draft resume, and two real SQL bugfixes
- components/hire/: 4-step Hire Wizard (Person/Position/Vertrag/
  Zusammenfassung) matching sec4.4, with a HireWizardProvider context so it
  can be opened both from the global "+ Neueinstellung" button and from a
  "Fortsetzen" link on a saved draft.
- actions/hireDrafts.ts: save/delete hire_drafts (owner-scoped RLS already
  in place from Phase 1). Dashboard now shows the "Entwuerfe" card the
  Phase 1 plan deferred, since the wizard it depends on now exists.
- lib/positions.ts: shared open-positions loader (position number, org
  breadcrumb, resolved manager name) used by both the wizard and (later)
  the Positions page.

Two real bugs found via live testing and fixed in supabase/functions.sql:
1. hire_employee/rehire_employee: a two-branch CASE returning bare string
   literals defaults to `text`, not the target enum, so `status = case
   when ... then 'Geplant' else 'Aktiv' end` failed against the
   employment_status column. Fixed with an explicit ::employment_status
   cast on the whole CASE expression.
2. Postgres precedence gotcha: ->> and || sit at the *same* precedence
   tier and left-associate, so `payload->>'first_name' || ' ' ||
   payload->>'last_name'` does not group the way it reads - it tries to
   apply ->> to an intermediate text value and fails with "operator does
   not exist: text ->> unknown". Fixed by parenthesizing every ->>'...'
   expression that participates in a || chain.

Also fixed: hire_employee referenced v_position.title outside the branch
that assigns v_position, raising "record not assigned" whenever a hire
wasn't tied to a position_id; extracted a v_job_title variable instead.

Verified live end-to-end: wizard search -> select position -> submit
creates the employee, closes the position, and writes matching
employee_history + audit_log rows atomically.
2026-07-13 22:37:59 +02:00
ef9852b09c Phase 1: project foundation for Alpenwerk HR
Scaffolds the Next.js 16 / TypeScript strict / Tailwind v3 app per
NEXTJS_REBUILD_SUPERPROMPT.md, and implements the Foundation slice from
the Phase 1 plan:

- Corrected Supabase schema (supabase/schema.sql): org units, employees,
  history, positions, hire drafts, saved reports, audit log, reorg
  scenarios, role-based profiles, salary-masking view, RLS policies,
  auto-derivation triggers, position-number generator.
- Seed script (supabase/seed.ts): ~800 realistic Austrian employees across
  9 divisions / 16 departments / 35 teams, history, 8 open positions, and
  hr_admin/manager test accounts.
- Supabase clients (lib/supabase/*), design tokens (tailwind.config.ts),
  format/color helpers (lib/format.ts, lib/colors.ts).
- Shared UI kit (components/ui): Avatar, StatusChip, Toast, Modal,
  SlideOver, SegmentedControl, Lookup.
- Auth (login page, Server Actions) and proxy.ts (Next 16's replacement
  for middleware) guarding the authenticated route group.
- Shell (Sidebar, Topbar, NewHireButton stub) and the Dashboard page,
  reading live data via employees_directory.

Employees list/detail, hire wizard, action panels, org chart, positions,
reports, and audit log are deferred to later phases per the plan.
2026-07-13 21:44:28 +02:00