Add circuit reorder history

This commit is contained in:
2026-07-24 08:21:32 +02:00
parent 53282e8c7c
commit 332dfdb5d9
14 changed files with 865 additions and 16 deletions
+13 -8
View File
@@ -27,14 +27,14 @@ The public dispatcher currently supports `circuit.update`, `circuit.insert`,
`circuit.delete`, `circuit-device-row.update`,
`circuit-device-row.insert`, `circuit-device-row.delete` and
`circuit-device-row.move` plus
`circuit-device-row.move-with-new-circuit`, all with schema version `1`. Other
command types are rejected. Insert commands contain the complete entity or
circuit block with stable ids; delete commands include the expected parent
identity. Circuit snapshots contain zero, one or multiple complete device
rows. Move commands contain each row's expected and target circuit plus its
exact expected and target sort order. This makes deletion and moves undoable
without generating replacement identities or renumbering circuits. The editor
does not consume these endpoints yet.
`circuit-device-row.move-with-new-circuit` and `circuit.reorder-section`, all
with schema version `1`. Other command types are rejected. Insert commands
contain the complete entity or circuit block with stable ids; delete commands
include the expected parent identity. Circuit snapshots contain zero, one or
multiple complete device rows. Move commands contain each row's expected and
target circuit plus its exact expected and target sort order. This makes
deletion and moves undoable without generating replacement identities or
renumbering circuits. The editor does not consume these endpoints yet.
`circuit-device-row.move` targets existing circuits in the same circuit list.
`circuit-device-row.move-with-new-circuit` atomically creates exactly one
@@ -43,6 +43,11 @@ rows into it. Its inverse restores every row to its exact prior position and
deletes the generated circuit only if its fields and complete row set still
match the recorded state.
`circuit.reorder-section` requires one assignment for every circuit currently
in the section. Each assignment records the expected and target `sortOrder`.
The command and its inverse change no circuit field other than `sortOrder`;
equipment identifiers and complete device-row blocks remain unchanged.
Example:
```json
+6 -3
View File
@@ -95,9 +95,12 @@ Kompositkommando `circuit-device-row.move-with-new-circuit` bildet auch das
Verschieben auf einen freien Platz ab: Ein Zielstromkreis mit stabiler UUID und
BMK wird zusammen mit allen Zeilenbewegungen erzeugt. Undo stellt die exakten
Quellpositionen wieder her und löscht den erzeugten Stromkreis nur, wenn dessen
Felder und vollständiger Zeilenbestand unverändert sind. Circuit-Sortierung,
Neunummerierung und Synchronisierung müssen vor der Frontend-Umstellung noch
als persistente Commands modelliert werden.
Felder und vollständiger Zeilenbestand unverändert sind.
`circuit.reorder-section` speichert die erwartete und neue Sortierposition
jedes Stromkreises eines vollständigen Abschnitts. Forward, Undo und Redo
ändern ausschließlich `sortOrder`; Stromkreisblöcke, Gerätezeilen und BMKs
bleiben unverändert. Neunummerierung und Synchronisierung müssen vor der
Frontend-Umstellung noch als persistente Commands modelliert werden.
## Projektgeräte
@@ -186,13 +186,16 @@ Completed foundation:
empty target-circuit snapshot; forward creation and all row moves share one
transaction, while undo restores the source positions and deletes only an
unchanged generated target
- `circuit.reorder-section` requires the complete section circuit set and
stores exact expected/target sort positions; its inverse changes no
equipment identifier and never splits a circuit block
Remaining constraints before completing persistent history:
- extend the concrete project-scoped command union and executors beyond the
Circuit field/insert/delete and CircuitDeviceRow
field/insert/delete/move slices; the generic versioned command envelope is
complete
field/insert/delete/move plus section-reorder slices; the generic versioned
command envelope is complete
- route the remaining structural, synchronization and destructive domain
writes through the shared command, revision and stack transaction boundary
- replace the session-local frontend command stack only after server-side
@@ -401,6 +401,8 @@ Implemented foundation:
- placeholder-target moves persist one complete generated circuit identity and
all row positions atomically; undo restores every source and removes only an
unchanged generated circuit, without renumbering
- complete section reorders persist every expected and target circuit
`sortOrder`; undo/redo changes neither equipment identifiers nor device rows
- revision metadata, change-set payloads and the project counter are committed
in one SQLite transaction
- a stale expected revision produces no history writes