Automatic spellknown/spellgain null-filling (#12)

Implemented on branches `feature/topdata-row-extensions` in both `toolkit` and `module`.

**Scope Audited**
- Toolkit native topdata collection/build path.
- Project config/effective config validation.
- Module `nwn-tool.yaml` topdata config and topdata README.

**Changes Made**
- Added `topdata.row_extensions` config with `repeat_last` support.
- Added glob dataset matching and build-time row extension for plain native datasets in [native.go](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/topdata/native.go:641).
- Extension copies emitted columns from the highest authored `Level`, increments `Level`, and assigns sequential `id`s through target level.
- Enabled rules for `classes/spellsgained/*` and `classes/spellsknown/*` to level 60 in [nwn-tool.yaml](/home/vicky/Projects/nwnee-shadowsoverwestgate/module/nwn-tool.yaml:90).
- Updated toolkit/module docs.

**Configuration / Compatibility**
- New public config type: `TopDataRowExtensionConfig` in [project.go](/home/vicky/Projects/nwnee-shadowsoverwestgate/toolkit/internal/project/project.go:233).
- Existing behavior is unchanged unless a repo opts into `topdata.row_extensions`.
- Source JSON and lockfiles are not updated for generated extension rows.

**Tests / Validation**
- Added project config tests for loading and validation.
- Added native topdata tests for extension behavior, glob application, preserving manually authored rows, unmatched datasets, and failure cases.
- Ran:
  - `go test ./internal/project ./internal/topdata`
  - `go test ./internal/topdata -run TestBuildNativeKeepsGeneratedIDsStableAcrossRepeatedBuilds`
  - `/tmp/sow-toolkit-rowext config validate` in `module`
  - `/tmp/sow-toolkit-rowext validate-topdata` in `module`
  - `/tmp/sow-toolkit-rowext build-topdata --force`, then inspected generated rows: `cls_spgn_acolyte.2da` now reaches row `59` / level `60`.

**Remaining Notes**
- `validate-topdata` still reports the pre-existing portrait lock warnings for `cotbl/cotbl_` and `lantern/lantern_`.
- `build-topdata --force` briefly rewrote three spellbook JSON files as a side effect; I reverted those, leaving only the intended YAML/docs changes in `module`.

Reviewed-on: https://gitea.westgate.pw/ShadowsOverWestgate/sow-tools/pulls/12
Co-authored-by: vickydotbat <vickydotbat@tutamail.com>
Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit is contained in:
2026-05-26 19:54:48 +02:00
committed by archvillainette
parent b7587cfd05
commit 88be9e95d3
6 changed files with 409 additions and 0 deletions
+16
View File
@@ -329,6 +329,22 @@ whose canonical key is empty and whose emitted 2DA columns are all null-like
optionally prevents generated allocation below a configured row while preserving
the selected allocation mode at and above that row.
`topdata.row_extensions` can extend plain native tables at build time without
expanding the authored JSON. The `repeat_last` mode matches configured dataset
glob patterns, finds the highest authored value in `level_column`, and appends
generated rows through `target_level` by copying the last authored row's emitted
columns while incrementing the level and row id. Generated extension rows are
build output only and do not update source JSON or lockfiles.
```yaml
topdata:
row_extensions:
- dataset: classes/spellsgained/*
mode: repeat_last
level_column: Level
target_level: 60
```
`topdata.class_feat_injections` controls generated rows for every
`classes/feats/*.json` table. `global_feats` injects concrete `feat:*`
references unless the class already authors that feat; `require_present` and