Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions registry/server/tools/registry-binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,46 @@ const RegistryServerSchema = z.object({
});

/**
* WhereExpression schema - using z.unknown() to avoid deep type instantiation
* WhereExpression type - recursive type for filtering
* Supports simple conditions and logical operators (and, or, not)
*/
const WhereExpressionSchema = z.unknown();
type WhereExpression = {
field?: string[];
operator?: string;
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Type-schema mismatch: operator is typed as string but the schema validates against a specific enum. Consider using a union type to match the schema for better type safety: operator?: 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'like' | 'contains' | 'and' | 'or' | 'not';

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At registry/server/tools/registry-binding.ts, line 52:

<comment>Type-schema mismatch: `operator` is typed as `string` but the schema validates against a specific enum. Consider using a union type to match the schema for better type safety: `operator?: &#39;eq&#39; | &#39;gt&#39; | &#39;gte&#39; | &#39;lt&#39; | &#39;lte&#39; | &#39;in&#39; | &#39;like&#39; | &#39;contains&#39; | &#39;and&#39; | &#39;or&#39; | &#39;not&#39;;`</comment>

<file context>
@@ -44,9 +44,46 @@ const RegistryServerSchema = z.object({
-const WhereExpressionSchema = z.unknown();
+type WhereExpression = {
+  field?: string[];
+  operator?: string;
+  value?: unknown;
+  conditions?: WhereExpression[];
</file context>
Fix with Cubic

value?: unknown;
conditions?: WhereExpression[];
};

/**
* WhereExpression schema - recursive Zod schema for filtering
* Supports: eq, gt, gte, lt, lte, in, like, contains, and, or, not
*/
const WhereExpressionSchema: z.ZodType<WhereExpression> = z.lazy(() =>
z.object({
field: z.array(z.string()).optional().describe("Field path to filter on"),
operator: z
.enum([
"eq",
"gt",
"gte",
"lt",
"lte",
"in",
"like",
"contains",
"and",
"or",
"not",
])
.optional()
.describe("Comparison or logical operator"),
value: z.unknown().optional().describe("Value to compare against"),
conditions: z
.array(z.lazy(() => WhereExpressionSchema))
.optional()
.describe("Nested conditions for logical operators"),
}),
);

/**
* Legacy simplified where schema for easier filtering
Expand Down
Loading