feat: migrate to machine-schema v0.3.0 parse-seam API#753
Merged
Conversation
Replace all direct zod schema object usages with the new explicit type + parse-function surface from @bounded-systems/machine-schema@0.3.0: - handoff/cli.ts: handoffTargetActor.safeParse → safeParseHandoffTargetActor; handoffTargetActor.options → HANDOFF_TARGET_ACTOR_VALUES (3 call sites) - handoff/store.ts: handoffEnvelope.parse → parseHandoffEnvelope (4 call sites) - derive/cli.ts: z.array(rawStateV1Schema) → z.array(z.unknown().transform(parseRawStateV1)) - machine/contracts/guards.ts: rawStateV1Schema.parse → parseRawStateV1 - machine/contracts/anchored-chain-bridge.ts: rawStateV1Schema → z.unknown().transform(parseRawStateV1) - pr-state/domain_state.ts: .shape.* → z.custom<T>(); rawStateV1Schema.parse → z.unknown().transform(parseRawStateV1) + parseRawStateV1 - machine/work_unit.ts: update brand comment (v0.3.0 uses unique-symbol brand, not zod BRAND — explicit `as WorkUnitId` casts remain correct) Dependency: @bounded-systems/machine-schema@^0.3.0 (published separately). CI is blocked until that package is available on JSR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
/ci |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Code Coverage OverviewLanguages: TypeScript TypeScript / unitThe overall coverage in the branch remains at 88%, unchanged from the branch. Show a code coverage summary of the most impacted files.
Updated |
- anchored-chain-bridge.ts: import type { z } → import { z } (z used as value)
- work_unit.ts: .brand<"WorkUnitId">() → .transform((v) => v as WorkUnitId)
so canonicalWorkUnitIdSchema shares the unique-symbol brand with machine-schema
- envelope.test.ts: rewrite to use v0.3.0 parse-seam API (no schema object exports)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
`raw_state_v1` in `defaultMachineSchemaMap` now uses a typed
`z.looseObject({unitId, artifacts, signals, sync, meta}).transform(parseRawStateV1)`
so the input schema (ZodPipe._def.in) is a ZodObject with the declared
top-level shape.
The drift-pin test's `requiredKeysOf` helper is updated to unwrap
`ZodPipe` by following `._def.in`, after the existing ZodEffects loop,
so it handles both Zod 3 (.refine()) and Zod 4 (.transform()) wrapping.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@bounded-systems/machine-schemawith the new explicit type + parse-function surface from v0.3.0@bounded-systems/machine-schemadep from^0.2.0→^0.3.0Sites updated (8 files)
handoff/cli.tshandoffTargetActor.safeParse→safeParseHandoffTargetActor;.options→HANDOFF_TARGET_ACTOR_VALUES(3 call sites)handoff/store.tshandoffEnvelope.parse→parseHandoffEnvelope(4 call sites)derive/cli.tsz.array(rawStateV1Schema)→z.array(z.unknown().transform(parseRawStateV1))machine/contracts/guards.tsrawStateV1Schema.parse→parseRawStateV1machine/contracts/anchored-chain-bridge.tsrawStateV1Schema→z.unknown().transform(parseRawStateV1)pr-state/domain_state.ts.shape.artifacts/.shape.sync→z.custom<T>();rawStateV1Schema.parse→parseRawStateV1+ transformmachine/work_unit.tsWhy
@bounded-systems/machine-schemav0.3.0 removes all exported zod schema objects (they were JSR "slow types" blocking theallFastCheckgate). The new API is explicit TS types + thin parse functions:parseRawStateV1,parseHandoffEnvelope,safeParseHandoffTargetActor,HANDOFF_TARGET_ACTOR_VALUES.Dependency
CI may be blocked until
@bounded-systems/machine-schema@0.3.0is published to JSR. The machine-schema commits are atbounded-systems/machine-schema@21fefd3(local/tmp/mschema). Needs a fresh JSR token to publish (old session token is invalid/revoked).Test plan
@bounded-systems/machine-schema@0.3.0published to JSR (unblocks install)bun installresolves the bumped depbun run tsc --noEmitpasses (no type errors from the new API surface)bun testPR Checklist
--allow-slow-typescheck🤖 Generated with Claude Code