You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A Mongo contract written in PSL and the same contract written in TypeScript get different storage hashes #30464
What a user sees. Two Mongo contracts that describe the same collections, one authored in PSL and one with the TypeScript builder, never share a storageHash. The PSL interpreter derives a $jsonSchema validator for each collection and hashes a storage projection that includes it; the TypeScript builder derives no validator and hashes a different projection. So a project that moves between the two authoring styles sees its storage hash change, and db verify / db sign treat the database as out of date, although nothing about the collections changed. It also means a TypeScript-authored contract gets no collection validator at all.
Where.packages/2-mongo-family/2-authoring/contract-psl/src/interpreter.ts (validator derivation and storage building through buildMongoStorage) against packages/2-mongo-family/2-authoring/contract-ts/src/contract-builder.ts (its own storage construction and computeStorageHash).
Likely fix. Build TypeScript-authored storage through the same buildMongoStorage in @internal/mongo-contract that the PSL interpreter and the Prisma 6 reader use, including validator derivation. This re-hashes every TypeScript-authored Mongo contract, so it needs an upgrade instruction to re-emit and re-sign. See also the issue about the TypeScript builder's own enum encoding and storage hashing.
Activity