mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-22 08:34:12 +02:00
ab159404a3
The conductor table keyed on Terminal::uuid(), which comes from the catalog .elmt definition and is empty for every element authored before that field existed. A conductor was dropped unless *both* its terminals had one, so the tables this slice adds were empty on almost every project in existence: examples corpus conductor rows in the database industrial.qet 0 of 671 affuteuse_250h.qet 0 of 263 tremie_vibrante.qet 0 of 77 741.qet 0 of 67 Across the 23 example projects, 16 of the 20 that contain conductors have zero terminal uuids -- 2366 of 3002 conductors -- and overall coverage is 7.3%. Meanwhile --export-cables, already on master, lists all 671 conductors of industrial.qet from the document. A feature that only works on newly authored elements is not one users can rely on. Terminal::stableUuid() returns the terminal's own uuid when it has one and otherwise derives one from its local position and orientation inside its element. That is not an invented scheme: it is what the project format already does. TerminalData::fromXml() says so where it parses the field -- "if the attribute not exists, means, the element is created with an older version of qet. So use the legacy approach to identify terminals" -- and the legacy approach is the terminal's position. m_pos is read from the definition and is not touched by moving the element on a folio, so the identity survives loads, saves and folio moves. Derived values are UUID v5 in a fixed namespace, so they are reproducible without being stored, and cannot collide with the v4 uuids the element editor generates. Every project in the corpus now has exactly as many conductor rows as the document has conductors -- 20 of 20 measured, 0 mismatches. (schema_indus.qet is excluded: it blocks on a modal dialog at zero CPU under any CLI flag, the pre-existing hang PR #661 addresses.) Two things this deliberately does not key on: - The terminal name. It is not stable: QET rewrites a terminal named "_" as unnamed, which would have silently changed the identity of 1421 of industrial.qet's 1790 terminals on their first resave. Measured across the corpus, dropping it costs nothing -- geometry alone yields exactly the same three collisions -- and it means renaming a terminal no longer changes what it is. - Uniqueness in the face of a definition that declares two terminals at the same point and orientation. Three cases exist in the whole corpus. They merge to a single terminal row, which is harmless: two terminals identical in position and orientation are indistinguishable in every observable respect, and every conductor on either still resolves to the right element and terminal name. Both affected projects (industrial, perceuse) return their full conductor count. The only conductor still skipped is one whose terminal has no parent element, which has no identity to key on at all. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>