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 identifiercontentId: Content identifierversionConstraint: Semantic version constraint (e.g., ">=1.0.0", "^2.0.0")isOptional: Whether dependency is optional
Manifest Dependencies
- Model:
ContentDependency.cs - Fields:
id: Manifest IDname: Display namedependencyType: Required, Optional, RecommendedinstallBehavior: Auto, Prompt, ManualminVersion: Minimum version required
Dependency Resolver
Same-Catalog Resolution
- Service:
GenericCatalogResolver.cs - Process:
- Search current catalog for dependency
- Validate version constraint
- Check for conflicts
- Add to resolution queue
Cross-Publisher Resolution
- Service:
CrossPublisherDependencyResolver.cs - Process:
- Check if publisher is subscribed
- Fetch publisher definition and catalog
- Search catalog for content
- Validate version constraint
- 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.x1.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
- Base dependencies (no dependencies)
- First-level dependencies
- Second-level dependencies
- ... (continue until all resolved)
- 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
Related Files
GenHub.Core/Models/Providers/CatalogDependency.csGenHub.Core/Models/Manifest/ContentDependency.csGenHub/Features/Content/Services/Catalog/CrossPublisherDependencyResolver.csGenHub/Features/Content/Services/ContentResolvers/GenericCatalogResolver.csGenHub.Core/Services/Publishers/PublisherDefinitionService.cs
