Skip to content

Commit 383d12a

Browse files
committed
docs(adr-0144): note the currency_field_repointed destructive finding under D5, with a pointer from D2
The metadata save already refuses a re-pointed record-mode currencyField with 409 DESTRUCTIVE_CHANGE (finding currency_field_repointed) and cites "[ADR-0144 D2, D5]", but the ADR did not state the rule. A dated note under D5 now records the trigger, the answer, the reason and the remedies the merged message names; a one-line note under D2 points to it and separates it from the parent-code lock. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUfbR3DhK4kBEC6qWR
1 parent ca3629f commit 383d12a

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎docs/adr/0144-multi-currency-record-currency-dated-rates-write-time-home-projection.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ field refuses at build unless grouped by its code field" (see the note under D6)
244244
> every door shares, so REST, import, flows and bulk updates all meet it. Not chosen: rewriting the children's home
245245
> amounts in cascade, for the three reasons above.
246246
247+
*Note (2026-11-09):* a metadata save that re-points a stored `record`-mode amount's `currencyField` answers 409
248+
`DESTRUCTIVE_CHANGE` with the finding `currency_field_repointed` unless the caller sets `force`; the rule and its
249+
reason are in the note under D5. It is not the lock above: the lock refuses a record write that changes the value of
250+
a parent's code field, while the finding answers a metadata save that changes which field holds an amount's code.
251+
247252
### D3 — Q1: dated rates live in `sys_exchange_rate` (letter A)
248253

249254
- `sys_exchange_rate { currency, rate, effective_date, source }` is a platform system object.
@@ -281,6 +286,27 @@ field refuses at build unless grouped by its code field" (see the note under D6)
281286
#27191's card body draft the rate pointer as optional (`rateField?`). This record corrects that to required. Only the
282287
spelling of the two pointers is #27191's ([Open item](#open-items) 1).
283288

289+
*Note (2026-11-09):* re-pointing a stored amount's code field is a destructive change. D5 stores each conversion "with
290+
the rate used", and a stored home amount changes only through "an explicit recompute operation". An amount's value is
291+
a bare number (ADR-0104 D1), so a metadata save that points a `record`-mode amount's `currencyField` (D2) at another
292+
code converts nothing: every stored row keeps its number and is read in the currency the new pointer holds, and any
293+
stored home amount and rate stay converted from the code the old pointer gave. The Phase 3a destructive gate of the
294+
metadata save (`packages/metadata-protocol/src/protocol-write-face.ts#detectDestructiveObjectChanges`) raises the
295+
finding `currency_field_repointed` when an `object` save changes a stored amount's non-blank pointer to another
296+
non-blank pointer, in all four directions between a sibling code field and the two-segment `master_detail` path of the
297+
D2 amendment. Pointers compare as written, so the same pointer saved again raises nothing. The save is refused before
298+
anything is written, 409 `DESTRUCTIVE_CHANGE` with the finding in its `issues`, unless the caller sets `force`
299+
(`?force=true` on the metadata `PUT`; a door that accepts no `force` names its own way in the message,
300+
`packages/metadata-protocol/src/protocol-write-face.ts#destructiveChangeRemedy`). The finding has its own code. It is
301+
the sibling of `currency_mode_to_record` ([Open item](#open-items) 13), not a `field_type_change`, which fires only
302+
when a field's `type` changes. Like its sibling, it reads no row, fires only where a previous version of the object
303+
exists, and is lifted by the same `force`. The message names the remedies that exist. For a sibling pointer, rows
304+
whose new code is blank take the code backfill of Open item 13, `os migrate record-currency-codes` or, with no shell,
305+
`POST /api/v1/meta/_migrate-record-currency-codes`. A path pointer has no backfill, since the child stores no code.
306+
When the amount declares `homeAmount` before and after the save, the stored home amounts are re-derived by
307+
`os migrate recompute-home-amounts`, the explicit recompute of the third bullet, a shell command with no REST door.
308+
When the save drops `homeAmount`, the message says nothing re-rates them. Landed by #31949 in PR #31969 (`33ab84f9`).
309+
284310
### D6 — Q4: raw aggregates over a record-mode field refuse, and consolidation reads the home field (letter A)
285311

286312
- A raw aggregate over a record-mode amount refuses at build unless it groups by that amount's code field.

0 commit comments

Comments
 (0)