Skip to content

Open-source status page, incident response and uptime monitoring

fix: turbopack client bundler (#2153)

Maximilian Kaske5188de8fd76f
diff --git a/apps/dashboard/src/components/chat/use-chat-session.ts b/apps/dashboard/src/components/chat/use-chat-session.ts
index 2a0eb62fe..f673a2465 100644
--- a/apps/dashboard/src/components/chat/use-chat-session.ts
+++ b/apps/dashboard/src/components/chat/use-chat-session.ts
@@ -4,7 +4,7 @@ import { useChat } from "@ai-sdk/react";
import {
type ChatStoredMessage,
chatStoredMessagesSchema,
-} from "@openstatus/db/src/schema";
+} from "@openstatus/db/src/schema/chat_sessions/messages";
import { skipToken, useQuery, useQueryClient } from "@tanstack/react-query";
import {
DefaultChatTransport,
diff --git a/packages/db/src/schema/chat_sessions/chat_session.ts b/packages/db/src/schema/chat_sessions/chat_session.ts
index 9e2e2fdad..77ed88110 100644
--- a/packages/db/src/schema/chat_sessions/chat_session.ts
+++ b/packages/db/src/schema/chat_sessions/chat_session.ts
@@ -2,7 +2,7 @@ import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { user } from "../users";
import { workspace } from "../workspaces";
-import type { ChatStoredMessage } from "./validation";
+import type { ChatStoredMessage } from "./messages";
/**
* Surrogate-PK row per dashboard chat conversation. Many rows per
diff --git a/packages/db/src/schema/chat_sessions/messages.ts b/packages/db/src/schema/chat_sessions/messages.ts
new file mode 100644
index 000000000..185cf1172
--- /dev/null
+++ b/packages/db/src/schema/chat_sessions/messages.ts
@@ -0,0 +1,43 @@
+import { z } from "zod";
+
+import { CHAT_TITLE_MAX_LENGTH, MAX_CHAT_MESSAGES } from "./constants";
+
+// Pure-zod schemas split out of `validation.ts` so client code can import
+// them without dragging the drizzle schema barrel into the client bundle.
+
+/**
+ * Persisted message-part shape. Mirrors AI SDK v6 `UIMessagePart` —
+ * which is a union of `text`, `tool-<name>`, `reasoning`, `source-*`,
+ * `file`, `data-*`, `step-start`. We don't enumerate them: storage
+ * accepts any `{ type: string }` shape (`passthrough()` keeps unknown
+ * fields). The route handler filters to the parts we actually need
+ * for re-render (text + tool-*) before persisting.
+ *
+ * Also covers our compaction marker `tool-summary` — same loose shape.
+ */
+export const messagePartSchema = z.looseObject({
+ type: z.string(),
+});
+
+export type ChatMessagePart = z.infer<typeof messagePartSchema>;
+
+export const storedMessageSchema = z.object({
+ id: z.string(),
+ role: z.enum(["user", "assistant", "system"]),
+ parts: z.array(messagePartSchema),
+ /**
+ * Server-stamped epoch ms of when this message was first persisted.
+ * The service layer stamps `Date.now()` and preserves the original
+ * value across the full-replace persistence, so older messages keep
+ * their first-seen timestamp instead of being re-stamped per turn.
+ */
+ createdAt: z.number().int(),
+});
+
+export type ChatStoredMessage = z.infer<typeof storedMessageSchema>;
+
+export const chatStoredMessagesSchema = z
+ .array(storedMessageSchema)
+ .max(MAX_CHAT_MESSAGES);
+
+export const chatTitleSchema = z.string().min(1).max(CHAT_TITLE_MAX_LENGTH);
diff --git a/packages/db/src/schema/chat_sessions/validation.ts b/packages/db/src/schema/chat_sessions/validation.ts
index 22d978df1..eb6a46a38 100644
--- a/packages/db/src/schema/chat_sessions/validation.ts
+++ b/packages/db/src/schema/chat_sessions/validation.ts
@@ -1,45 +1,17 @@
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
-import { z } from "zod";
+import type { z } from "zod";
import { chatSession } from "./chat_session";
-import { CHAT_TITLE_MAX_LENGTH, MAX_CHAT_MESSAGES } from "./constants";
-
-/**
- * Persisted message-part shape. Mirrors AI SDK v6 `UIMessagePart` —
- * which is a union of `text`, `tool-<name>`, `reasoning`, `source-*`,
- * `file`, `data-*`, `step-start`. We don't enumerate them: storage
- * accepts any `{ type: string }` shape (`passthrough()` keeps unknown
- * fields). The route handler filters to the parts we actually need
- * for re-render (text + tool-*) before persisting.
- *
- * Also covers our compaction marker `tool-summary` — same loose shape.
- */
-export const messagePartSchema = z.looseObject({
- type: z.string(),
-});
-
-export type ChatMessagePart = z.infer<typeof messagePartSchema>;
-
-export const storedMessageSchema = z.object({
- id: z.string(),
- role: z.enum(["user", "assistant", "system"]),
- parts: z.array(messagePartSchema),
- /**
- * Server-stamped epoch ms of when this message was first persisted.
- * The service layer stamps `Date.now()` and preserves the original
- * value across the full-replace persistence, so older messages keep
- * their first-seen timestamp instead of being re-stamped per turn.
- */
- createdAt: z.number().int(),
-});
-
-export type ChatStoredMessage = z.infer<typeof storedMessageSchema>;
-
-export const chatStoredMessagesSchema = z
- .array(storedMessageSchema)
- .max(MAX_CHAT_MESSAGES);
-
-export const chatTitleSchema = z.string().min(1).max(CHAT_TITLE_MAX_LENGTH);
+import { chatStoredMessagesSchema, chatTitleSchema } from "./messages";
+
+export {
+ chatStoredMessagesSchema,
+ chatTitleSchema,
+ messagePartSchema,
+ storedMessageSchema,
+ type ChatMessagePart,
+ type ChatStoredMessage,
+} from "./messages";
export const insertChatSessionSchema = createInsertSchema(chatSession, {
title: chatTitleSchema,
diff --git a/packages/db/src/schema/incidents/incident.ts b/packages/db/src/schema/incidents/incident.ts
index 7b8981747..b0d9b5f14 100644
--- a/packages/db/src/schema/incidents/incident.ts
+++ b/packages/db/src/schema/incidents/incident.ts
@@ -1,5 +1,4 @@
-import { sql } from "drizzle-orm";
-import { relations } from "drizzle-orm";
+import { relations, sql } from "drizzle-orm";
import {
index,
integer,