Entfernt die Anmeldung mit Passwort restlos: Anbieter in auth.ts,
Server Actions, Anmeldeformular und Passwortwechsel-Seite, die Umleitung im
Layout, den Status passwort_wechseln, die Typen, und die beiden
Migrationen 20260908120000 und 20260908140000. Die dort ebenfalls
angelegten Funktionen app_zugang_setzen und app_benutzer_liste hatten
keine Oberflaeche; der HR-Zugang wird ueber freischalten.ps1 vergeben.
20261014120000_anmeldung_nur_ueber_entra.sql entfernt die Objekte aus
einer Datenbank, die sie noch enthaelt, und setzt is_hr_user() auf die
Fassung ohne Passwortbezug. Auf einer neuen Installation bewirkt sie
nichts.
Zusatz-Branch fuer den Uebergabestand (uebergabe/README.md): bleibt ein
einzelner Commit auf master, bis der Testbetrieb die Passwortanmeldung
nicht mehr braucht; danach in master mergen.
Geprueft: frische Installation (113 Migrationen, zweiter Lauf leer,
rauchtest und vertragsangaben bestanden, keine Passwortobjekte) und
Upgrade einer master-Datenbank (Passwortobjekte entfernt, is_hr_user ohne
Passwortbezug); lint, tsc, types:check, 823 Unit-Tests, Waechter.
Mit TESTSYSTEM=1 haengt oben mittig auf jeder Seite, auch auf der
Anmeldeseite, ein Schriftzug "Testsystem", und der Titel im Browser-Tab
beginnt mit "[Testsystem]". Ohne den Eintrag erscheint nichts; gelesen
wird zur Laufzeit, dasselbe Paket laeuft in Test und Produktion.
Der Schriftzug ist klickdurchlaessig und erscheint nicht auf Ausdrucken.
Die Checkliste setzt ihren Titel absolut, er dient beim Drucken als
Dateiname.
Neue Variable in .env.example, app.env.vorlage, README und DEPLOYMENT.md.
Kein Geheimnis, daher nicht in der Tabelle im Sicherheitskonzept.
Geprueft: lint, tsc, types:check, npm test (neuer Test testsystem),
waechter.
- Betriebshandbuch und Installationsanleitung: Download des Assets alpenwerk-hr-<version>.zip,
Tabelle deploy\windows / Paket\windows / C:\AlpenwerkHR\windows, Update in Schritten
- Abschnitt 'Passwort des Datenbankverwalters' mit Dialog, Meldungen und Kontrolle
- installieren.ps1/aktualisieren.ps1 erkennen den Quellcode und verweisen auf das Release-Zip
- verwalterpasswort.ps1 entfernt ein Passwort aus verwaltung.env erst nach erfolgreicher Pruefung
- verwaltung.env ohne Passwort, Passwort in verwaltung.passwort (DPAPI, LocalMachine,
nur Administratoren und SYSTEM), an psql/pg_dump/Node nur per PGPASSWORD
- aktualisieren.ps1 uebernimmt ein Passwort aus verwaltung.env automatisch
- neues verwalterpasswort.ps1; installieren.ps1 fragt das Passwort ab
- Nachtlauf als SYSTEM, LocalService ohne Zugriff auf app.env
- aktualisieren.ps1 kopiert die Betriebsskripte zuerst und richtet die geplanten Aufgaben neu ein
- sicherung.ps1 und nachtlauf.ps1 mit festem Ziel C:\AlpenwerkHR
- Betriebshandbuch: vollstaendige Pfade, Tabelle welche Datei welches Skript liest
Fachlich vorgegeben:
- Honestly: ImportId ist die Personalnummer, ReportsToId die der
Fuehrungskraft.
- LOLYO: Benutzername ist die Personalnummer, Passwort das Geburtsdatum
als TT.MM.JJJJ. LOLYO_STARTPASSWORT ist das Ersatzpasswort fuer Personen
ohne Geburtsdatum; fehlt es und hat jemand in der Auswahl kein
Geburtsdatum, lehnt der Export mit der Anzahl ab, statt Konten ohne
Passwort anzulegen.
README, .env.example, app.env.vorlage beschreiben die neue Bedeutung.
Geprueft: lint, tsc, 1031 Tests, Waechter.
- pdf-bauen.mjs legt die PDFs in docs/ ab; windows-paket.mjs kopiert sie in
den Hauptordner des Pakets
- aktualisieren.ps1: Versionszeilen als Zeichenketten, sonst schrieb
ConvertTo-Json die Eigenschaften von Get-Content mit (PSPath usw.) und
zuruecksetzen.ps1 schriebe sie zurueck in VERSION.txt
- Anwendung laeuft im IIS ueber HttpPlatformHandler statt als NSSM-Dienst;
App-Pool-Identitaet oder eigenes Konto, kein lokaler Admin
- Zertifikat aus dem Zertifikatsspeicher (Auto-Enrollment), automatische
Neubindung bei Erneuerung per geplanter Aufgabe
- aktualisieren.ps1 -Paket <zip>, letztes-update.json; neu zuruecksetzen.ps1
(nur Anwendung oder mit Datenbank aus der Sicherung)
- konfiguration-anwenden.ps1 ersetzt dienst-umgebung.ps1, iis-einrichten.ps1
geht in installieren.ps1 auf
- Zugang ueber freigegebene Domains (zugang_domaenen, profiles.zugang_quelle),
Einzelsperre hat Vorrang; freischalten.ps1 -Domain / -Anzeigen
- Release-Workflow bei Tag v*, Paketversion aus package.json bzw. Tag
- Betriebshandbuch deploy/windows/README.md neu und knapp
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.
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.
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.
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>
It was never used. The repository lives on a self-hosted Gitea, which
Vercel's git integration cannot connect to at all — so the documented
route amounted to "mirror to GitHub first", and nobody did.
vercel.json is gone, and with it the branch in next.config.ts that
switched off `output: "standalone"` when the VERCEL variable was
present. That branch was the only functional trace; everything else was
documentation and comments describing a second deployment path that did
not exist.
DEPLOYMENT.md loses its "two supported ways" framing and the whole
Vercel section — about fifty lines. Several statements next to it were
stale for a different reason and are corrected in the same pass: the
outbound-firewall table still listed Supabase's pooler (the database is
a container now, nothing leaves the server), the prerequisites still
demanded an existing Supabase project, and the .env table still asked
for a pooler connection string instead of the two new passwords.
The nightly job is described as what it is — a container in
docker-compose.yml — rather than as a replacement for Vercel Cron.
Migrations keep their references: two comments from July mention Vercel
Cron, and they describe what was true when they were written.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The one document describing the schema, docs/data-model.md, predates two
rebuilds. It names divisions/departments/teams and a positions table that
no longer exist, describes Supabase auth with an anon key and a service
role that were removed, and puts the policy count at 58 when it is 21.
Anyone reading it to understand the data would have been misled on every
count.
docs/datenkatalog.md replaces it, and was not typed up from memory: the
columns, defaults, keys and check constraints were read out of
information_schema and pg_catalog on the running database. Fifteen
tables, 142 columns, ten enum types, 21 policies. Where a rule appears in
prose, the constraint it comes from is named next to it.
Some of it only became visible by asking the database rather than the
migrations. generate_company_email and the is_hr_admin pair are still
defined but nothing calls them any more. Position numbers look like a
six followed by seven digits because the generator builds them that way,
not because anything enforces it — the column requires only uniqueness.
monthly_salary_gross is dead weight kept in case old rows hold data.
Three claims I drafted were wrong and the database said so: the position
number format, the event trigger's name (ensure_rls, the function behind
it is rls_auto_enable), and which tables deviate from the plain
is_hr_user() policy.
The old document keeps a pointer at the top instead of being deleted —
it is linked from the security review, and a stale document that says so
is more useful than a dead link.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
- Removed CLAUDE.md, AGENTS.md and NEXTJS_REBUILD_SUPERPROMPT.md, and
untracked .claude/ (now ignored locally via .git/info/exclude rather than
.gitignore, so the repo carries no reference to it either).
- The Next.js 16 warning that lived in AGENTS.md is kept where it is
actually useful, in the README tech-stack section.
- Source and migration comments referred to "the consolidation master
prompt" and "NEXTJS_REBUILD_SUPERPROMPT.md" by name; both now read "spec",
keeping the section numbers that made the cross-references worth having.
- README no longer lists Playwright, which is not installed, and now
describes the three test layers that actually exist.
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.