Skip to content

A list with two embedding fields double-writes on generation once the write surface lands #1283

Description

@borisno2

The problem

A list with more than one embedding field double-writes on generation.

RAG generates in an afterTransaction hook and protects against re-entry by comparing the stored source hash: the sudo write names only the embedding column, so its own re-entrant pass sees an unchanged hash and returns. That reasoning holds for one field. With two embedding fields on the same list, each sudo write re-enters the hook, and the other field's pass has no stored hash yet, so it writes again.

The result is redundant provider calls and redundant writes, growing with the number of embedding fields on the list.

Why it is latent today

The secured write surface does not execute at all on prisma-8write-pipeline.ts still speaks Prisma 6 — so the sudo write currently fails before any of this can happen. This becomes live the moment #1124 lands.

What to do

Make the re-entry protection independent of how many embedding fields a list has. Either mark the sudo write so the hook can recognise its own re-entry directly, or generate every embedding field for a row in one pass rather than one write per field.

The acceptance test is a list with two embedding fields producing exactly one provider call per field per source change.

Context


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prisma8Relates to the Prisma 8 migration (prisma-8 branch)bugSomething isn't workingpriority:mediumShould land before or shortly after release; has a workaround or narrow blast radiuswontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions