Skip to content

TML-3389: Generator arguments and discriminator values are typed values, and a generator must fit its column - #30792

Merged
wmadden merged 82 commits into
mainfrom
tml-3389-typed-written-values
Oct 20, 2026
Merged

wmadden merged 82 commits into
mainfrom
tml-3389-typed-written-values

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
model Token {
  id    String     @id @onCreate(nanoid(8.5))
  code  VarChar(5) @onCreate(uuid())
  kind  String     @onCreate(uuid(5))
}
Before After
nanoid(8.5) Expected an integer literal (PSL_INVALID_ATTRIBUTE_SYNTAX) Expected a number that pg/int4 can hold; got pg/numeric (PSL_VALUE_TYPE_INCOMPATIBLE), at the argument
uuid(5) Expected one of: 4 | 7 (PSL_INVALID_ATTRIBUTE_SYNTAX) uuid: version must be 4 or 7, got 5 (PSL_INVALID_GENERATOR_ARGUMENT), at the argument
uuid(5) in a Prisma 7 schema silently becomes a version 4 UUID refused with the same message
uuid() on a VarChar(5) column emits, then every insert fails uuid() writes 36 characters, which does not fit a column of 5 characters.
Hover on uuid( uuid((4 | 7)?) unchanged

The decision

The arguments of the client generators uuid, cuid and nanoid are values of the target's integer type, read by the same rule as a column default, then checked by the generator itself. A generator is refused on a column too short for what it writes. A polymorphic model's discriminator value is a value of the discriminator column's text type. This is the last part of the "Data types own column types" project (Linear TML-3389).

How it works

What the rule is. Since ADR 254, a value written in a schema has a data type, and a position takes it only if the position's type is that type or declares a cast from it. Defaults follow that rule. Generator arguments did not: nanoid(8)'s 8 was checked by a hand-written "integer between 2 and 255" shape, so the errors were generic and the limits were written in five places.

Generator arguments are typed values. uuid(version?), cuid(version) and nanoid(size?) now take one value of the target's integer type (pg/int4 on Postgres, sqlite/integer on SQLite), read and cast like a default, and then the generator checks its own limit: uuid 4 or 7, cuid 2, nanoid 2 to 255. A decimal such as 8.5 or 4.0 is not an integer value, so it reports the missing cast. The limits are written once, in @internal/ids. Hover and signature help keep showing the allowed values, uuid((4 | 7)?).

The Prisma 7 reader uses the same signatures. It used to accept any argument and lower uuid(5) to version 4 and pass nanoid(1) through. It now refuses those, and named arguments, with the same messages.

Generators fit their column. Each generator states how many characters it writes (uuid 36, ulid 26, cuid 24, ksuid 27, nanoid its size), and a column whose length is shorter refuses it. The length is read in the column type's normal form, so a bare Char counts as one character. SQLite is never refused, because SQLite does not limit a text column's length. contract print uses the same check, and says why when it refuses.

Discriminator values are values of the column's type. @@base(Shape, "circle") now reads "circle" into the discriminator column's type, so a VarChar(5) discriminator refuses it as too long, and duplicates are compared by stored value. A discriminator column may be any of the target's text types: String, Char(n) or VarChar(n) on Postgres, String or sql.String(n) on SQLite. Each target names its text types once (textDataTypes), and an extension may add its own. The ORM already read and wrote the discriminator through the column's codec, which a Char(n) column's padding needs; a round trip is now tested.

Built on ADR 275. While this was being built, main moved client generators to @onCreate and @onUpdate, bound to codecs (ADR 275). This pull request follows that design: which columns a generator applies to is still decided by its codec binding, and the length check lives in those bindings.

What users and extension authors see

Upgrade notes are in upgrade-instructions/pending/generator-function-arguments-and-column-length/.

  • Applications: the new messages and code; decimal, out-of-range and named arguments refused, including in Prisma 7 schemas (uuid(5) used to make version 4 UUIDs, so write uuid(4) to keep them); generators refused on a column too short for them; the discriminator message now says "must be text".
  • Extension authors: the target declares uuid, cuid and nanoid with its integer type through sqlIntegerArgumentGeneratorFunctions; a generator signature may be a function of the stack's data types; GeneratorFunctionField.length is required; buildContractDefinition requires the codec and data type lookups; the new textDataTypes contribution.

No committed contract, migration or snapshot changes, and no DDL changes.

How it was checked

  • Every message, code and position on Postgres and SQLite, and through the Prisma 7 reader.
  • The length rule against the real generators: each one, run 200 times, writes exactly the length it states.
  • Discriminators on String, Char(6) and VarChar(10): create, polymorphic read and variant() through the ORM on PGlite and SQLite.
  • An in-loop review of each part and a two-part branch review, with findings and rulings in projects/data-types-completion/slices/5/build-review.md.
  • Manual QA (projects/data-types-completion/slices/5/manual-qa.md): the above end to end against PostgreSQL 17 and SQLite, the language server's hover over stdio, and contract print reading back to identical hashes.

Not in this pull request

  • Enum member values, enum CHECK constraint literals and Mongo validator enums: another project is changing how enum members are read.
  • Integer or other non-text discriminators. The contract keys variants by their value as text, and the ORM's variant() takes that text; changing either is a new feature.
  • Recorded in projects/data-types-completion/deferred.md: Mongo still checks its discriminator by the type name String; an optional discriminator field is accepted.

Alternatives considered

  • Keep generator arguments as shape checks with better messages. The limits would stay copied in five places, and a decimal argument would still be read through a JavaScript number before anything checks it.
  • Decide which columns a generator applies to by data type. This branch did that first. ADR 275, merged meanwhile, chose codec bindings on purpose, because two codecs of one data type expect different in-memory values, so this branch moved onto the bindings.
  • Allow integer discriminators. That needs a new contract shape for variants and a new argument type for variant(); it is not needed to type the values that exist today.

Agent: frigg-97

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added validation and clearer diagnostics for UUID, CUID, and NanoID generator arguments.
    • Generator output is checked against supported SQL column lengths.
    • Added typed generator arguments, improved completion suggestions, and clearer diagnostic labels.
    • SQL discriminator values support compatible text types, including extension-defined and bounded character columns.
    • Added SQL support for autoincrement() and now() default functions.
  • Bug Fixes

    • Improved Prisma default-function argument and discriminator-value validation.
  • Documentation

    • Added upgrade guidance and error-reference documentation for generator arguments, column lengths, and discriminator behavior.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… in @internal/ids

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…nts are integer values

The SQL family declares autoincrement, now, ulid, uuid, cuid and nanoid once,
in sqlDefaultFunctionSignatures({ integer }); Postgres passes pg/int4 and SQLite
sqlite/integer, and the adapters keep only lowering. Each argument of uuid, cuid
and nanoid is read like a default of the integer type, then checked by its
function, reporting PSL_INVALID_DEFAULT_FUNCTION_ARGUMENT at the argument.
Arity messages name the callee as a default function.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… fixed or built from the data types

An extension that registers a default function with a plain signature keeps
working; only signatures whose arguments are values of a data type are built
from the stack's data types.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…_INVALID_DEFAULT_FUNCTION_ARGUMENT

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…checks a parsed value

The SQL family's integer arguments now refine a dataTypeValue instead of
copying its fields into a new argument type.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…d nanoid from the data types

Its invalid-argument test expects the shipped messages and code, and a new test
registers one signature as an object and one built from the data types.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…porary folders

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…efault function's call

The @default arms use it, and it is exported so another contract source binds a
default function's arguments the same way.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…checked through the signatures

The Prisma 7 reader binds uuid, cuid and nanoid arguments as Prisma 8 PSL does,
so uuid(5) and nanoid(1) are refused with the function's message at the argument
under PSL.PRISMA7_UNKNOWN_DEFAULT instead of lowering to something else.
FUNCTION_ARGUMENT_KEYS is gone; Prisma 7's cuid() still means cuid(2).

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
applicableCodecIds becomes applicableDataTypes, passed by each target: text
generators apply to pg/text, pg/char and pg/varchar on Postgres and to
sqlite/text, sqlite/character and sqlite/character-varying on SQLite, and the
UUID generators add pg/uuid. The check compares the column's data type, so
String @default(uuid()) now emits on SQLite.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…String column

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…descriptor is an internal error

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…iminator column's type

A @@base value is read, cast into the discriminator column's data type and
checked by its codec, like a default, and the duplicate check compares the
stored values. A discriminator column may be any text type (String, Char,
VarChar), so a number is refused at the value and a VarChar(5) column refuses
a longer value.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… through the ORM on PGlite and SQLite

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…item is done

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…named text types

Each SQL target names its text data types (text, character, character varying),
declares them as authoring textDataTypes and passes the same list to its
generator descriptors. A discriminator column is accepted only when its data
type is one of them, so Uuid, Inet and Bit columns are refused as before.

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric and others added 10 commits October 20, 2026 15:18
…d sits above it again

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
GeneratorFunctionField.length is a required key typed number | undefined. The PSL reader, the TypeScript builder, the Prisma 7 reader (now() for @updatedat included) and contract print pass the column's length in its normal form, through sqlCodecColumnLength in sql-contract; Mongo passes undefined. contract print now refuses a generator its read-back would refuse, such as uuid() on a Char(5) column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…es, and the extension notes say so

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ator call it would write is refused

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…e discriminator note names Postgres and SQLite columns

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric requested a review from a team as a code owner October 20, 2026 13:50
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: prisma/orm/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d0d3a335-f39c-43cb-9cc4-bbaf2f5be9f7
📥 Commits

Reviewing files that changed from the base of the PR and between 50ca1f2 and d5ba3b1.

⛔ Files ignored due to path filters: 15
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • projects/data-types-completion/deferred.md is excluded by !projects/**
  • projects/data-types-completion/plan.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/common-rules.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/dispatch-a.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/dispatch-b.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/dispatch-c.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/dispatch-d.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/dispatch-e.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/dispatch-f-port-onto-adr-275.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/review-fixes.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/briefs/reviewer.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/build-review.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/manual-qa.md is excluded by !projects/**
  • projects/data-types-completion/slices/5/plan.md is excluded by !projects/**
📒 Files selected for processing: 4
  • docs/architecture docs/adrs/ADR 254 - Data types and casts.md
  • packages/2-sql/2-authoring/contract-prisma7/README.md
  • packages/2-sql/2-authoring/contract-prisma7/src/defaults.ts
  • packages/2-sql/2-authoring/contract-prisma7/src/interpreter.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The change adds typed generator-argument validation, generator-to-column length checks, Prisma 7 default-function parsing, SQL discriminator handling, framework APIs, tests, documentation, and upgrade instructions.

Changes: SQL authoring and generator behavior

Layer / File(s) Summary
Typed argument binding and signatures
packages/1-framework/2-authoring/psl-parser/..., packages/1-framework/3-tooling/language-server/...
PSL argument specifications support labels, suggestions, refinements, and signatures that depend on data types. Language-server completions include scalar suggestions.
Generator arguments and column lengths
packages/1-framework/2-authoring/ids/..., packages/2-sql/..., packages/3-targets/..., test/integration/test/authoring/...
SQL generator signatures validate typed integer arguments against shared limits. Generator resolution receives normalized column lengths and checks whether generated identifiers fit.
Prisma 7 default-function parsing
packages/2-sql/2-authoring/contract-prisma7/..., packages/2-sql/9-family/..., packages/3-targets/6-adapters/...
Prisma 7 binds default-function arguments through typed signatures. SQL adapters use shared default-function handlers.
Text-typed SQL discriminators
packages/1-framework/..., packages/2-sql/2-authoring/contract-psl/..., packages/3-targets/..., test/integration/test/...
Authoring contributions identify text data types. SQL discriminator fields resolve through column codecs, and @@base values are lowered using the discriminator column type.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant SchemaReader
  participant PSLArgumentBinder
  participant GeneratorFunctionRegistry
  participant ContractLowering
  SchemaReader->>PSLArgumentBinder: Parse typed generator arguments
  PSLArgumentBinder->>GeneratorFunctionRegistry: Resolve generator with codec and arguments
  ContractLowering->>GeneratorFunctionRegistry: Resolve field with normalized column length
  GeneratorFunctionRegistry->>ContractLowering: Return resolved generator or refusal
Loading
sequenceDiagram
  participant PSLInterpreter
  participant DataTypeDefaultLowering
  participant ColumnCodec
  participant PolymorphismResolution
  PSLInterpreter->>DataTypeDefaultLowering: Lower written @@base scalar
  DataTypeDefaultLowering->>ColumnCodec: Convert value using discriminator column type
  DataTypeDefaultLowering->>PSLInterpreter: Return converted value or diagnostics
  PSLInterpreter->>PolymorphismResolution: Provide resolved discriminator values
Loading

Suggested reviewers: sevinf

Merge Risk: ⚪ Minimal · up to d5ba3

No actionable issue remains in the reviewed changes; merge after normal checks.

Security architecture risk: 🔵 Low · up to d5ba3

The inspected changes strengthen validation without establishing a new privilege or execution path. Invalid defaults are rejected before a usable contract is produced. Stricter schema acceptance and incomplete coverage of the broader type changes warrant a low assessment rather than minimal.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected changed path is reached through schema default expressions and affects generated values for the corresponding model fields. It does not establish a new request-level entrypoint or broader generator authority.

Trust Boundaries and Controls

  • observed — Ordinary generator defaults must pass the supported-function allowlist, target-codec lookup, signature binding, and registry resolution. Execution subsequently resolves the selected generator through its registry and filters default application by mutation scope and explicit field values.

Resilience and Maintainability Implications

  • observed — The new lazy argument context is owned by one document within one interpretation. Binder construction allocates local state; the shared empty registries are not mutated by the inspected binding path. Failure diagnostics remain invocation-local and prevent partial contract publication.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.32% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 62 functions across 54 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: typed generator arguments and discriminator values, plus generator column-length validation.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.32% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 62 functions across 54 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma/orm-extension-arktype-json

npm i https://pkg.pr.new/@prisma/orm-extension-arktype-json@30792

@prisma/orm-extension-middleware-cache

npm i https://pkg.pr.new/@prisma/orm-extension-middleware-cache@30792

@prisma/orm-extension-paradedb

npm i https://pkg.pr.new/@prisma/orm-extension-paradedb@30792

@prisma/orm-extension-pgvector

npm i https://pkg.pr.new/@prisma/orm-extension-pgvector@30792

@prisma/orm-extension-postgis

npm i https://pkg.pr.new/@prisma/orm-extension-postgis@30792

@prisma/orm-extension-supabase

npm i https://pkg.pr.new/@prisma/orm-extension-supabase@30792

@prisma/orm-family-mongo

npm i https://pkg.pr.new/@prisma/orm-family-mongo@30792

@prisma/orm-family-sql

npm i https://pkg.pr.new/@prisma/orm-family-sql@30792

@prisma/orm-framework

npm i https://pkg.pr.new/@prisma/orm-framework@30792

@prisma/orm-mongo

npm i https://pkg.pr.new/@prisma/orm-mongo@30792

@prisma/orm-postgres

npm i https://pkg.pr.new/@prisma/orm-postgres@30792

@prisma/orm-sqlite

npm i https://pkg.pr.new/@prisma/orm-sqlite@30792

@prisma/orm-target-mongo

npm i https://pkg.pr.new/@prisma/orm-target-mongo@30792

@prisma/orm-target-postgres

npm i https://pkg.pr.new/@prisma/orm-target-postgres@30792

@prisma/orm-target-sqlite

npm i https://pkg.pr.new/@prisma/orm-target-sqlite@30792

@prisma/orm-toolchain

npm i https://pkg.pr.new/@prisma/orm-toolchain@30792

commit: d5ba3b1

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
postgres / no-emit 259.37 KB (+0.22% 🔺)
postgres / emit 229.06 KB (-0.01% 🔽)
mongo / no-emit 211.14 KB (+0.1% 🔺)
mongo / emit 182.13 KB (0%)
cf-worker / no-emit 321.76 KB (+0.24% 🔺)
cf-worker / emit 288.14 KB (+0.04% 🔺)

@wmadden
wmadden added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 20, 2026
…ped-written-values

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

# Conflicts:
#	packages/2-sql/2-authoring/contract-psl/src/interpreter.ts
@wmadden
wmadden enabled auto-merge October 20, 2026 16:18
@wmadden
wmadden added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 20, 2026
…n's fix hint

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden
wmadden enabled auto-merge October 20, 2026 17:01
…ped-written-values

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

# Conflicts:
#	docs/architecture docs/adrs/ADR 254 - Data types and casts.md
@wmadden
wmadden added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit dd160d1 Oct 20, 2026
24 checks passed
@wmadden
wmadden deleted the tml-3389-typed-written-values branch October 20, 2026 18:10
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-prisma__orm that referenced this pull request Oct 21, 2026
…cisions, file its deferred work, delete its folder (prisma#30811)

```
$ ls projects/data-types-completion
ls: projects/data-types-completion: No such file or directory
```

## The decision

The "Data types own column types" project (Linear P-TML-1145) is
finished. All of its slices have merged, the last as prisma#30792. This pull
request deletes its working folder, `projects/data-types-completion/`,
after checking that nothing in it is lost.

## What was checked before deleting

**Every decision has a permanent home.** I mapped all 133 decisions
recorded in the project's design notes, design, spec and slice plans to
where they are recorded outside the folder:

| Where the decision stands | Count |
| --- | --- |
| Recorded in an ADR, a reference doc, a README or a released upgrade
instruction | 104 |
| Superseded by a later decision of the project or by ADR 275 | 8 |
| About the project's ordering and process only | 18 |
| True but recorded nowhere, now added here | 3 |

Most decisions live in ADR 254 "Data types and casts". The three that
were missing, now added:

- ADR 254 "Alternatives considered": why `contract.json` does not keep
`nativeType` as a derived copy, and why databases are re-signed with `db
sign` instead of a map from old hashes to new ones or a one-time rewrite
command.
- The CLI README's `db sign` steps: on MongoDB each space's marker is
written on its own, with no transaction around them.

**Stale references fixed.** A code comment in the Postgres Prisma 7 type
map cited the design document by section number. The codec authoring
guide said the Prisma 7 reader "will" use the inferred constructor,
which it already does. The error reference still documented
`CONTRACT.DATA_TYPE_ENTRY_KEY_INVALID`, which the project deleted. ADR
204 named `validateContract`, which is now `contractFromJson`.

**Deferred work is in Linear.** The 27 items in `deferred.md`:

- 16 still open, now filed: TML-3658 to TML-3673.
- 3 open and already ticketed: TML-3598 (stale Supabase
`contract.prisma`), TML-3500 (enum CHECK literals), TML-3470 and
TML-3647 (Mongo validator enums).
- 6 fixed by the project's own slices or by prisma#30790.
- 2 dropped: the Postgres DDL walker reads type text on purpose, because
a hand-written migration column may have no codec; and a number in a
SQLite `DateTime` column is read as milliseconds by design, and Prisma
never writes another form.

**TML-3283** (bytea and vector defaults failing the schema check) was
already Done. I added a comment saying how `main` handles it now:
through the column's codec, as ADR 254 describes.

**Retrospective.** The final retro is in `drive/retro/README.md`. Its
main lesson: before building a slice, look at open and recently merged
work in the same subsystem. A redesign of client generators merged on
`main` while the last slice was being built, and the slice had to be
ported onto it after review.

## Alternatives considered

- **Keep the folder as a historical record.** Git history keeps it, and
a folder that describes finished work as current misleads the next
reader.

Agent: frigg-97

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
* Clarified contract validation, data-type migration, and
database-signing guidance in architecture decision records.
  * Updated Prisma 7 parameterized type-constructor guidance.
* Documented MongoDB’s independent contract-space signing and
PostgreSQL/SQLite all-or-nothing signing behavior.
* Added recurring guidance on concurrent work, testing, validation,
reviews, and database quality checks.
  * Removed the obsolete invalid data-type entry-key error reference.
  * Simplified terminology in PostgreSQL type-mapping documentation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants