feat(adoption): one owner for config/layout identity and the adoption sequence

`src/config-adoption.ts` owns config/layout with revision and fingerprint;
the host keeps `_serverCfg`/`_cfgRev`/`_layout`/`_layoutRev` as delegates.
All seven authoritative adoptions go through `adoptAuthoritativeGated`
(backdrop readiness → continuity → adopt → profile tail); the post-write
paths (space/delete ×2, optimize_undo, import/apply) gain the gate and take
revisions from the re-read bodies. `rollbackOptimistic` moves to the owner;
plan-optimize, space copy and the vacuum writers stop assigning identity.

Issue: #500
User-Visible: no
This commit is contained in:
claude[bot]
2026-09-10 11:41:16 +00:00
parent a44fbd373d
commit 7194fb2df0
57 changed files with 2082 additions and 1063 deletions
+3 -2
View File
@@ -29,7 +29,8 @@ test('#397 AC1: the update branch stores what it sends, before sending it', () =
assert.ok(branch, 'the persist method must be found');
const write = branch.indexOf('this._layout = { ...this._layout, [deviceId]: pos }');
const send = branch.indexOf("type: 'houseplan/layout/update'");
const fingerprint = branch.indexOf('this._layoutContentFingerprint = contentFingerprint(this._layout)');
// #500: the fingerprint is re-paired by the identity owner, not assigned by hand.
const fingerprint = branch.indexOf('this._adoption.refreshLayoutFingerprint()');
assert.ok(write > 0, 'the canonical position must be written back into _layout');
assert.ok(write < send,
'the local copy is updated BEFORE the wire, so a reload racing the answer '
@@ -41,7 +42,7 @@ test('#397 AC1: the update branch stores what it sends, before sending it', () =
test('#397 AC5a: the delete branch removes the key before the fingerprint', () => {
const method = CARD.slice(CARD.indexOf('private async _persistDevicePlacement'));
const apply = method.indexOf('applyDevicePlacement(this._layout, deviceId, placement)');
const fingerprint = method.indexOf('this._layoutContentFingerprint = contentFingerprint(this._layout)');
const fingerprint = method.indexOf('this._adoption.refreshLayoutFingerprint()');
assert.ok(apply > 0 && apply < fingerprint,
'both branches mutate _layout through applyDevicePlacement before the '
+ 'fingerprint is recorded — deletion removes the key, not replaces a value');