Files
oh-my-pi/patches/@ark%2Fschema@0.56.1.patch
T
can1357 343ade685f fix(deps): re-keyed @ark/schema patch to 0.56.1 for wire key order
The 16.3.7 bump pulled arktype 2.2.2, which pins @ark/schema to 0.56.1. The patch was keyed to 0.56.0, so Bun silently skipped it and the arktype constraint keys reverted to hash/alphabetical order. Tool wire schemas then lost authored declaration order, failing packages/ai schema-wire tests and blocking the release pipeline.

Regenerated the patch against 0.56.1 (flattenConstraints shifted, so the old hunk offsets no longer applied) and re-pointed patchedDependencies.
2026-07-05 17:19:18 +02:00

27 lines
1.4 KiB
Diff

diff --git a/out/constraint.js b/out/constraint.js
index 19ad1869c46cf57bde4a09dcb6400ab2c83809e1..4f3df3198713856ad76dd49cc378f0f41fc769e6 100644
--- a/out/constraint.js
+++ b/out/constraint.js
@@ -51,8 +51,10 @@ export const constraintKeyParser = (kind) => (schema, ctx) => {
}
const nodes = schema.map(schema => ctx.$.node(kind, schema));
// predicate order must be preserved to ensure inputs are narrowed
- // and checked in the correct order
- if (kind === "predicate")
+ // and checked in the correct order; required/optional preserve authored
+ // key order too so tool wire schemas stream in declaration order rather
+ // than alphabetized-by-hash order (oh-my-pi patch)
+ if (kind === "predicate" || kind === "required" || kind === "optional")
return nodes;
return nodes.sort((l, r) => (l.hash < r.hash ? -1 : 1));
}
@@ -111,7 +113,7 @@ export const flattenConstraints = (inner) => {
.sort((l, r) => l.precedence < r.precedence ? -1
: l.precedence > r.precedence ? 1
// preserve order for predicates
- : l.kind === "predicate" && r.kind === "predicate" ? 0
+ : (l.kind === "predicate" && r.kind === "predicate") || (l.kind === r.kind && (l.kind === "required" || l.kind === "optional")) ? 0
: l.hash < r.hash ? -1
: 1);
return result;