Skip to content

fix: resolve cross-entity slug references during configuration import - #726

Closed
bbrands02 wants to merge 1 commit into
developmentfrom
fix/configuration-import-reference-resolution
Closed

fix: resolve cross-entity slug references during configuration import#726
bbrands02 wants to merge 1 commit into
developmentfrom
fix/configuration-import-reference-resolution

Conversation

@bbrands02

Copy link
Copy Markdown
Contributor

Summary

  • ConfigurationService: Added registerImportedEntityMapping() to update in-memory slug/ID maps after each entity is imported, so entities created earlier in the same run are immediately available as references for later ones. Added withComponentSlug() to normalize missing slug fields from the component key. Added reconcileImportedReferences() for a targeted second pass over endpoints and synchronizations, which commonly depend on entities imported just before them.
  • RuleHandler: Added synchronization to the entity-type lists used during slug↔ID conversion, so synchronization references in rule configs are correctly serialized and deserialized.
  • EndpointHandler: Replaced the simple slug-only rule resolver with resolveRuleIdentifier(), which falls back to numeric ID, DB name lookup, and DB reference lookup — preventing silent rule drops when the source export format varies. Also injects RuleMapper to support the DB lookups.
  • EndpointMapper: Initialize $updateRegex = false before the update loop to avoid an undefined-variable notice.
  • routes.php: Narrow the SPA catch-all regex to exclude /api/… paths so JSON API endpoints resolve to their resource controllers instead of being swallowed by the Vue app route.

Test plan

  • Import a configuration bundle that includes synchronizations referenced by rules; verify the synchronization IDs resolve correctly after import
  • Import a bundle where endpoints reference rules by name or reference string (not just slug); verify no rules are silently dropped
  • Import a bundle with cross-entity dependencies (e.g. endpoint referencing a synchronization imported in the same run); verify the second reconciliation pass resolves the reference without a double import
  • Confirm /api/… REST calls are no longer captured by the SPA catch-all and return JSON as expected
  • Run existing import-related test suites and confirm no regressions

🤖 Generated with Claude Code

Imported configurations that reference entities created earlier in the
same run (e.g. endpoints referencing synchronizations) would silently
drop those references because the in-memory slug/ID maps were only
populated from pre-existing DB rows. A second reconciliation pass and
per-entity map registration keep references stable across the full import
order without requiring a double import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bbrands02

Copy link
Copy Markdown
Contributor Author

Closing — scope was too broad. Recreating with only ConfigurationService and RuleHandler changes.

@bbrands02 bbrands02 closed this Apr 24, 2026
@bbrands02
bbrands02 deleted the fix/configuration-import-reference-resolution branch April 24, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant