From 42a0453945cf203d5c03c4f46bba92368de59dfd Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Mon, 11 May 2026 16:12:31 -0400 Subject: [PATCH] Drop small session Zod statics (#26921) --- packages/opencode/src/session/revert.ts | 4 +--- packages/opencode/src/session/status.ts | 8 ++------ packages/opencode/src/session/todo.ts | 7 +------ packages/opencode/test/session/schema-decoding.test.ts | 7 ------- 4 files changed, 4 insertions(+), 22 deletions(-) diff --git a/packages/opencode/src/session/revert.ts b/packages/opencode/src/session/revert.ts index 12c81180eb..ef9089c949 100644 --- a/packages/opencode/src/session/revert.ts +++ b/packages/opencode/src/session/revert.ts @@ -4,8 +4,6 @@ import { Snapshot } from "../snapshot" import { Storage } from "@/storage/storage" import { SyncEvent } from "../sync" import * as Log from "@opencode-ai/core/util/log" -import { zod } from "@opencode-ai/core/effect-zod" -import { withStatics } from "@opencode-ai/core/schema" import * as Session from "./session" import { MessageV2 } from "./message-v2" import { SessionID, MessageID, PartID } from "./schema" @@ -18,7 +16,7 @@ export const RevertInput = Schema.Struct({ sessionID: SessionID, messageID: MessageID, partID: Schema.optional(PartID), -}).pipe(withStatics((s) => ({ zod: zod(s) }))) +}) export type RevertInput = Schema.Schema.Type export interface Interface { diff --git a/packages/opencode/src/session/status.ts b/packages/opencode/src/session/status.ts index 1dd36ec53a..089559e2cd 100644 --- a/packages/opencode/src/session/status.ts +++ b/packages/opencode/src/session/status.ts @@ -2,10 +2,8 @@ import { BusEvent } from "@/bus/bus-event" import { Bus } from "@/bus" import { InstanceState } from "@/effect/instance-state" import { SessionID } from "./schema" -import { zod } from "@opencode-ai/core/effect-zod" -import { NonNegativeInt, withStatics } from "@opencode-ai/core/schema" +import { NonNegativeInt } from "@opencode-ai/core/schema" import { Effect, Layer, Context, Schema } from "effect" -import z from "zod" export const Info = Schema.Union([ Schema.Struct({ @@ -30,9 +28,7 @@ export const Info = Schema.Union([ Schema.Struct({ type: Schema.Literal("busy"), }), -]) - .annotate({ identifier: "SessionStatus" }) - .pipe(withStatics((s) => ({ zod: zod(s) }))) +]).annotate({ identifier: "SessionStatus" }) export type Info = Schema.Schema.Type export const Event = { diff --git a/packages/opencode/src/session/todo.ts b/packages/opencode/src/session/todo.ts index 9b7daf7f0c..005b3b7c4e 100644 --- a/packages/opencode/src/session/todo.ts +++ b/packages/opencode/src/session/todo.ts @@ -1,10 +1,7 @@ import { BusEvent } from "@/bus/bus-event" import { Bus } from "@/bus" import { SessionID } from "./schema" -import { zod } from "@opencode-ai/core/effect-zod" -import { withStatics } from "@opencode-ai/core/schema" import { Effect, Layer, Context, Schema } from "effect" -import z from "zod" import { Database } from "@/storage/db" import { eq } from "drizzle-orm" import { asc } from "drizzle-orm" @@ -16,9 +13,7 @@ export const Info = Schema.Struct({ description: "Current status of the task: pending, in_progress, completed, cancelled", }), priority: Schema.String.annotate({ description: "Priority level of the task: high, medium, low" }), -}) - .annotate({ identifier: "Todo" }) - .pipe(withStatics((s) => ({ zod: zod(s) }))) +}).annotate({ identifier: "Todo" }) export type Info = Schema.Schema.Type export const Event = { diff --git a/packages/opencode/test/session/schema-decoding.test.ts b/packages/opencode/test/session/schema-decoding.test.ts index a65137a2f2..4422c5b719 100644 --- a/packages/opencode/test/session/schema-decoding.test.ts +++ b/packages/opencode/test/session/schema-decoding.test.ts @@ -221,14 +221,11 @@ describe("SessionRevert.RevertInput", () => { test("messageID is required, partID is optional", () => { const withPart = { sessionID, messageID, partID } expect(decode(withPart)).toEqual(withPart) - expect(SessionRevert.RevertInput.zod.parse(withPart)).toEqual(withPart) const noPart = { sessionID, messageID } expect(decode(noPart)).toEqual(noPart) - expect(SessionRevert.RevertInput.zod.parse(noPart)).toEqual(noPart) expect(() => decode({ sessionID })).toThrow() - expect(() => SessionRevert.RevertInput.zod.parse({ sessionID })).toThrow() }) }) @@ -247,7 +244,6 @@ describe("SessionStatus.Info", () => { test("idle / busy discriminators", () => { expect(decode({ type: "idle" })).toEqual({ type: "idle" }) expect(decode({ type: "busy" })).toEqual({ type: "busy" }) - expect(SessionStatus.Info.zod.parse({ type: "idle" })).toEqual({ type: "idle" }) }) test("retry carries attempt/message/action/next", () => { @@ -266,12 +262,10 @@ describe("SessionStatus.Info", () => { next: 500, } expect(decode(input)).toEqual(input) - expect(SessionStatus.Info.zod.parse(input)).toEqual(input) }) test("rejects unknown type", () => { expect(() => decode({ type: "bogus" })).toThrow() - expect(() => SessionStatus.Info.zod.parse({ type: "bogus" })).toThrow() }) }) @@ -281,7 +275,6 @@ describe("Todo.Info", () => { test("three-field round-trip", () => { const input = { content: "do a thing", status: "pending", priority: "high" } expect(decode(input)).toEqual(input) - expect(Todo.Info.zod.parse(input)).toEqual(input) }) })