Skill focus identity resolution
This commit is contained in:
@@ -2472,6 +2472,9 @@ func (c *featGeneratedContext) resolveGeneratedFeatIdentity(spec familyExpansion
|
||||
return c.resolveGeneratedFeatIdentityBySource(spec.FamilyKey, slug, rawSource)
|
||||
}
|
||||
featKey := c.preferredGeneratedFeatKey(spec.FamilyKey, slug)
|
||||
if aliasKey, aliasID, ok := c.generatedFeatKeyFromSameFamilyChildAlias(spec.FamilyKey, slug); ok {
|
||||
return aliasKey, aliasID, true, nil
|
||||
}
|
||||
if legacyKey, legacyID, ok := c.generatedFeatKeyFromLegacyAlias(spec.FamilyKey, slug); ok {
|
||||
return legacyKey, legacyID, true, nil
|
||||
}
|
||||
@@ -2655,6 +2658,15 @@ func generatedAliasLockForKey(canonicalKey, lockedKey string, aliases generatedF
|
||||
return false
|
||||
}
|
||||
legacyChildren := legacyFamilyChildAliases(identity.Parent, identity.Child)
|
||||
parentPrefix := identity.Parent + "_"
|
||||
if strings.HasPrefix(lockedKey, parentPrefix) {
|
||||
lockedChild := strings.TrimPrefix(lockedKey, parentPrefix)
|
||||
for _, legacyChild := range legacyChildren {
|
||||
if normalizeKeyIdentity(lockedChild) == normalizeKeyIdentity(legacyChild) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, alias := range configuredGeneratedFamilyLegacyAliases(identity.Parent, aliases) {
|
||||
prefix := alias + "_"
|
||||
if !strings.HasPrefix(lockedKey, prefix) {
|
||||
@@ -2737,6 +2749,30 @@ func (c *featGeneratedContext) generatedFeatKeyForID(familyKey string, rowID int
|
||||
return "", false
|
||||
}
|
||||
|
||||
func (c *featGeneratedContext) generatedFeatKeyFromSameFamilyChildAlias(familyKey, sourceSlug string) (string, int, bool) {
|
||||
targets := legacyFamilyChildAliases(familyKey, sourceSlug)
|
||||
canonicalKey := c.preferredGeneratedFeatKey(familyKey, sourceSlug)
|
||||
prefix := "feat:" + familyKey + "_"
|
||||
normalizedSource := normalizeKeyIdentity(sourceSlug)
|
||||
for _, candidates := range []map[string]int{c.lockData, c.supplementalID} {
|
||||
for _, target := range targets {
|
||||
if normalizeKeyIdentity(target) == normalizedSource {
|
||||
continue
|
||||
}
|
||||
for key, rowID := range candidates {
|
||||
if rowID <= 0 || !strings.HasPrefix(key, prefix) {
|
||||
continue
|
||||
}
|
||||
child := strings.TrimPrefix(key, prefix)
|
||||
if normalizeKeyIdentity(child) == normalizeKeyIdentity(target) {
|
||||
return canonicalKey, rowID, true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", 0, false
|
||||
}
|
||||
|
||||
func (c *featGeneratedContext) generatedFeatKeyFromLegacyAlias(familyKey, sourceSlug string) (string, int, bool) {
|
||||
targets := legacyFamilyChildAliases(familyKey, sourceSlug)
|
||||
canonicalKey := c.preferredGeneratedFeatKey(familyKey, sourceSlug)
|
||||
|
||||
Reference in New Issue
Block a user