-
Notifications
You must be signed in to change notification settings - Fork 1
feat(resolver): diamond dependency priority resolution by registry declaration order #204
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
When two registries at the same layer both extend the same skill (diamond dependency), there is currently no defined priority resolution. For example, if both @bu-retail and @bu-travel extend @clm5core/clm512-expert, the result is non-deterministic.
Parent issue: #199 (Phase 2)
Spec: docs/superpowers/specs/2026-03-30-skill-overlay-extends-design.md §5.1
Proposal
Priority should be determined by registries: declaration order in promptscript.yaml. A registry declared later in the YAML wins at collision. This is deterministic and explicit — changing YAML order changes compilation result.
Configuration
registries:
'@clm5core': ... # Layer 2
'@bu-retail': ... # Layer 3 — lower priority
'@bu-travel': ... # Layer 3 — higher priority (declared later)Logging behavior
ℹ Registry priority (highest last): @clm5core, @bu-retail, @bu-travel
⚠ skill clm512-expert: references/architecture.md from @bu-travel overrides @bu-retail
Implementation approach
- Tag imported blocks with their source registry index during import resolution
- When
applyExtends()encounters conflicting extensions on the same skill, resolve by registry index (higher index = higher priority) - For append-strategy properties (references, examples, requires): deduplicate by filename, higher-priority registry wins with a warning logged
Design considerations
- Requires extending the AST or resolution context to carry registry source metadata
- The current
applyExtends()inextensions.tsapplies extensions sequentially — registry ordering must be enforced before this step - Must handle the case where both registries add a reference with the same filename (dedup by basename, higher-priority wins)
Acceptance criteria
- Extensions from multiple registries on the same skill resolve by declaration order
- Later-declared registry takes priority at property collision
- Reference filename collisions deduplicate with warning logged
- Registry priority is logged at info level during compilation
- Tests for 2-registry and 3-registry diamond scenarios
- Documentation updated with priority resolution rules
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request