Architecture decision record · ADR-0012

The legacy door, and codec registration by name

Codecs are registered by name.

Status
Accepted
Deciders
Joe Gaudet
Created
Updated
PRD
PRD
Related
None

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. Then transformations() (the SchemaRecord door), @field('datetime') (shapes) and registerTransforms(owner, { datetime }) (the @attr door) find it.
  • @millwork-ts/warp-drive/legacy gives one transform for each core codec (transforms) and a factory (codecTransform(codec)). Each core codec has an app/transforms/<name>.js file, so @attr('money', { wire: 'decimal' }) needs no file in the app. A test checks that the app-js map names each codec in codecs.
  • @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, then withDefaults(modelSchema('order', Order)). The app passes the result to the withDefaults of @warp-drive/legacy. The legacy entry does not import it, so it loads no WarpDrive code.
  • ember-data runs an @attr transform only in a serializer. store.push does not run it, so a pushed Model record shows the raw value (spike S4). The CodecTransform docs say this.

Consequences

  • A Model with a shape moves to a withDefaults schema (ADR 0003). The Ember example app uses the class form on a legacy-mode store.
  • An adapter codec on the @attr door needs registerTransforms in 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.

QuestionAnswerSource
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

DateAuthorChange
2026-12-01Joe GaudetStatus in the Markdown file: Accepted (M2). This answers open question 3 of the plan.
2026-12-01Joe GaudetCommit 0a16254: Build Millwork 1.0 (#1)
2026-12-04Joe 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.