ID List Support expansion

**Scope Audited**
- Topdata configured value encoders in [native.go](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/topdata/native.go:3894)
- Config validation in [project.go](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/project/project.go:799)
- Wiki alignment formatting
- Module topdata config/docs and authored `PreferredAlignments` / `ProficiencyFeats` files

**Changes Made**
- Added generic `id_hex_list` support. It works for any configured dataset/column and emits packed hex row IDs from `ids`.
- Updated alignment encoding to accept explicit `alignments`; legacy `list` still works.
- Kept numeric packed lists on `list` / `all_except`.
- Configured `baseitems.ProficiencyFeats` in [nwn-tool.yaml](/home/vicky/Projects/nwnee-shadowsoverwestgate/module/nwn-tool.yaml:73).
- Migrated module proficiency authoring to `ids` and racial alignment authoring to `alignments`.
- Updated docs in [module/topdata/README.md](/home/vicky/Projects/nwnee-shadowsoverwestgate/module/topdata/README.md:157).

**Configuration / Schema Impact**
- New `topdata.value_encodings[].mode`: `id_hex_list`.
- `id_hex_list` accepts:
  - `"feat:some_key"`
  - `{ "id": "feat:some_key" }`
  - numeric IDs, still range-checked by `min`, `max`, `hex_width`.

**Compatibility Impact**
- Existing numeric packed lists are unchanged.
- Existing alignment `{ "list": [...] }` remains accepted, but docs and module data now prefer `{ "alignments": [...] }`.
- ID-list behavior is config-driven, not hardcoded to proficiencies.

**Tests Added / Updated**
- Added build test for generic `id_hex_list`.
- Added validation test for unknown ID references.
- Updated alignment tests to use `alignments`.
- Updated wiki alignment tests for explicit `alignments` plus legacy `list`.

**Validation Performed**
- `go test ./internal/topdata` passed.
- `go test ./internal/project` passed.
- `go test ./...` passed.
- `SOW_TOOLS_DEV_BINARY=../toolkit/tools/sow-toolkit ./scripts/run-nwn-tool.sh config validate` passed in `module/`.

**Remaining Risk**
- `./validate-topdata.sh` in `module/` is currently blocked by existing staged module authored-content changes: generated feat/baseitems validation reports `dataset baseitems: override must specify id or key` from `topdata/data/feat/generated`. I did not try to repair that unrelated staged work.
This commit is contained in:
2026-05-26 13:39:07 +02:00
parent 37db91314b
commit 22e3fabbbb
5 changed files with 192 additions and 9 deletions
+4 -3
View File
@@ -1260,7 +1260,8 @@ func TestWikiTemplateFormatsPreferredAlignments(t *testing.T) {
}{
{name: "encoded list", value: "0x120C01", want: "Lawful Evil, Chaotic Good, True Neutral"},
{name: "authored list", value: []any{"le", "CG", "tn"}, want: "Lawful Evil, Chaotic Good, True Neutral"},
{name: "authored object list", value: map[string]any{"list": []any{"ce", "ne"}}, want: "Chaotic Evil, Neutral Evil"},
{name: "authored object alignments", value: map[string]any{"alignments": []any{"ce", "ne"}}, want: "Chaotic Evil, Neutral Evil"},
{name: "legacy authored object list", value: map[string]any{"list": []any{"ce", "ne"}}, want: "Chaotic Evil, Neutral Evil"},
{name: "zero", value: 0, want: "Any"},
{name: "encoded zero", value: "0x00", want: "Any"},
{name: "null", value: nil, want: "Any"},
@@ -1298,7 +1299,7 @@ func TestWikiTemplateFormatsPreferredAlignmentsWithConfiguredLinks(t *testing.T)
Key: "racialtypes:tiefling",
Title: "Tiefling",
Row: map[string]any{
"PreferredAlignments": map[string]any{"list": []any{"le", "ne", "ce"}},
"PreferredAlignments": map[string]any{"alignments": []any{"le", "ne", "ce"}},
},
}
@@ -1323,7 +1324,7 @@ func TestWikiTemplateFormatsPreferredAlignmentsWithConfiguredRootAnchors(t *test
Key: "racialtypes:tiefling",
Title: "Tiefling",
Row: map[string]any{
"PreferredAlignments": map[string]any{"list": []any{"le"}},
"PreferredAlignments": map[string]any{"alignments": []any{"le"}},
},
}