From 43ce55ec92b209df37c109eb6e57f6d77e561d3e Mon Sep 17 00:00:00 2001 From: Lucas Jiang Date: Sun, 15 Nov 2026 23:01:31 +0800 Subject: [PATCH 1/2] test(graphile-llm): {col}Text only on inputs that can write {col} A patch type without the vector field (the role may not update the column) still gets the text companion, so the text is embedded and then dropped. Fails until the companion follows the vector field. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../src/__tests__/embed-inputs.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/graphile/graphile-llm/src/__tests__/embed-inputs.test.ts b/graphile/graphile-llm/src/__tests__/embed-inputs.test.ts index 2a4fb256f6..66a2247e93 100644 --- a/graphile/graphile-llm/src/__tests__/embed-inputs.test.ts +++ b/graphile/graphile-llm/src/__tests__/embed-inputs.test.ts @@ -79,6 +79,12 @@ const SETUP_SQL = ` ('warehouse-lease.txt', 'warehouse lease and monthly rent', '[1,0,0]'), ('q3-results.txt', 'quarterly revenue results', '[0,1,0]'), ('breach-report.txt', 'customer data breach', '[0,0,1]'); + CREATE TABLE llm_embed_inputs.frozen_docs ( + id serial PRIMARY KEY, + name text NOT NULL, + embedding vector(3) + ); + COMMENT ON COLUMN llm_embed_inputs.frozen_docs.embedding IS E'@behavior -attribute:update'; `; interface Harness { @@ -192,6 +198,23 @@ describe('plan-time embedding (onQuotaExceeded: degrade)', () => { expect(errors).toEqual([[], [], []]); }); + it('offers {col}Text only on inputs that can write {col}', async () => { + const fields = async (type: string) => { + const r = await h.query<{ t: { inputFields: Array<{ name: string }> } }>( + `{ t: __type(name: "${type}") { inputFields { name } } }` + ); + return r.data!.t.inputFields.map((f) => f.name).filter((n) => n.startsWith('embedding')); + }; + expect(await fields('FrozenDocInput')).toEqual(['embedding', 'embeddingText']); + expect(await fields('FrozenDocPatch')).toEqual([]); + + const update = await h.query( + 'mutation { updateFrozenDocByRowId(input: { rowId: 1, frozenDocPatch: { embeddingText: "rent" } }) { frozenDoc { rowId } } }' + ); + expect(update.errors?.[0]?.message).toMatch(/embeddingText/); + expect(calls).toHaveLength(0); + }); + describe('embedder returning the provider shape', () => { beforeEach(() => { shape = 'result'; }); From d9e213b2a088a6e2a60a9438d35033bb2ca971b3 Mon Sep 17 00:00:00 2001 From: Lucas Jiang Date: Sun, 15 Nov 2026 23:01:39 +0800 Subject: [PATCH 2/2] fix(graphile-llm): add {col}Text only where the input has {col} The companion was added for every vector column of the codec, including patches that omit the column because the role cannot update it. The text was accepted, embedded, and written into a field nothing applies, while the field's description says it lands in the column. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- graphile/graphile-llm/src/plugins/text-mutation-plugin.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/graphile/graphile-llm/src/plugins/text-mutation-plugin.ts b/graphile/graphile-llm/src/plugins/text-mutation-plugin.ts index d5847645a6..9f2a847021 100644 --- a/graphile/graphile-llm/src/plugins/text-mutation-plugin.ts +++ b/graphile/graphile-llm/src/plugins/text-mutation-plugin.ts @@ -2,7 +2,7 @@ * LlmTextMutationPlugin * * Adds `{columnName}Text: String` companion fields on create/update mutation - * inputs for every vector column. When the client provides a text string in + * inputs that carry the vector column's own field. When the client provides a text string in * the companion field, the plugin embeds it server-side and injects the * resulting vector into the actual column. * @@ -144,7 +144,10 @@ export function createLlmTextMutationPlugin(): GraphileConfig.Plugin { } const vectorField = newFields[fieldName]; - const required = !!vectorField && isNonNullType(vectorField.type); + if (!vectorField) { + continue; + } + const required = isNonNullType(vectorField.type); if (required) { newFields = { ...newFields,