merge: remove the bug-report integration for v1.23

# Conflicts:
#	messages/de.json
#	messages/en.json
#	messages/es.json
#	messages/fr.json
#	messages/it.json
#	messages/pl.json
#	src/app/admin/[section]/renderer.tsx
This commit is contained in:
Marc-André Bombeck committed 2026-06-27 20:47:24 +02:00
commit b271a39fe4
68 files changed
+115 -3344

No files matched your search

+4 -21
View File
@@ -12,9 +12,8 @@
* - push_subscriptions (raw browser push endpoints)
* - telegram_scheduled_deletions (queued message-delete tickets)
*
* Feedback rows are intentionally PRESERVED (T8 from v1.4.6 + admin
* i18n copy now states this explicitly) — a wipe must not erase
* user-submitted bug reports admins still need to triage.
* AuditLog rows are intentionally PRESERVED — a wipe must not erase the
* audit trail of the operation itself.
*/
import { beforeEach, describe, expect, it, vi } from "vitest";
@@ -58,7 +57,7 @@ beforeEach(async () => {
});
describe("DELETE /api/admin/data wipe scope", () => {
it("clears notification channels, push subscriptions, telegram deletions; preserves Feedback + AuditLog", async () => {
it("clears notification channels, push subscriptions, telegram deletions; preserves AuditLog", async () => {
const prisma = getPrismaClient();
// ── arrange ──
@@ -105,16 +104,6 @@ describe("DELETE /api/admin/data wipe scope", () => {
},
});
// Seed a feedback row that MUST survive the wipe (per i18n copy).
const feedbackRow = await prisma.feedback.create({
data: {
userId: admin.id,
category: "BUG",
subject: "survives wipe",
description: "feedback rows are preserved",
},
});
// ── act: invoke the route handler exactly as Next.js would ──
const { DELETE } = await import("@/app/api/admin/data/route");
const req = new Request("http://localhost/api/admin/data", {
@@ -141,13 +130,7 @@ describe("DELETE /api/admin/data wipe scope", () => {
}),
).toBe(0);
// ── assert: feedback row survives, AuditLog rows survive ──
const feedbackAfter = await prisma.feedback.findUnique({
where: { id: feedbackRow.id },
});
expect(feedbackAfter).not.toBeNull();
expect(feedbackAfter?.subject).toBe("survives wipe");
// ── assert: AuditLog rows survive ──
// The wipe writes admin.data.clear.start AND admin.data.clear audit
// entries. They must outlive the operation (audit log is immune).
const auditCount = await prisma.auditLog.count({
@@ -92,25 +92,6 @@ async function loginAs(userId: string) {
cookieJar.set("healthlog_session", session.id);
}
async function loginAsAdmin() {
const prisma = getPrismaClient();
const admin = await prisma.user.create({
data: {
username: "cache-admin",
email: "cache-admin@example.test",
role: "ADMIN",
},
});
const session = await prisma.session.create({
data: {
userId: admin.id,
expiresAt: new Date(Date.now() + 60 * 60 * 1000),
},
});
cookieJar.clear();
cookieJar.set("healthlog_session", session.id);
return admin.id;
}
beforeEach(async () => {
await truncateAllTables(getPrismaClient());
@@ -240,26 +221,4 @@ describe("v1.4.34 IW-G — invalidation matrix across the major write surfaces",
expect(caches.dashboardWidgets.get(PRIMARY_USER_ID)).toBeNull();
expect(caches.dashboardWidgets.get(OTHER_USER_ID)).not.toBeNull();
});
it("admin app-settings PUT evicts the bugreportStatus singleton cache", async () => {
await loginAsAdmin();
const { caches } = await import("@/lib/cache/server-cache");
caches.bugreportStatus.set("singleton", { fake: "status" });
expect(caches.bugreportStatus.get("singleton")).not.toBeNull();
const { PUT } = await import("@/app/api/admin/settings/route");
const res = await PUT(
new NextRequest("http://localhost/api/admin/settings", {
method: "PUT",
headers: { "content-type": "application/json" },
body: JSON.stringify({ bugReportRepo: "owner/repo" }),
}),
);
expect(res.status).toBe(200);
// The singleton bucket is gone — the next bugreport.status read
// will rebuild from app_settings.
expect(caches.bugreportStatus.get("singleton")).toBeNull();
});
});
+3 -16
View File
@@ -3,7 +3,7 @@
*
* Deleting a user must wipe every personal-data row that references
* them. The schema declares `onDelete: Cascade` for personal data and
* `onDelete: SetNull` for audit-style rows (AuditLog, Feedback). This
* `onDelete: SetNull` for audit-style rows (AuditLog). This
* test verifies the actual database FKs match those declarations — a
* missing CASCADE would leave orphan rows behind, violating GDPR.
*/
@@ -143,19 +143,11 @@ describe("user.delete cascades to all personal-data tables", () => {
},
});
// Audit logs / feedback are intentionally SetNull, not Cascade —
// they survive deletion with a null userId for compliance triage.
// Audit logs are intentionally SetNull, not Cascade — they survive
// deletion with a null userId for compliance triage.
const auditRow = await prisma.auditLog.create({
data: { userId: user.id, action: "auth.login" },
});
const feedbackRow = await prisma.feedback.create({
data: {
userId: user.id,
category: "BUG",
subject: "test",
description: "test",
},
});
// ── act ──
await prisma.user.delete({ where: { id: user.id } });
@@ -200,10 +192,5 @@ describe("user.delete cascades to all personal-data tables", () => {
where: { id: auditRow.id },
});
expect(auditAfter?.userId).toBeNull();
const feedbackAfter = await prisma.feedback.findUnique({
where: { id: feedbackRow.id },
});
expect(feedbackAfter?.userId).toBeNull();
});
});
-1
View File
@@ -68,7 +68,6 @@ export async function truncateAllTables(client: PrismaClient): Promise<void> {
"coach_usage",
"data_backups",
"devices",
"feedback",
"host_metrics",
"idempotency_keys",
"integration_statuses",