fix(codegen/cli): make autoEmbedWhere/autoEmbedInput generic in embedder template#1005
Merged
pyramation merged 1 commit intomainfrom Apr 18, 2026
Merged
Conversation
…der template
The CLI codegen emits calls like `findManyArgs.where = await autoEmbedWhere(findManyArgs.where ?? {}, ['embedding'], embedder)` and `await autoEmbedInput(cleanedData, ['embedding'], embedder)` where the first argument is a concrete `*Filter` / `*Patch` type produced by `input-types.ts`. Those generated types don't have a string index signature, so under strict `tsc` every call site errors with:
error TS2345: Argument of type 'XxxFilter' is not assignable to
parameter of type 'Record<string, unknown>'. Index signature for
type 'string' is missing in type 'XxxFilter'.
CI for consumers (agentic-db et al.) passes via `ts-jest`, which is lenient about index-signature / excess-property checks, but `makage build` on publish is strict and fails across all generated `commands/*.ts` files.
Make both helpers generic (`<T extends object>(x: T, ...): Promise<T>`) and cast to `Record<string, unknown>` internally for the field-name indexing. Runtime behavior is unchanged (mutation in place, same return semantics), and call sites now type-check as-is without any generator change.
Consumer-side point fix already landed in constructive-io/agentic-db#29; this PR fixes the upstream template so the next `pnpm generate:all` in any consumer emits a correctly-typed `embedder.ts`.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
devin-ai-integration bot
pushed a commit
to constructive-io/agentic-db
that referenced
this pull request
Apr 18, 2026
…uctive-io/node to ^0.10.3, graphql-server-test to ^2.12.2 Picks up the upstream embedder template fix (constructive-io/constructive#1005) so the next `pnpm generate:all` regenerates sdk/cli/generated/cli/embedder.ts with the generic autoEmbedWhere/autoEmbedInput signatures already on main, rather than the old narrow Record<string, unknown> shape that broke lerna publish with 74 TS2345 errors.
2 tasks
devin-ai-integration bot
pushed a commit
to constructive-io/agentic-db
that referenced
this pull request
Apr 18, 2026
…uctive-io/node to ^0.10.3, graphql-server-test to ^2.12.2 Picks up the upstream embedder template fix (constructive-io/constructive#1005) so the next `pnpm generate:all` regenerates sdk/cli/generated/cli/embedder.ts with the generic autoEmbedWhere/autoEmbedInput signatures already on main, rather than the old narrow Record<string, unknown> shape that broke lerna publish with 74 TS2345 errors.
3 tasks
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
The generated
embedder.tstemplate atgraphql/codegen/src/core/codegen/templates/embedder.tscurrently typesautoEmbedWhereandautoEmbedInputto acceptRecord<string, unknown>— but the CLI codegen emits call sites that pass concrete generated*Filter/*Patchtypes (no index signature).ts-jestis lenient enough that downstream test runs stay green, but the stricttscpass onlerna publishfails with ~74 TS2345 errors per consumer ("… is not assignable to parameter of type 'Record<string, unknown>'").This was already patched directly on the generated file in
constructive-io/agentic-dbas part of unblocking theirlerna publish(agentic-db#29). Without this upstream fix, the nextpnpm generate:allin any consumer that uses the embedder helpers will regenerate the narrow signatures and re-break publish.Fix: make both helpers generic, preserving the caller's concrete type and casting to
Record<string, unknown>internally for field lookup. Runtime behavior is identical.Review & Testing Checklist for Human
pnpm generate:allin agentic-db against this branch) and confirm the regeneratedembedder.tsmatches the patch that landed in agentic-db PR Feat/test graphile #29.lerna publish's strict tsc pass succeeds on a consumer that exercisesautoEmbedWhere/autoEmbedInputcall sites from CLI commands with concrete*Filter/*Patchtypes.Notes
EmbedderFunctionor to the call-site codegen.agentic-dbatsdk/cli/generated/cli/embedder.ts, so this upstream change just prevents the next regen from reverting it.Link to Devin session: https://app.devin.ai/sessions/fabecb6a46504fc293feca22d9cc91d4
Requested by: @pyramation