Skip to content

Dependency Resolution Flow

This flowchart illustrates the dependency resolution process when users install content or create game profiles with dependencies.

Overview

The dependency resolution system ensures that all required content is installed before the main content, handles transitive dependencies, detects circular dependencies, validates version constraints, and checks for conflicts.

Flow Diagram

Key Components

Dependency Types

Catalog Dependencies

  • Model: CatalogDependency.cs
  • Fields:
    • publisherId: Publisher identifier
    • contentId: Content identifier
    • versionConstraint: Semantic version constraint (e.g., ">=1.0.0", "^2.0.0")
    • isOptional: Whether dependency is optional

Manifest Dependencies

  • Model: ContentDependency.cs
  • Fields:
    • id: Manifest ID
    • name: Display name
    • dependencyType: Required, Optional, Recommended
    • installBehavior: Auto, Prompt, Manual
    • minVersion: Minimum version required

Dependency Resolver

Same-Catalog Resolution

  • Service: GenericCatalogResolver.cs
  • Process:
    1. Search current catalog for dependency
    2. Validate version constraint
    3. Check for conflicts
    4. Add to resolution queue

Cross-Publisher Resolution

  • Service: CrossPublisherDependencyResolver.cs
  • Process:
    1. Check if publisher is subscribed
    2. Fetch publisher definition and catalog
    3. Search catalog for content
    4. Validate version constraint
    5. Add to resolution queue

Conflict Detection

ConflictsWith

  • Purpose: Explicit conflicts between content items
  • Example: Two mods that modify the same game files incompatibly
  • Resolution: User must choose one or cancel

IsExclusive

  • Purpose: Only one content of this type can be active
  • Example: UI themes, total conversion mods
  • Resolution: Replace existing or cancel

Circular Dependency Detection

  • Algorithm: Depth-first search with visited tracking
  • Detection: If a node is visited twice in the same path
  • Output: Display full dependency chain to user

Version Constraint Validation

  • Format: Semantic versioning (SemVer)
  • Operators:
    • >=1.0.0: Greater than or equal
    • ^2.0.0: Compatible with 2.x.x
    • ~1.2.0: Compatible with 1.2.x
    • 1.0.0: Exact version

Transitive Dependencies

  • Definition: Dependencies of dependencies
  • Resolution: Recursive resolution with deduplication
  • Example: Mod A → Mod B → Mod C (all must be installed)

Installation Order

Topological Sort

  • Purpose: Ensure dependencies are installed before dependents
  • Algorithm: Kahn's algorithm or DFS-based topological sort
  • Output: Ordered list of content to install

Installation Queue

  1. Base dependencies (no dependencies)
  2. First-level dependencies
  3. Second-level dependencies
  4. ... (continue until all resolved)
  5. Main content (last)

Error Handling

Missing Dependencies

  • Display list of missing content
  • Provide subscription links for cross-publisher dependencies
  • Allow user to cancel or resolve manually

Version Conflicts

  • Show required vs. installed versions
  • Offer to update/downgrade
  • Warn about potential compatibility issues

Circular Dependencies

  • Display full dependency chain
  • Explain the circular reference
  • Suggest manual resolution

Network Errors

  • Retry mechanism for catalog fetching
  • Fallback to cached catalogs
  • Clear error messages
  • GenHub.Core/Models/Providers/CatalogDependency.cs
  • GenHub.Core/Models/Manifest/ContentDependency.cs
  • GenHub/Features/Content/Services/Catalog/CrossPublisherDependencyResolver.cs
  • GenHub/Features/Content/Services/ContentResolvers/GenericCatalogResolver.cs
  • GenHub.Core/Services/Publishers/PublisherDefinitionService.cs

GeneralsHub Docs