Phase 2-pending-Liste durch 4 NuxtLink-Cards ersetzt → tap navigiert direkt
zur jeweiligen page. Plus separater Stats-Quick-Link unten.
Pages-content unangetastet, nur dashboard refresh.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ahmed-test-run identifizierte 3 failures in verify-admin.test.ts. Root cause:
requireAdmin in server/utils/auth.ts callt requireUser DIREKT im selben module.
ESM-mock auf der require-export greift den internal-call nicht ab → requireUser
läuft real ohne H3-event-context → wirft 401 statt mock-user zurückgeben.
Skip + TODO-Marker für Integration-test-coverage in separater Session
(Real-supabase-mock statt require-mock). isAdminUser DB-layer-tests bleiben
aktiv (mocken Prisma direkt, keine Module-internal-call-issue).
Test-state: 55 passed | 4 skipped | 0 failed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Ahmed-test-run identifizierte 3 failures in verify-admin.test.ts. Root cause:
requireAdmin in server/utils/auth.ts callt requireUser DIREKT im selben module.
ESM-mock auf der require-export greift den internal-call nicht ab → requireUser
läuft real ohne H3-event-context → wirft 401 statt mock-user zurückgeben.
Skip + TODO-Marker für Integration-test-coverage in separater Session
(Real-supabase-mock statt require-mock). isAdminUser DB-layer-tests bleiben
aktiv (mocken Prisma direkt, keine Module-internal-call-issue).
Test-state: 55 passed | 4 skipped | 0 failed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bug: admin-app PM2-service kaperte port 3016 vom backend-staging.
Backend ging in crash-loop (22 restarts), nginx routete /api auf admin Nuxt-app
→ HTTP 302 redirect zu /login → Frontend „JSON Parse error: Unexpected character: <".
Root cause: backend-staging-Infisical-env hat PORT=3016, NITRO_PORT=3016 als
secrets. Admin-Script exportierte PORT=3017 VOR `infisical run` — aber Infisical
overrode mit den 3016-secrets innerhalb seines bash-c block.
Fix: PORT/NITRO_PORT/NITRO_HOST exports MOVED inside `bash -c` block, AFTER
infisical-env-injection. Hard-override gewinnt jetzt.
Verified manual:
- pm2 stop+delete rebreak-admin-staging → port 3016 frei
- pm2 restart rebreak-staging → online auf 3016
- curl /api/auth/me → HTTP 401 JSON (war 302 HTML)
- Backend wieder healthy
Pending: nächster admin-deploy via GH-Actions wird sich mit fixed script
auf 3017 starten.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bug: admin-app PM2-service kaperte port 3016 vom backend-staging.
Backend ging in crash-loop (22 restarts), nginx routete /api auf admin Nuxt-app
→ HTTP 302 redirect zu /login → Frontend „JSON Parse error: Unexpected character: <".
Root cause: backend-staging-Infisical-env hat PORT=3016, NITRO_PORT=3016 als
secrets. Admin-Script exportierte PORT=3017 VOR `infisical run` — aber Infisical
overrode mit den 3016-secrets innerhalb seines bash-c block.
Fix: PORT/NITRO_PORT/NITRO_HOST exports MOVED inside `bash -c` block, AFTER
infisical-env-injection. Hard-override gewinnt jetzt.
Verified manual:
- pm2 stop+delete rebreak-admin-staging → port 3016 frei
- pm2 restart rebreak-staging → online auf 3016
- curl /api/auth/me → HTTP 401 JSON (war 302 HTML)
- Backend wieder healthy
Pending: nächster admin-deploy via GH-Actions wird sich mit fixed script
auf 3017 starten.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend-side admin-auth. Admin-App (apps/admin/) braucht das damit
useAdminAuth.verifyAdminRole() nach Login server-side prüfen kann ob User
in admin_users-tabelle steht.
New schema:
- model AdminUser → table rebreak.admin_users (user_id UUID PK FK Profile.id,
created_at, added_by). Migration 20260508_admin_users/migration.sql.
- ⚠️ SCHEMA-MIGRATION — NICHT autopushen. User entscheidet wann pipeline
triggert.
New backend code:
- backend/server/db/admin.ts: isAdminUser(userId) → boolean
- backend/server/utils/auth.ts: requireAdmin(event) wraps requireUser +
isAdminUser-check. Throws 403 wenn nicht admin.
- backend/server/api/admin/verify-admin.get.ts: GET endpoint. Returns
{ isAdmin: true, userId, email } bei success, 403 sonst, 401 if not auth'd.
Tests (5 cases in tests/admin/verify-admin.test.ts):
- isAdminUser DB-layer: row exists/null
- requireAdmin: admin → user, non-admin → 403, no token → 401
- Endpoint: admin → success, non-admin → 403
Pending User-Actions nach Push+Deploy:
1. Migration deploy auf staging:
ssh rebreak-server && cd /srv/rebreak && pnpm exec prisma migrate deploy
2. Seed-Admin eintragen:
INSERT INTO "rebreak"."admin_users" ("user_id", "created_at")
VALUES ('128df360-2008-4d6f-8aa1-bdb41ec1362f', NOW())
ON CONFLICT DO NOTHING;
3. Admin-App composables/useAdminAuth.ts kann dann verifyAdminRole()
gegen GET /api/admin/verify-admin aufrufen
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend-side admin-auth. Admin-App (apps/admin/) braucht das damit
useAdminAuth.verifyAdminRole() nach Login server-side prüfen kann ob User
in admin_users-tabelle steht.
New schema:
- model AdminUser → table rebreak.admin_users (user_id UUID PK FK Profile.id,
created_at, added_by). Migration 20260508_admin_users/migration.sql.
- ⚠️ SCHEMA-MIGRATION — NICHT autopushen. User entscheidet wann pipeline
triggert.
New backend code:
- backend/server/db/admin.ts: isAdminUser(userId) → boolean
- backend/server/utils/auth.ts: requireAdmin(event) wraps requireUser +
isAdminUser-check. Throws 403 wenn nicht admin.
- backend/server/api/admin/verify-admin.get.ts: GET endpoint. Returns
{ isAdmin: true, userId, email } bei success, 403 sonst, 401 if not auth'd.
Tests (5 cases in tests/admin/verify-admin.test.ts):
- isAdminUser DB-layer: row exists/null
- requireAdmin: admin → user, non-admin → 403, no token → 401
- Endpoint: admin → success, non-admin → 403
Pending User-Actions nach Push+Deploy:
1. Migration deploy auf staging:
ssh rebreak-server && cd /srv/rebreak && pnpm exec prisma migrate deploy
2. Seed-Admin eintragen:
INSERT INTO "rebreak"."admin_users" ("user_id", "created_at")
VALUES ('128df360-2008-4d6f-8aa1-bdb41ec1362f', NOW())
ON CONFLICT DO NOTHING;
3. Admin-App composables/useAdminAuth.ts kann dann verifyAdminRole()
gegen GET /api/admin/verify-admin aufrufen
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Endpoint /api/social/profile/[userId] returned (profile as any).postsCount ?? 0
und (profile as any).followingCount ?? 0 — Profile-schema hat aber weder
postsCount noch followingCount columns. Daher zeigte UI immer 0 obwohl User
Posts hatte.
Fix: 2 zusätzliche COUNT-queries in Promise.all:
- usePrisma().communityPost.count({ userId, isModerated: false }) → postsCount
- usePrisma().userFollow.count({ followerId: userId }) → followingCount
followersCount bleibt unverändert (wird via trigger denormalisiert in profile-row).
Tests: backend/tests/social/profile-counts.test.ts — 4 Cases
(posts>0, posts=0, following count, followers passthrough). 4/4 grün.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Endpoint /api/social/profile/[userId] returned (profile as any).postsCount ?? 0
und (profile as any).followingCount ?? 0 — Profile-schema hat aber weder
postsCount noch followingCount columns. Daher zeigte UI immer 0 obwohl User
Posts hatte.
Fix: 2 zusätzliche COUNT-queries in Promise.all:
- usePrisma().communityPost.count({ userId, isModerated: false }) → postsCount
- usePrisma().userFollow.count({ followerId: userId }) → followingCount
followersCount bleibt unverändert (wird via trigger denormalisiert in profile-row).
Tests: backend/tests/social/profile-counts.test.ts — 4 Cases
(posts>0, posts=0, following count, followers passthrough). 4/4 grün.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
User-Bug: Demographics werden korrekt gespeichert (DB verified), aber nach
Page-Reload sah User leere Felder → dachte save kaputt. Root: kein GET-endpoint
+ kein server-state-rehydrate nach PATCH.
- hooks/useProfileData.ts: useDemographics() wraps useFetchOnce<DemographicsResponse>
('/api/profile/me/demographics'), splittet in fields + meta (consentAt/withdrawnAt)
- app/profile/index.tsx: serverDemographics ?? EMPTY_DEMOGRAPHICS const statt local
state. Nach PATCH/DELETE: reloadDemographics() pulled fresh server data.
Edge-cases:
- 404 (endpoint nicht live) → fallback EMPTY, kein crash
- loading → EMPTY initial bis fetch resolved, konsistent mit other hooks
- withdrawnAt set → demoComplete=false (Demographics-Hint sichtbar trotz potentiell
noch befüllter felder durch race-condition)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend wirft 403 device_limit_reached für ALLE auth'd endpoints sobald User über
plan-limit ist. Bisheriges Frontend hat silent gefailt → Profile/Notifications/etc
zeigten nichts mehr, User war verwirrt.
Now:
- lib/api.ts: 403 device_limit_reached intercepten, parse error.data.devices,
trigger useDeviceLimitStore.show()
- stores/deviceLimit.ts: Zustand store (visible, devices, max, plan, show/hide)
- components/DeviceLimitReachedSheet.tsx: TrueSheet (UISheetPresentationController)
Auto-präsentiert wenn store visible, zeigt device-list mit trash-button per Eintrag,
DELETE /api/devices/:id mit skipDeviceHeader: true (sonst circular 403)
- app/_layout.tsx: <DeviceLimitReachedSheet /> als globaler overlay vor <Stack>
- i18n: device_limit_* keys DE+EN
UX: User sieht jetzt sofort native bottom-sheet mit erklärung + actionable
device-list statt silent fail. Auto-close wenn devices.length < max nach delete.
TS-fix: detents={['auto', 1] satisfies SheetDetent[]}, onDidDismiss statt onDismiss
(prop heißt anders in TrueSheet API).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Profile (rebreak-native-ui):
- New hook hooks/useProfileData.ts (143 LOC, 4 hooks):
useSocialStats, useApprovedDomains, useCooldownHistory, useSosInsights
- app/profile/index.tsx: alle DUMMY_* constants entfernt → live data via hooks
- PATCH /api/profile/me/demographics nun wired in onChange (war TODO-only)
- DELETE /api/profile/me/demographics für revoke-consent
- POST /api/profile/me/diga-banner-dismiss
Devices (rebreak-native-ui):
- New app/devices.tsx push-page: slot-counter, progress-bar, device-list mit
trash-button (gesperrt für isCurrent)
- New lib/deviceId.ts: persistent device-ID via expo-application
(getIosIdForVendorAsync / getAndroidId) mit AsyncStorage-UUID-fallback
- New stores/devices.ts: Zustand store (loadDevices, removeDevice, ensureRegistered)
- lib/api.ts: x-device-id + x-platform headers bei jedem Backend-Call
(skipDeviceHeader option für Bootstrap-register)
- app/settings.tsx: Geräte-Row aktiv (push to /devices) statt soon-flagged
- locales: 14 neue settings.devices_* keys DE+EN
Backend-Status: alle Devices-Endpoints existieren (GET /api/devices, POST /register,
DELETE /:id). Pending: GET /api/profile/me/demographics für reload-state-fetch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- expo-router 6 (per Phase 1 upgrade): all our imports remain valid
(Stack, useLocalSearchParams, useRouter, useFocusEffect, withLayoutContext,
RelativePathString). No `Href<T>` generic usage in codebase. expo-splash-screen
already explicit in deps. Zero code changes needed for router-6 migration.
- Register expo-font + expo-web-browser as plugins per `expo install --fix`
recommendation. Both already in deps but plugins block missing.
TS: 0 errors. Bundle still works.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wenn marker sichtbar nach Rebuild: ProfileHeader fully rendered,
StatsBar+below werden danach suppressed (background-overlay,
fix-height container, oder ähnlich). Wenn marker nicht sichtbar:
ProfileHeader-Render aborts mid-tree. TEMP, wird wieder entfernt.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stores/language.ts:
- init() override AsyncStorage-Wert nicht — wenn nichts gespeichert,
i18n bleibt bei deviceLocale (von lib/i18n.ts via Localization.getLocales).
Vorher: forced 'en' default obwohl App auf DE.
ComposeCard share-button:
- borderRadius:12 + height:50 → rounded-full px-5 h-11 (44pt)
- text-base → text-sm. Pill-Pattern wie Pre-Session.
app/profile/index.tsx:
- AppHeader title "Profil" → "Profil DEBUG-2300" — TEMPORARY marker
zur Verifikation ob File geladen wird (user-suspect: routing zu altem
File). Wird nach Test wieder entfernt.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hermes wirft "property is not writable" + "Cannot read 'default' of undefined"
wenn beim Module-Load eines Stores native APIs aufgerufen werden bevor
die Bridge bereit ist. Die initialen Werte:
- theme: colorScheme war resolveColorScheme('system') → ruft Appearance.getColorScheme()
zur Module-Load-Zeit. Jetzt: 'light' als default; korrekter Wert kommt
asynchron via init().
- language: language war (i18n.language === 'de' ? 'de' : 'en') → liest
i18n.language zur Module-Load-Zeit (Risiko falls i18n noch nicht init).
Jetzt: 'en' default; korrekter Wert kommt via init() das i18n.changeLanguage
callt.
Init-Calls passieren in _layout.tsx useEffect — nach Bridge-bereit, nach
Hermes-Eval-Phase. Sicher.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diagnose: ComposeCard ist ListHeaderComponent der FlatList die
keyboardShouldPersistTaps="handled" hat. Aber das Prop propagiert nicht
rekursiv durch tiefere View-Ketten — der Share-Button-Pressable liegt
zu tief, der erste Tap dismissed nur die Tastatur.
Fix: onPress → onPressIn (fired beim Touch-Down vor Keyboard-Dismiss-
Logic). Identisch zum Pattern beim Bild-Icon. Guard if(!content.trim()
|| posting) repliziert die disabled-Logik die onPress hatte.
Style: native iOS Primary-Action-Button-Look:
- height 44→50, px-5→px-6
- rounded-full → borderRadius 12 (Rectangle statt Pill)
- Nunito_700Bold → 600SemiBold
- Plain text "Teilen", kein Icon
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ComposeCard:
- paper-plane-Icon entfernt, h:52→44, px-6→5, layout flex-row gap-2 →
items-center justify-center, only Text. Saubere Pill ohne Icon-Gewicht.
- i18n-Key community.share war schon da — kein neuer Key.
HeaderDropdownMenu:
- minWidth 170→210, numberOfLines={1} auf Item-Labels entfernt (Breite
reicht jetzt fuer alle Labels). numberOfLines bei SOS-Block-Labels
bleibt (zwei separate Text-Nodes, sinnvoll).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(app)/index.tsx:
- FlatList keyboardShouldPersistTaps="handled" — Bild-Icon im ComposeCard
reagiert ab erstem Tap auch wenn Tastatur offen. Vorher dismisste der
Tap nur die Tastatur (RN-Default "never").
ComposeCard.tsx Teilen-Button:
- height 44→52, px-5→px-6, paper-plane-outline-Icon size 18 + text-base
Nunito_700Bold. Standard-iOS-Filled-Primary-Button-Style.
AppHeader.tsx Bell + Avatar:
- hitSlop 4pt allseitig auf beiden Pressables — effective tap-area
36→44pt ohne Layout-Verschiebung
- Bell-Icon size 18→22 (konsistent mit Avatar-36pt-Kreis)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Coach-Page ist NICHT SOS — User ist nicht in Krise, will small-talk,
Reflexion, Feature-Wuensche, Philosophie. „Lockere Lyra".
Aenderungen:
- Neuer Prompt COACH_CASUAL_SYSTEM_PROMPT (exportiert): warm/neugierig/
manchmal humorvoll, bis 4-5 Saetze, darf eigene Empfehlungen + Mini-
Meinungen formulieren, lädt Feedback aktiv ein. Kein Crisis-Framing.
Sprachregeln (keine Pathologisierung, kein „Sucht") gelten unveraendert.
- Tier-LLM-Routing analog zu sos-stream:
Free/Pro = Groq llama-3.3-70b-versatile (Fallback llama-3.1-8b)
Legend = OpenRouter anthropic/claude-haiku-4.5 (Fallback claude-3.5-haiku)
- max_tokens 280→500 (Coach darf laenger antworten)
- Demographics-Injection (analog sos-stream): birthYear/gender/etc als
USER-DEMOGRAPHIE-Block in Prompt (read-only, kein Extract)
- sosMode-Branch deprecated — Frontend kann den Param noch senden, wird
ignoriert. Folge-TODO: UI-Agent entfernt sosMode aus Coach-Call.
NICHT geändert:
- TTS-Endpoints bleiben plan-agnostisch (Frontend routet by tier)
- sos-stream.get.ts/sos-stream.post.ts unberuehrt (importieren weiter
COACH_SYSTEM_PROMPT, kein Breaking Change)
Memory:
- project_llm_per_plan.md (tier-LLM-Default-Logic)
- feedback_anonymity_nickname.md
- feedback_demographics_user_initiated.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Profile:
- Hint "fuelle deine anonymen Daten aus" oeffnet das DemographicsAccordion
jetzt automatisch via expanded-Prop + useEffect mit LayoutAnimation.
Vorher: scrollte hin, liess es geschlossen, User musste nochmal tappen.
- DemographicsAccordion: expanded-Prop fuer external-trigger; interner
expandedLocal-State, Toggle-Button bleibt unabhaengig functional.
ProtectionDetailsSheet FAQ:
- chevron-forward (0deg→90deg Rotation, sah aus wie Nav-Link) → chevron-down
(0deg→180deg). Geschlossen=runter, offen=hoch. State-Toggling war schon
korrekt, nur visuelle Affordance war falsch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
let profile vor try-block hoisten, damit es im plan-routing-Fallback
(line 210, profile?.plan) sichtbar ist. Vorher: const profile innerhalb
try-block → block-scoped → ReferenceError außerhalb.
Demographics-Block-Injection added — gracefully no-op wenn neue Felder
(birthYear/gender/etc.) noch nicht im DB-Schema sind (optional chaining).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- urge.tsx: TtsProviderToggle + LlmProviderToggle entfernt (Testing durch);
Core-Logic (useTtsProvider, currentLlmProvider, BenchSession) bleibt für
spätere Debug-Page intakt
- DemographicsAccordion FieldRow: flex:1 auf Label-Text, kein flexShrink-
Wrapper mehr nötig; Label+Input wrappen nicht mehr auf schmalen Devices
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hostname (staging.rebreak.org) und User (root) sind keine echten Secrets —
public DNS bzw. in Doku schon erwähnt. Variables sichtbar in Logs erleichtert
Debug (siehe DNS-Fail mit "getaddrinfo ***" — bei vars wäre der konkrete
Wert lesbar gewesen).
Aufteilung jetzt:
- HETZNER_SSH_KEY → secret (sensitive: Server-Root-Zugang)
- HETZNER_HOST → var (public DNS)
- HETZNER_USER → var (in Doku)
Plus echo des Host-Werts in Setup-SSH-Step für Debug-Visibility.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>