Architecture decision record · ADR-0003

The legacy door uses withDefaults and plain schema-object

Millwork uses option B.

Status
Accepted
Deciders
Joe Gaudet
Created
Updated
PRD
PRD
Related
None

Context

Millwork supports legacy records (decision 1 in the plan). Two bases are possible for a shape on a legacy record:

  • A. @warp-drive/legacy/model-fragments: withLegacy, withFragmentDefaults and the Fragment extension.
  • B. @warp-drive/legacy/model/migration-support: withDefaults with a plain schema-object field.

Both work in the spike, on 5.8.0 and on 5.9.1.

Decision drivers

Not recorded in the original ADR.

Options considered

Not recorded in the original ADR.

Decision

Millwork uses option B. It does not depend on the model-fragments layer.

Consequences

  • Option A gives a per-object hasDirtyAttributes and rollbackAttributes. But the dirty flag is per top-level field, and no API names the changed path. Millwork must add per-path change tracking (plan section 4.5) in both cases. So option A gives little that Millwork can use.
  • Option A needs the fragment: type prefix, the modelFragments: true store option and the ember-object extensions. These names and behaviors would show through the Millwork API. The plan does not permit the word "fragment" in the API.
  • Option B needs only a legacy-mode schema. The record is editable with no checkout. changedAttributes() and rollbackAttributes() work for the whole record.
  • A real legacy Model class cannot hold a shape. Its @attr transform runs only in a serializer, so store.push gives the raw value. An in-place edit of a plain object @attr is not tracked. So a Model with a shape must move to a withDefaults schema. Plan change: the class form @shape(...) on a Model (plan section 4.3) must make a withDefaults schema, not a Model attribute. M3 must confirm this with a test app.
  • A value codec on a Model stays a transform:<name> for the serializer.

Confirmation

Evidence

  • packages/warp-drive/tests/spikes/s4-legacy-door.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/0003-legacy-door-base.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/0003-legacy-door-base.md

Changelog

DateAuthorChange
2026-12-01Joe GaudetStatus in the Markdown file: Accepted (M0, spike S4).
2026-12-01Joe GaudetCommit 0a16254: Build Millwork 1.0 (#1)
2026-12-04Joe Gaudet (agent)Converted from docs/adr/0003-legacy-door-base.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.