Architecture decision record · ADR-0012
The legacy door, and codec registration by name
Codecs are registered by name.
Context
Not recorded in the original ADR.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
- Codecs are registered by name. Schema options must stay JSON, so a field names its codec.
registerCodecs({ datetime })adds an adapter codec to the core name registry. Thentransformations()(the SchemaRecord door),@field('datetime')(shapes) andregisterTransforms(owner, { datetime })(the@attrdoor) find it. @millwork-ts/warp-drive/legacygives one transform for each core codec (transforms) and a factory (codecTransform(codec)). Each core codec has anapp/transforms/<name>.jsfile, so@attr('money', { wire: 'decimal' })needs no file in the app. A test checks that theapp-jsmap names each codec incodecs.@attr<MoneyTransform>('money', { wire: 'cents' })is a type error. The ember-data attr types accept one JSON type for each transform, so a codec with more than one raw form gets the object type there.- The class form of a legacy-mode schema is in the legacy entry:
@shape(Address),@shapeArray(LineItem, { key })and@value('money', options)on a class, thenwithDefaults(modelSchema('order', Order)). The app passes the result to thewithDefaultsof@warp-drive/legacy. The legacy entry does not import it, so it loads no WarpDrive code. - ember-data runs an
@attrtransform only in a serializer.store.pushdoes not run it, so a pushedModelrecord shows the raw value (spike S4). TheCodecTransformdocs say this.
Consequences
- A
Modelwith a shape moves to awithDefaultsschema (ADR 0003). The Ember example app uses the class form on a legacy-mode store. - An adapter codec on the
@attrdoor needsregisterTransformsin an instance initializer.
Confirmation
Evidence
packages/warp-drive/tests/legacy.test.ts,packages/warp-drive/tests/legacy-types.test.ts
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0012-legacy-door-and-registration.md at commit c8154b0. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0012-legacy-door-and-registration.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-01 | Joe Gaudet | Status in the Markdown file: Accepted (M2). This answers open question 3 of the plan. |
| 2026-12-01 | Joe Gaudet | Commit 0a16254: Build Millwork 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0012-legacy-door-and-registration.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.