feat: implement R4 production hardening

- Add configurable ingestion batch item limits
- Improve client serialization and sanitization
- Add graceful handling for corrupt GZIP partitions in data API
- Expand admin session token scope
- Update project documentation for R4 status
This commit is contained in:
Team Dark Devil committed 2026-11-21 22:15:32 +06:00
1 parent 8132087085
commit ae9b554189
59 files changed
+16879 -1074

No files matched your search

+13 -5
View File
@@ -1,4 +1,4 @@
import { listAdminAuditLogsAsync } from "@/core/auth/auditLog";
import { listAdminAuditLogsWithStatusAsync } from "@/core/auth/auditLog";
import { requireAdminApiSession } from "@/lib/adminAuth";
import { NextRequest, NextResponse } from "next/server";
@@ -22,17 +22,25 @@ export async function GET(req: NextRequest) {
const search =
searchParams.get("q") || searchParams.get("search") || undefined;
const logs = await listAdminAuditLogsAsync({
const result = await listAdminAuditLogsWithStatusAsync({
limit,
action,
actorEmail,
search,
});
return NextResponse.json({
logs,
total: logs.length,
const response = NextResponse.json({
logs: result.logs,
total: result.logs.length,
storageMode: result.storageMode,
degraded: result.degraded,
...(result.code ? { code: result.code } : {}),
...(result.warning ? { warning: result.warning } : {}),
});
if (result.degraded) {
response.headers.set("X-DataStack-Audit-Degraded", "1");
}
return response;
} catch (err: unknown) {
const message =
err instanceof Error ? err.message : "Unable to fetch audit logs.";