Skip to content

Commit 79b3443

Browse files
Nick Ficanoclaude
andcommitted
effect(zod-adapter-removal): drop fromZod shim and unused zod dep
Replace the last fromZod consumer (LeaseMutableEffectSchema in messages/events.ts) with a native Effect schema that uses Schema.mutable on the record and the inner array so DelegateBody.lease_request stays assignment-compatible with the zod-derived Lease = Record<string, string[]> contract used across runtime/job-runner.ts. Delete messages/zod-adapter.ts and its dedicated test file. Drop zod from @arcp/client/package.json (client/src has zero direct zod imports). zod remains a direct dep of @arcp/core and @arcp/runtime because envelope.ts, brands.ts, errors.ts, messages/{lease-schema,events,session, execution,index}.ts, store/eventlog.ts, and runtime/session-context.ts still consume zod schemas. Full removal would require migrating envelope.ts + brands.ts + every messageEnvelope() payload twin + every .safeParse caller (client-dispatch.ts, session-context.ts) — deferred to a follow-up since it cascades beyond the 600 LOC slice budget. All gates green: lint, typecheck, build, 442/442 tests including SDK integration 45/45. Closes #50 Closes #30 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f367067 commit 79b3443

6 files changed

Lines changed: 17 additions & 101 deletions

File tree

packages/client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
"dependencies": {
4545
"@arcp/core": "workspace:*",
4646
"@effect/platform": "^0.96.1",
47-
"effect": "^3.21.2",
48-
"zod": "^3.23.8"
47+
"effect": "^3.21.2"
4948
},
5049
"devDependencies": {
5150
"@types/node": "^22.7.5",

packages/core/src/messages/events.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { z } from "zod";
44
import { ERROR_CODES } from "../errors.js";
55

66
import { ArtifactRefSchema } from "./artifacts.js";
7-
import { LeaseConstraintsSchema, LeaseZodSchema } from "./lease-schema.js";
7+
import { LeaseConstraintsSchema } from "./lease-schema.js";
88
import { LogPayloadSchema, MetricPayloadSchema } from "./telemetry.js";
9-
import { fromZod } from "./zod-adapter.js";
109

1110
// ARCP v1.0 §8 + v1.1 §8.2/§8.4 — `job.event` body schemas.
1211
//
@@ -93,13 +92,21 @@ export const StatusBodySchema = Schema.Struct({
9392
});
9493
export type StatusBody = Schema.Schema.Type<typeof StatusBodySchema>;
9594

96-
// `LeaseSchema` infers `Record<string, ReadonlyArray<string>>`; the rest of
97-
// the runtime (lease.ts, job-runner.ts) treats `Lease` as the mutable
98-
// `Record<string, string[]>` shape from the zod twin. Bridge through
99-
// `fromZod` so the inferred `DelegateBody.lease_request` stays
100-
// assignment-compatible with the zod-derived `Lease` alias until slice #50
101-
// migrates the `Lease` consumers to readonly arrays.
102-
const LeaseMutableEffectSchema = fromZod(LeaseZodSchema);
95+
// `LeaseSchema` in `lease-schema.ts` infers
96+
// `Record<string, ReadonlyArray<string>>`; the rest of the runtime (lease.ts,
97+
// job-runner.ts) treats `Lease` as the mutable `Record<string, string[]>`
98+
// shape from the zod twin. Define a native Effect mirror that wraps the
99+
// inner array in `Schema.mutable` and applies `Schema.mutable` to the record
100+
// so the inferred `DelegateBody.lease_request` stays assignment-compatible
101+
// with the zod-derived `Lease` alias used across the runtime.
102+
const LeaseMutableEffectSchema = Schema.mutable(
103+
Schema.Record({
104+
key: Schema.String.pipe(Schema.nonEmptyString()),
105+
value: Schema.mutable(
106+
Schema.Array(Schema.String.pipe(Schema.nonEmptyString())),
107+
),
108+
}),
109+
);
103110

104111
/** §8.2 `delegate` event-kind body. */
105112
export const DelegateBodySchema = Schema.Struct({

packages/core/src/messages/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export * from "./execution.js";
1919
export * from "./session.js";
2020
export * from "./telemetry.js";
2121
export type * from "./types.js";
22-
export { fromZod } from "./zod-adapter.js";
2322

2423
const ALL_ENVELOPES = [
2524
...SESSION_ENVELOPES,

packages/core/src/messages/zod-adapter.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

packages/core/test/messages/zod-adapter.test.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)