Commit 0c0e113
fix: resolve cross-entity slug references during configuration import (#727)
* fix: resolve cross-entity slug references during configuration import
Imported configurations that reference entities created earlier in the
same run would silently drop those references because the in-memory
slug/ID maps were only populated from pre-existing DB rows.
ConfigurationService gains registerImportedEntityMapping() to update
the maps after each entity import, withComponentSlug() to normalise
missing slug fields, and reconcileImportedReferences() for a targeted
second pass over endpoints and synchronizations.
RuleHandler adds 'synchronization' to its entity-type lists so
synchronization references in rule configs are correctly serialised and
deserialised.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: address code review issues in ConfigurationService import reconciliation
- Remove dead method_exists(getId) guard — getId() is on the base Entity
class and is always present; only getSlug() warrants the check.
- Drop resetMappings() before reconcileImportedReferences(): the in-memory
maps built by registerImportedEntityMapping during the first pass are
already complete, so a full DB reload is unnecessary and caused every
endpoint/synchronization to be written twice.
- Add rules to the reconciliation pass — rules are imported at step 3,
before synchronizations (step 5), so synchronization references in rule
configs could not be resolved in the first pass.
- Remove synchronizations from the reconciliation pass — synchronizations
depend only on sources, mappings and endpoints, all of which are imported
before them, so they never have unresolvable forward references.
- Remove redundant registerImportedEntityMapping calls inside
reconcileImportedReferences; the in-memory maps are already authoritative
by that point.
- Rewrite reconcileImportedReferences docblock to explain the dependency
reasoning instead of re-stating the implementation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Ruben van der Linde <ruben@conduction.nl>1 parent f1f4cce commit 0c0e113
2 files changed
Lines changed: 104 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
222 | 310 | | |
223 | 311 | | |
224 | 312 | | |
| |||
785 | 873 | | |
786 | 874 | | |
787 | 875 | | |
| 876 | + | |
788 | 877 | | |
789 | 878 | | |
| 879 | + | |
790 | 880 | | |
791 | 881 | | |
792 | 882 | | |
793 | 883 | | |
794 | 884 | | |
795 | 885 | | |
| 886 | + | |
796 | 887 | | |
797 | 888 | | |
| 889 | + | |
798 | 890 | | |
799 | 891 | | |
800 | 892 | | |
801 | 893 | | |
802 | 894 | | |
803 | 895 | | |
| 896 | + | |
804 | 897 | | |
805 | 898 | | |
| 899 | + | |
806 | 900 | | |
807 | 901 | | |
808 | 902 | | |
809 | 903 | | |
810 | 904 | | |
811 | 905 | | |
| 906 | + | |
812 | 907 | | |
813 | 908 | | |
| 909 | + | |
814 | 910 | | |
815 | 911 | | |
816 | 912 | | |
817 | 913 | | |
818 | 914 | | |
819 | 915 | | |
| 916 | + | |
820 | 917 | | |
821 | 918 | | |
| 919 | + | |
822 | 920 | | |
823 | 921 | | |
824 | 922 | | |
825 | 923 | | |
826 | 924 | | |
827 | 925 | | |
| 926 | + | |
828 | 927 | | |
829 | 928 | | |
| 929 | + | |
830 | 930 | | |
831 | 931 | | |
832 | 932 | | |
| 933 | + | |
| 934 | + | |
833 | 935 | | |
834 | 936 | | |
835 | 937 | | |
0 commit comments