Skip to content

fix(relationships): normalize element refs to source_id at write time#82

Merged
victorsoriadrp merged 1 commit into
mainfrom
fix/normalize-relationship-element-refs
May 8, 2026
Merged

fix(relationships): normalize element refs to source_id at write time#82
victorsoriadrp merged 1 commit into
mainfrom
fix/normalize-relationship-element-refs

Conversation

@victorsoriadrp

Copy link
Copy Markdown
Contributor

Summary

Continuation of #81. Same root cause: MCP and REST API stored element UUIDs in source_element/target_element instead of ArchiMate source_id strings.

All 11 analytics viewer queries JOIN on elements.source_id = relationships.source_element/target_element, so they silently returned empty results for any workspace created via MCP (Integration Map, App Landscape, Dependency Graph, Capability Tree, Technology Stack, Process-App, App Dashboard, etc).

  • relationship_handler.go: adds resolveElementRef helper — if the value is a valid UUID, translates to source_id before persisting; otherwise passes through unchanged (AOEF-imported values are already source_ids)
  • migrations/025: backfills existing rows that contain UUIDs

MCP server calls the REST API, so it is fixed automatically with no changes to mcpserver/server.go.

Test plan

  • Create workspace via MCP, add elements and relationships
  • Verify DB: source_element/target_element should contain source_ids, not UUIDs
  • Open Integration Map, Dependency Graph, App Landscape — relationships should appear
  • Verify AOEF-imported workspaces (Archisurance) still work correctly
  • Run go test ./internal/...

…_id at write time

MCP and REST API were storing element UUIDs in source_element/target_element.
All 11 viewer queries (Integration Map, App Landscape, Dependency Graph,
Capability Tree, Technology Stack, etc.) JOIN on elements.source_id, so they
returned empty results for MCP-created workspaces.

Fix: resolve UUID→source_id in the relationship create/update handlers before
persisting. AOEF-imported values (already source_ids) pass through unchanged.

Migration 025 backfills existing rows that contain UUIDs.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 7, 2026

Copy link
Copy Markdown

Deploying archipulse with  Cloudflare Pages  Cloudflare Pages

Latest commit: fdbc43a
Status: ✅  Deploy successful!
Preview URL: https://15edd804.archipulse.pages.dev
Branch Preview URL: https://fix-normalize-relationship-e.archipulse.pages.dev

View logs

@victorsoriadrp victorsoriadrp merged commit 8cf3100 into main May 8, 2026
2 checks passed
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