mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-26 20:04:12 +02:00
6dcb6a2a8f
qet_diff keyed each conductor on its raw terminal1/terminal2 pair, with a comment claiming that pair was "stable within a folio". It is stable within a folio; it is not stable across a save. QElectroTech reassigns those folio-scoped integer ids on every write, in whatever order it serialises the elements, so one untouched conductor of ArduinoLCD.qet goes from terminal1="1" terminal2="16" to terminal1="34" terminal2="15". Diffing a project against a re-saved copy of itself therefore reported 29 of its 47 conductors as removed and 29 as added, with nothing changed. That is the main thing this tool is for, so the conductor half of the answer was noise in exactly the case it was wanted. The format has two addressing schemes and a file can hold both at once. Older conductors use the integer ids with no element1/element2; current ones use terminal uuids from the .elmt definition plus element1/element2 naming the placed instances. A terminal uuid alone is not an identity -- it belongs to the definition, so two coils of one type share it and a conductor between them keys as a self-loop -- so an end is identified by the (instance, terminal) pair, taken from the conductor where it carries one and resolved through the folio's elements where it does not. Where an element predates persisted uuids there is nothing stable to key on. Keying those on terminal geometry alone collapsed nine distinct conductors of schema_indus.qet onto a single key, which is worse than the instability it was meant to fix, so such ends stay unresolved, keep a "#"-marked key, and the diff reports unstable_keys and says in words that added/removed may not mean what they look like. Measured over the 24 shipped example projects, 3190 conductors: 0 colliding keys, against 8 for the geometry-only key. On a re-saved but otherwise untouched project: 0 added, 0 removed, against 29 and 29 before this change. A project with two conductors genuinely added still reports exactly two added and none removed, so the check still discriminates. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>