Scripting: honour optional resource dependencies - #246
Conversation
optional was parsed onto ResourceDependency and never read, so a missing dependency always blocked the boot. warnOnMissingDependency was the only escape and is global, so declaring a real-but-optional dependency would make a partial install fail to start. ValidateDependencies now skips a missing dependency its declarer marked optional, and StartResource stops recursing into one -- that second gate would otherwise fail the dependent with 'Resource not found' right after validation let it through. A dependency declared twice stays required unless every declaration is optional. ComputeLoadOrder is untouched: it already ignores deps absent from _resources, and changing it would break cycle detection.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughThe resource system now identifies optional dependency declarations. ResourceManager skips missing optional dependencies during validation and startup, while required dependencies retain existing failure behavior. Tests cover missing, installed, ordered, and duplicate dependency declarations. ChangesOptional dependency handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change allows explicitly optional missing resources to be skipped during validation and startup while preserving required dependencies; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant ResourceManager
participant Resource
participant DependencyManifest
ResourceManager->>Resource: Check IsOptionalDependency(depName)
Resource->>DependencyManifest: Read matching declarations
DependencyManifest-->>Resource: Optionality declarations
Resource-->>ResourceManager: Return optionality result
ResourceManager->>Resource: Validate or start dependency
Resource-->>ResourceManager: Report missing dependency
ResourceManager-->>ResourceManager: Skip missing optional dependency
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
optionalwas parsed ontoResourceDependencyand never read, so a missing dependency always blocked the boot.warnOnMissingDependencywas the only escape and is global, so declaring a real-but-optional dependency would make a partial install fail to start.ValidateDependenciesnow skips a missing dependency its declarer marked optional, andStartResourcestops recursing into one -- that second gate would otherwise fail the dependent with 'Resource not found' right after validation let it through.A dependency declared twice stays required unless every declaration is optional.
ComputeLoadOrderis untouched: it already ignores deps absent from_resources, and changing it would break cycle detection.Summary by CodeRabbit
New Features
Bug Fixes