Skip to content

fix: two-pass re-import for catalog entities with x-cortex-relationships#215

Open
jeff-schnitter wants to merge 5 commits into
stagingfrom
jeff/entity-relationship-reprocess
Open

fix: two-pass re-import for catalog entities with x-cortex-relationships#215
jeff-schnitter wants to merge 5 commits into
stagingfrom
jeff/entity-relationship-reprocess

Conversation

@jeff-schnitter

Copy link
Copy Markdown
Collaborator

Summary

  • Catalog entities are imported alphabetically in pass 1. An entity early in the alphabet may reference a relationship destination that doesn't exist yet, causing the relationship processor to cache a failed state that subsequent updates won't clear.
  • Pass 2 detects all entities with x-cortex-relationships, deletes and re-creates them after all entities exist in the DB.
  • A second wave within pass 2 handles multi-tier hierarchies (e.g. A→B→C where B is also a pass-2 entity).

Test plan

  • test_backup_import_triggers_pass2_for_relationship_entities — verifies pass 2 runs when relationship entities are present
  • test_backup_import_no_pass2_when_no_relationships — verifies pass 2 is skipped when no relationships exist
  • test_backup_import_triggers_wave2_for_dependent_relationships — verifies wave 2 runs for multi-tier hierarchies

🤖 Generated with Claude Code

jeff-schnitter and others added 3 commits June 11, 2026 11:55
Release 1.20.0: Add users roles list command
Staging is now reserved for multi-feature releases. Single-feature
releases go feature branch → PR to main directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeff-schnitter jeff-schnitter requested a review from Cantaley as a code owner July 6, 2026 17:21
…ips #patch

Entities are imported in alphabetical order. An entity early in the alphabet
may reference a relationship destination that hasn't been created yet, causing
the relationship processor to cache a failed state that subsequent updates
won't clear.

Pass 2 detects all catalog entities with x-cortex-relationships, deletes and
re-creates them after all entities exist in the DB. A second wave handles
multi-tier hierarchies where a relationship entity's own destination was also
recreated in wave 1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jeff-schnitter jeff-schnitter force-pushed the jeff/entity-relationship-reprocess branch from 5ffc737 to 1d75640 Compare July 6, 2026 17:22
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.

2 participants