Jede andere Tabelle in diesem Projekt aktiviert RLS konsequent, auch wenn
(noch) kein Grant an authenticated/anon besteht. auftragsnummer_zaehler
folgte dieser Konvention nicht -- aktuell harmlos, weil der fehlende
Grant den Zugriff schon auf Privilegien-Ebene blockt, aber ohne RLS wuerde
ein spaeter versehentlich ergaenzter Grant (z.B. jemand "behebt" einen
Permission-Fehler naiv per GRANT statt security definer) die Tabelle
sofort komplett offenlegen. RLS ohne Policies faengt das ab (fail closed)
und aendert nichts am bestehenden Verhalten, da die Tabelle ausschliesslich
vom security-definer-Trigger generiere_auftragsnummer() angefasst wird
(Owner-Zugriff umgeht RLS per Default, FORCE ROW LEVEL SECURITY wird
bewusst nicht gesetzt).
security definer + set search_path auf generiere_auftragsnummer()
ergaenzt (Abweichung vom Task-Brief): ohne das schlaegt jeder Insert als
"authenticated" mit "permission denied for table
auftragsnummer_zaehler" fehl, da die Funktion sonst invoker-mode laeuft
und der Zaehler-Tabelle absichtlich kein Grant an authenticated erteilt
wird (sonst waere der Tageszaehler ueber die REST-API frei
lesbar/schreibbar). Gleiches Muster wie
check_auftrag_status_transition() in
20260705145543_auftrag_status_trigger.sql.
Ersteller-Anzeige (Punkt 3) ist umgesetzt und aus den offenen Punkten
entfernt; kleinere Textkorrektur bei Fahrtbeginn-Fotos bleibt erhalten.
Nutzer hat am 2026-08-19 dauerhafte Erlaubnis erteilt, /rebuild-master-stack
nach jedem Merge proaktiv auszufuehren statt jedes Mal nachzufragen.
- profiles_rls_test.sql: fehlende negative Assertion ergaenzt, die
sicherstellt, dass der Fahrer-Testnutzer 44444444... weiterhin KEIN
Readonly-Profil sieht (Policy bleibt scharf auf role in
('admin','disponent') begrenzt). plan(12) -> plan(13).
- design.md: Aussage zu erstellt_von im Auftrag-Typ korrigiert (nullable
statt immer vorhanden), passend zum bereits umgesetzten Code und zum
Nachtrag in Abschnitt 1 der gleichen Spec.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Neue Policy fuer Ersteller-Anzeige im Auftrag (Task 2/3 folgen). Bestehende
Assertion "Fahrer sieht nur das eigene Profil" testete eine Einschraenkung,
die dieses Feature bewusst aufhebt -- Erwartungswert und Titel angepasst,
statt der Policy, auf Anweisung des Plan-Autors.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Photos are now optional when a driver starts a trip: the 8 vehicle photo
fields remain in the form but no longer carry the required attribute, are
labeled "(optional)", and validateFahrtBeginn no longer checks for missing
positions. Combined with the DB trigger fix in 9f410cb/eaa5faa, a trip can
now begin with zero, some, or all photos uploaded.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Restore the security-review context comment that explains why the
storniert status check is necessary. This comment was part of the
original trigger function body and should be preserved for future
maintainers who inspect the function directly in the database.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
- Add migration 20260818120000_auftrag_fotos_optional_trigger.sql that replaces
check_auftrag_status_transition() function, removing ONLY the photo-count check
while preserving all other validation (start_km, end_km, uebergabe_bestaetigt_at,
status transitions, column lockdown, role-based restrictions)
- Update pgTAP test: plan(13) -> plan(12), replace photo-mandatory test with
test verifying transition succeeds without photos
- Completes DB-level optional photos feature (app-level optional already done in Task 1)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
Task 2's implementer found that check_auftrag_status_transition() independently
blocks the zugewiesen->unterwegs transition below 8 photos, duplicating the
app-level check removed in Task 1. Insert a new Task 2 (migration + pgTAP test
update) and correct the "no schema change" claims accordingly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P
- Add fotos.ts: loadAuftragFotos query function and sortiereUndBeschrifteFotos utility
- Add fotos.test.ts: 6 unit tests for sorting/labeling logic
- Update vitest.config.ts: add path alias resolution for @/ imports
React 19 forbids setting encType/method on a <form> whose action is a
function - it manages FormData (including files) itself. The extra
attribute triggered a console error and blocked "Fahrt beginnen" /
"Schadensfoto nachtragen" whenever photos were attached.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCHRPWuV3bd37NJhW2NK6P