From e071c281af7489bec074fd7c3b87e0f47d0f36db Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Tue, 21 Apr 2026 17:40:12 -0400 Subject: [PATCH] chore(core): clean up after ConfigPermission Effect Schema migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Post-merge review follow-ups for #23740: - src/config/agent.ts: remove unused ZodOverride import. The PermissionRef escape hatch was deleted when ConfigPermission.Info became a canonical Effect Schema, but the import was left behind. - specs/effect/schema.md: drop the ZodPreprocess annotation section. The feature was deleted in #23740 because the __originalKeys hack it was supporting is gone. Also remove ConfigPermission.Info from the list of "zod-only schemas that cannot yet be expressed as Schema" under ZodOverride — it is now Effect canonical. --- packages/opencode/specs/effect/schema.md | 16 ++-------------- packages/opencode/src/config/agent.ts | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/opencode/specs/effect/schema.md b/packages/opencode/specs/effect/schema.md index 6deea49655e5..df3cc0881d5c 100644 --- a/packages/opencode/specs/effect/schema.md +++ b/packages/opencode/specs/effect/schema.md @@ -97,7 +97,7 @@ creating a parallel schema source of truth. ## Escape hatches -The walker in `@/util/effect-zod` exposes three explicit escape hatches for +The walker in `@/util/effect-zod` exposes two explicit escape hatches for cases the pure-Schema path cannot express. Each one stays in the codebase only as long as its upstream or local dependency requires it — inline comments document when each can be deleted. @@ -109,19 +109,7 @@ Replaces the entire derivation with a hand-crafted zod schema. Used when: - the target carries external `$ref` metadata (e.g. `config/model-id.ts` points at `https://models.dev/...`) - the target is a zod-only schema that cannot yet be expressed as Schema - (e.g. `ConfigAgent.Info`, `ConfigPermission.Info`, `Log.Level`) - -### `ZodPreprocess` annotation - -Wraps the derived zod schema with `z.preprocess(fn, inner)`. Used by -`config/permission.ts` to inject `__originalKeys` before parsing, because -`Schema.StructWithRest` canonicalises output (known fields first, catchall -after) and destroys the user's original property order — which permission -rule precedence depends on. - -Tracked upstream as `effect:core/wlh553`: "Schema: add preserveInputOrder -(or pre-parse hook) for open structs." Once that lands, `ZodPreprocess` and -the `__originalKeys` hack can both be deleted. + (e.g. `ConfigAgent.Info`, `Log.Level`) ### Local `DeepMutable` in `config/config.ts` diff --git a/packages/opencode/src/config/agent.ts b/packages/opencode/src/config/agent.ts index 5a91a389954a..85021407c7de 100644 --- a/packages/opencode/src/config/agent.ts +++ b/packages/opencode/src/config/agent.ts @@ -3,7 +3,7 @@ export * as ConfigAgent from "./agent" import { Schema } from "effect" import z from "zod" import { Bus } from "@/bus" -import { zod, ZodOverride } from "@/util/effect-zod" +import { zod } from "@/util/effect-zod" import { Log } from "../util" import { NamedError } from "@opencode-ai/shared/util/error" import { Glob } from "@opencode-ai/shared/util/glob"