Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b0b24d3
docs(adr): ADR 253, column defaults have a literal type that codecs d…
wmadden-electric Sep 17, 2026
523ab3b
docs(adr-253): codecs name literal types and gain no methods
wmadden-electric Sep 18, 2026
823df7e
docs(projects): implementation brief for literal types for column def…
wmadden-electric Sep 18, 2026
7b9b17c
Merge remote-tracking branch 'origin/remove-dbgenerated-adr-253' into…
wmadden-electric Sep 18, 2026
1ca4a46
docs(projects): rewrite slice B spec for literal types with numeric t…
wmadden-electric Sep 18, 2026
14b707d
docs(projects): slice B dispatch plan
wmadden-electric Sep 18, 2026
4b9375b
feat(framework-components): literal types for column defaults
wmadden-electric Sep 18, 2026
b5039c6
feat(framework-components): codec descriptors declare their literal t…
wmadden-electric Sep 18, 2026
b54ebd5
feat(framework-components): a default literal tag may name a literal …
wmadden-electric Sep 18, 2026
12b63c2
docs(projects): slice B spec amendments from dispatch 1
wmadden-electric Sep 18, 2026
e6ca2df
fix(framework-components): review findings on the literal types
wmadden-electric Sep 18, 2026
2a81142
feat(codecs): every production codec names the literal types it accepts
wmadden-electric Sep 18, 2026
452549d
feat(codecs): decodeJson reads the value shape of every literal type …
wmadden-electric Sep 18, 2026
bb2006f
docs(projects): slice B spec amendments from dispatch 2 review
wmadden-electric Sep 18, 2026
995427d
fix(codecs): one definition of the text a number literal is written as
wmadden-electric Sep 18, 2026
6f309aa
feat(psl): a column default is a literal of a type its codec accepts
wmadden-electric Sep 18, 2026
0f44d08
docs(projects): slice B spec amendments from dispatch 3
wmadden-electric Sep 18, 2026
0c4fde8
fix(psl): review findings on the literal default path
wmadden-electric Sep 18, 2026
cde06d9
feat(prisma7): a Prisma 7 default is read as a literal of a type too
wmadden-electric Sep 18, 2026
7479ddf
test(prisma7): a Json default whose text is not a JSON document
wmadden-electric Sep 18, 2026
234cbd4
feat(infer): a printed default is the literal its codec reads back
wmadden-electric Sep 18, 2026
b67751b
docs(projects): slice B spec amendments from dispatch 5
wmadden-electric Sep 18, 2026
206c528
fix(infer): a printed default has to read back, not just be writable
wmadden-electric Sep 18, 2026
d4ee2ee
test(journeys): every literal default against a real database
wmadden-electric Sep 18, 2026
1de71e7
docs(projects): slice B spec amendments and follow-ups from dispatch 6
wmadden-electric Sep 18, 2026
c760688
docs(projects): slice B spec amendment from dispatch 6 review
wmadden-electric Sep 18, 2026
107c954
fix(contract): the column-default path is the only one that needs params
wmadden-electric Sep 18, 2026
ed943f4
docs: literal types for column defaults
wmadden-electric Sep 18, 2026
b1c9dad
docs: ADR 253 reads as one decision, and the json escaping example emits
wmadden-electric Sep 18, 2026
f26ae0b
Merge remote-tracking branch 'origin/main' into worktree/literal-type…
wmadden-electric Sep 18, 2026
94a37b8
docs: this ADR is 254; 253 is taken by PSL red-root source ownership
wmadden-electric Sep 18, 2026
4c40666
docs(adr-184): ADR 254 is no longer proposed
wmadden-electric Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/architecture docs/ADR-INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This document provides a comprehensive index of all Architectural Decision Recor
| 249 | Central attribute-spec registry | Registers every model-level and field-level PSL attribute of both families in one place, keyed by level and name, as a spec *factory* over a framework-owned construction-time context (`AttributeSpecContext` / `FieldAttributeSpecContext`) — the uniform signature is what lets the language server invoke the same factories the interpreters run. `assembleAttributeSpecs` merges family built-ins with [ADR 236](adrs/ADR%20236%20-%20Target-contributed%20model%20attributes.md)'s model-attribute descriptors into frozen plain records and restores the factory types core erases (they return `AttributeSpec<never>`, because `refine` makes `Out` contravariant and `unknown` would reject every spec that refines). Registry keys drive unknown-attribute diagnostics at field and model level in both families; block attributes are declared on `AuthoringPslBlockDescriptor.attributes` and parsed by the kit. | [ADR 249 - Central attribute-spec registry.md](adrs/ADR%20249%20-%20Central%20attribute-spec%20registry.md) |
| 250 | Models and views are emitted from the contract | `contract.d.ts` gains a `Models` namespace (one member per model, `<ns>_<Model>`, plus `<ns>_Any<Base>` for each polymorphic base) and a type-only `models` constant; relations are typed as the related member with a phantom `RelationKeys` key so `Scalars<M>` names a default fetch's row and `Shape<M, Spec>` names an application data structure derived from the model, and both ORM collections carry `_row` so `ResultType` names any query's result. To-one nullability is a family hook (SQL reads foreign keys and column nullability; Mongo takes the nullable default); name collisions and non-identifier names are emitter errors | [ADR 250 - Models and views are emitted from the contract.md](adrs/ADR%20250%20-%20Models%20and%20views%20are%20emitted%20from%20the%20contract.md) |
| 253 | PSL red-root source ownership | A PSL parse registers the actual returned red document root with a named `SourceFile`; post-parse diagnostics resolve filenames from the node's owning root through `PslSources`, with no unnamed parse mode or singleton fallback. Output diagnostics may still serialize a `sourceId`, but it originates from `SourceFile.filename`; file-read errors and Prisma7 compatibility plumbing are explicit exceptions. | [ADR 253 - PSL red-root source ownership.md](adrs/ADR%20253%20-%20PSL%20red-root%20source%20ownership.md) |
| 254 | Literal types for column defaults | Every literal column default has a literal type (`string`, `boolean`, the whole-number types by size `i8`–`i64`, `bigint`, `decimal`, `float`, `json`, or a list of those), so a codec descriptor names the types it accepts and gains no methods; a written number's type comes from its own size and precision, never from the column. A codec converts between a named type's value shape and its own stored form inside `decodeJson`. PSL writes a literal as a plain scalar or as an ADR 129 tagged literal (`` json`...` ``); `sql` writes a raw SQL expression instead. Codecs never see PSL syntax. Replaces the PSL half of ADR 184 | [ADR 254 - Literal types for column defaults.md](adrs/ADR%20254%20-%20Literal%20types%20for%20column%20defaults.md) |

## Query System

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

> **Retrospective note.** This ADR's examples use the `defineCodec({...})` factory. That factory was the canonical codec-author surface at the time; it was later retired in favor of class-based authoring: concrete codecs extend `CodecImpl`, descriptors extend `CodecDescriptorImpl`, and per-codec column helpers tie helpers to descriptors with `satisfies`. The ADR's *decision* — that codecs own both wire and JSON-safe representations through `encode` / `decode` + `encodeJson` / `decodeJson` — is unchanged; only the authoring shape has moved on. See [ADR 208 — Higher-order codecs for parameterized types](ADR%20208%20-%20Higher-order%20codecs%20for%20parameterized%20types.md) and the [Codec authoring guide](../../reference/codec-authoring-guide.md) for the current shape.

> **PSL half: see [ADR 254 — Literal types for column defaults](ADR%20254%20-%20Literal%20types%20for%20column%20defaults.md).** The `PslLiteralCodec` interface sketched below is replaced there: codec descriptors name the literal types they are compatible with, codecs gain no methods, and codecs never receive PSL syntax. The JSON half of this ADR is unaffected.

## At a glance

A column with `codecId: "pg/timestamptz@1"` has a default value of `new Date('2024-01-15')` — a JavaScript `Date`. This value has to survive a round-trip through `contract.json`, but `Date` has no JSON representation. The codec handles it:
Expand Down
Loading
Loading