feat(F-098): completed feature

This commit is contained in:
chattie
2026-08-20 22:39:06 +02:00
parent f1bf8c90c3
commit 3f1d08382f
8 changed files with 152 additions and 41 deletions

View File

@@ -0,0 +1,16 @@
# F-098 — Implementer evidence
## Root cause
`store_settings.updated_by` references `identity_users(id)`, while admin authentication returns IDs from `backoffice_users`. Saving settings therefore raised a PostgreSQL foreign-key error and surfaced as HTTP 500.
## Fix
`settings.routes.ts` now checks whether the authenticated ID exists in `identity_users`; it writes the audit ID only when valid, otherwise writes `NULL`, preserving the FK and allowing backoffice settings saves.
## Smoke test
- Authenticated `PATCH /api/admin/settings` with AI provider, base URL, model, and prompts: HTTP 200.
- Response includes saved AI configuration fields without exposing API key.
- Test rows removed after the smoke test.
- Services restarted successfully on ports 3000/3003/3004/3005.

View File

@@ -0,0 +1,15 @@
{
"feature_id": "F-098",
"agent": "leader",
"verdict": "APPROVED",
"summary": "F-098 fixes the HTTP 500 when saving AI settings: backoffice user IDs no longer violate the store_settings audit FK.",
"evidence": [
"reviewer.json APPROVED",
"security.json APPROVED",
"qa.json APPROVED",
"Authenticated AI PATCH smoke test HTTP 200",
"Production services healthy",
"verify.sh green"
],
"timestamp": "2026-08-20T20:39:10Z"
}

View File

@@ -0,0 +1,16 @@
{
"feature_id": "F-098",
"agent": "qa",
"verdict": "APPROVED",
"summary": "Settings save regression is fixed and verified against the running production stack.",
"evidence": [
"Root npm run typecheck exit 0",
"Admin npx tsc --noEmit exit 0",
"Tests: 133 passed, 56 skipped",
"Production build and restart completed successfully",
"Authenticated AI settings PATCH through :3004 returned HTTP 200",
"Authenticated settings GET returned HTTP 200",
"scripts/verify.sh exit 0"
],
"timestamp": "2026-08-20T20:39:00Z"
}

View File

@@ -0,0 +1,12 @@
{
"feature_id": "F-098",
"agent": "reviewer",
"verdict": "APPROVED",
"summary": "The fix addresses the actual PostgreSQL FK mismatch without changing schema or weakening valid identity-user audit links.",
"evidence": [
"Backoffice IDs are checked against identity_users before being used as updated_by",
"Authenticated AI settings PATCH smoke test returns HTTP 200",
"Settings GET remains HTTP 200 after cleanup"
],
"timestamp": "2026-08-20T20:38:30Z"
}

View File

@@ -0,0 +1,13 @@
{
"feature_id": "F-098",
"agent": "security",
"verdict": "APPROVED",
"summary": "The fallback writes NULL only for the incompatible backoffice identity and does not expose or alter API-key response behavior.",
"evidence": [
"The existing FK remains enforced",
"Valid identity_users audit IDs remain preserved",
"Backoffice settings saves do not bypass authentication",
"AI API key continues to be omitted from settings responses"
],
"timestamp": "2026-08-20T20:38:40Z"
}