Skip to content

The Mongo TypeScript contract builder keeps its own enum encoding and storage hashing #30465

Open

Description

@wmadden-electric

What a maintainer sees. The Mongo PSL interpreter and the Prisma 6 MongoDB schema reader both build storage with buildMongoStorage in @internal/mongo-contract. The TypeScript contract builder does not: it encodes enums and computes the storage hash with its own code. A change to how Mongo storage is built has to be made twice, and the two copies can drift, which is one cause of PSL- and TypeScript-authored contracts hashing differently.

Where. packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts (enum encoding and the computeStorageHash call) against packages/2-mongo-family/1-foundation/mongo-contract/src/build-mongo-storage.ts.

Likely fix. Move the TypeScript builder onto buildMongoStorage, as part of the fix for PSL and TypeScript storage hashes differing.

Where it came from. #30405 unified the PSL interpreter and the Prisma 6 reader on buildMongoStorage and left the TypeScript builder as it was.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions