topdata: stop hardcoding the skills dataset location
build-binaries / build-binaries (pull_request) Successful in 2m9s
test / test (pull_request) Successful in 1m23s

The skills dataset moved into a tree (skills/core, skills/specs, ...).
Resolve it data-driven instead of by name:

- The required-family check no longer pins skill focus families to
  dataset "skills"; the family spec's child_source names the dataset.
- Affinity generation and display names use the skill_focus spec's
  child_source dataset.
- Child slugs derive from the row key's own namespace (text after the
  first colon) instead of assuming namespace == dataset path.
- The wiki loader accepts both layouts ("skills", then "skills/core").

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 09:25:39 +02:00
co-authored by Claude Fable 5
parent 24e57457b0
commit adffb1e11d
3 changed files with 35 additions and 13 deletions
+18 -3
View File
@@ -2317,6 +2317,18 @@ func (c *featGeneratedContext) familyHasExistingRows(familyKey string) bool {
return false
}
// skillsDatasetName returns the dataset the skill_focus family sources its
// children from. The skills dataset location is data-driven via that spec;
// "skills" is only the fallback when no spec is loaded.
func (c *featGeneratedContext) skillsDatasetName() string {
for key, spec := range c.familySpecs {
if normalizeKeyIdentity(key) == "skillfocus" && spec.ChildSource.Dataset != "" {
return spec.ChildSource.Dataset
}
}
return "skills"
}
func (c *featGeneratedContext) datasetRows(name string) (map[string]map[string]any, error) {
if rows, ok := c.rowsByDataset[name]; ok {
return rows, nil
@@ -2555,7 +2567,10 @@ func buildFamilyExpansionGeneratedModule(path string, obj map[string]any, ctx *f
if !include {
continue
}
slug := strings.TrimPrefix(sourceKey, spec.ChildSource.Dataset+":")
slug := sourceKey
if idx := strings.Index(slug, ":"); idx >= 0 {
slug = slug[idx+1:]
}
featKey, rowID, hasID, err := ctx.resolveGeneratedFeatIdentity(spec, slug, row)
if err != nil {
return nil, fmt.Errorf("generated feat file %s: %w", path, err)
@@ -2655,7 +2670,7 @@ func buildRacialtypesSkillAffinityModule(ctx *featGeneratedContext) (map[string]
if len(grants) == 0 {
return nil, nil
}
skillRows, err := ctx.datasetRows("skills")
skillRows, err := ctx.datasetRows(ctx.skillsDatasetName())
if err != nil {
return nil, err
}
@@ -2854,7 +2869,7 @@ func (c *featGeneratedContext) displayNameForGeneratedSource(dataset string, row
return text
}
switch dataset {
case "skills":
case c.skillsDatasetName():
return displayNameForSkill(row)
case "baseitems":
return displayNameForBaseitem(row)