leistungsbilanz-ts/src/db/repositories
Julian Appel c6cdfc42d5 Keep manual quantity consistent when synchronizing device rows
Synchronizing a project device pushes its quantity onto every linked
device row, but manualQuantity is not part of the sync snapshot and was
left untouched. A device whose quantity is lower than the row's left the
row at manualQuantity > quantity, violating the snapshot invariant.

The violation surfaced far from its cause: the invariant is only checked
when a full state snapshot is read, and the automatic snapshot runs every
25 revisions. A project could therefore accumulate the broken row
silently and then reject every subsequent command, because the failing
validation rolls back the whole transaction including the revision bump.

Recompute manualQuantity as the synchronized quantity minus the total of
the linked external objects, matching the invariant that
assertCircuitDeviceRowQuantity enforces elsewhere, and reject a
synchronized quantity that falls below that total.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 18:05:50 +02:00
..
automatic-project-snapshot.persistence.ts Add automatic project snapshots 2026-07-25 23:27:51 +02:00
circuit-device-row-move-project-command.repository.ts Create clean release database baseline 2026-07-31 14:07:26 +02:00
circuit-device-row-project-command.repository.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
circuit-device-row-structure-project-command.repository.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
circuit-device-row-structure.persistence.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
circuit-device-row.persistence.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
circuit-device-row.repository.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
circuit-group-move-project-command.repository.ts Persist circuit group moves 2026-07-30 20:03:11 +02:00
circuit-group-renumber-project-command.repository.ts Persist circuit group renumbering 2026-07-30 19:56:59 +02:00
circuit-group-structure-project-command.repository.ts Add circuit group reordering 2026-07-30 19:49:27 +02:00
circuit-group-subtree-project-command.repository.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
circuit-list.repository.ts Inject application database contexts 2026-07-26 12:30:42 +02:00
circuit-project-command.repository.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
circuit-protection-device.repository.ts Expose protected tree structure 2026-07-30 20:14:45 +02:00
circuit-protection-project-command.repository.ts Persist circuit protection updates 2026-07-31 07:37:38 +02:00
circuit-section-renumber-project-command.repository.ts Reuse command transaction boundary 2026-07-26 11:21:01 +02:00
circuit-section-reorder-project-command.repository.ts Reuse command transaction boundary 2026-07-26 11:21:01 +02:00
circuit-section.repository.ts Inject application database contexts 2026-07-26 12:30:42 +02:00
circuit-structure-project-command.repository.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
circuit.persistence.ts Create clean release database baseline 2026-07-31 14:07:26 +02:00
circuit.repository.ts Inject application database contexts 2026-07-26 12:30:42 +02:00
distribution-board-component-structure-project-command.repository.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
distribution-board-component.repository.ts Expose protected tree structure 2026-07-30 20:14:45 +02:00
distribution-board-structure-project-command.repository.ts Create clean release database baseline 2026-07-31 14:07:26 +02:00
distribution-board-subtree-project-command.repository.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
distribution-board.repository.ts Add distribution power summaries 2026-07-29 19:02:18 +02:00
equipment-identifier-uniqueness.persistence.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
external-csv-configuration-project-command.repository.ts Persist Revit CSV configuration 2026-08-02 16:33:18 +02:00
external-csv-configuration.repository.ts Add Revit CSV preview API 2026-08-02 16:49:42 +02:00
external-initial-import-project-command.repository.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
external-model-state.repository.ts Add external model persistence foundation 2026-08-02 17:18:24 +02:00
external-object-assignment.persistence.ts Add external object new circuit command 2026-08-02 18:55:57 +02:00
external-object-new-circuit-project-command.repository.ts Fix code-review findings across domain, persistence, server and frontend 2026-08-06 21:31:16 +02:00
external-object-new-row-project-command.repository.ts Add external object new circuit command 2026-08-02 18:55:57 +02:00
external-object-row-assignment-project-command.repository.ts Add external object new circuit command 2026-08-02 18:55:57 +02:00
floor.repository.ts Add editable project floors and rooms 2026-07-31 14:46:06 +02:00
global-device.repository.ts Standardize phase type labels 2026-07-29 10:46:00 +02:00
project-command-transaction.persistence.ts Centralize device row update transactions 2026-07-26 11:28:06 +02:00
project-device-project-command.repository.ts Derive device voltages from project settings 2026-07-29 09:53:58 +02:00
project-device-row-sync-project-command.repository.ts Keep manual quantity consistent when synchronizing device rows 2026-08-23 18:05:50 +02:00
project-device-structure-project-command.repository.ts Create clean release database baseline 2026-07-31 14:07:26 +02:00
project-device.repository.ts Inject application database contexts 2026-07-26 12:30:42 +02:00
project-history.persistence.ts Restore named project snapshots 2026-07-25 22:41:24 +02:00
project-history.repository.ts Describe snapshot source revisions 2026-07-29 11:52:26 +02:00
project-location-structure-project-command.repository.ts Add editable project floors and rooms 2026-07-31 14:46:06 +02:00
project-revision.persistence.ts Add automatic project snapshots 2026-07-25 23:27:51 +02:00
project-settings-project-command.repository.ts Add public building project setting 2026-07-31 17:41:30 +02:00
project-snapshot.repository.ts Create clean release database baseline 2026-07-31 14:07:26 +02:00
project-state-restore-command.repository.ts Include external models in project snapshots 2026-08-02 17:25:25 +02:00
project-state-snapshot.persistence.ts Add external row quantity foundation 2026-08-02 18:26:22 +02:00
project-transfer.repository.ts Include external models in project snapshots 2026-08-02 17:25:25 +02:00
project-voltage.persistence.ts Derive device voltages from project settings 2026-07-29 09:53:58 +02:00
project.repository.ts Add public building project setting 2026-07-31 17:41:30 +02:00
room.repository.ts Add editable project floors and rooms 2026-07-31 14:46:06 +02:00