Skip to content

[Tools] Preserve ATT conditions when normalizing locale tables. - #2820

Merged
NORPG merged 1 commit into
ATTWoWAddon:masterfrom
NORPG:codex/normalize-lua-conditions
Dec 4, 2026
Merged

NORPG merged 1 commit into
ATTWoWAddon:masterfrom
NORPG:codex/normalize-lua-conditions

Conversation

@NORPG

@NORPG NORPG commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Summary

The Lua localization normalizer could discard ATT directives while reordering a table. In Dragonriding Cup this could remove an era's name. In Blackrock Spire it could separate a locale assignment from the version-specific text that supplies its value.

Feature Introduction

Run node .contrib/.tools/Lua/normalize.js "path/to/data-file.lua" or use the Normalize Lua Table task in Visual Studio Code.

The formatter now follows nested and consecutive conditional blocks in text, description, and lore. It keeps values with their directives, preserves shared fields, and adds missing locale TODOs in the established order on multilingual paths. English-only paths stay compact.

When two slots for the same locale could appear together, the tool reports both source locations and identifies active and commented entries. It preserves the original table for review. If filling a gap would require introducing another branch, it reports the missing locale. Comparisons at different thresholds are treated as potentially overlapping.

Tests

  • Run node --test .contrib/.tools/Lua/tests/normalize.test.cjs from the repository root. All 17 cases passed locally. The new GitHub Actions workflow runs the suite when the formatter, its tests, or the two real data fixtures change.
  • The Dragonriding Cup and Blackrock Spire regressions scramble real fields and remove an existing TODO from a copy. They require the formatter to restore the original target table and produce identical bytes on a second run.
  • Independently compared original and normalized headers through ATT's C# preprocessing logic and Lua 5.1. All 12 comparisons passed across the TWW boundary and patches 3.0.7, 3.0.8, and 3.0.9, using both original and deliberately modified input.

AI Assistance

AI assistance was used with gpt-6.2-astra to implement the normalizer, write and run the regression tests, verify the Dragonriding Cup and Blackrock Spire data, and draft this pull request.

* Handle nested and consecutive conditionals and preserve versioned values.
* Check missing and duplicate locale slots on the paths where they occur.
* Add CLI regressions for Dragonriding Cup and Blackrock Spire.

Assisted-by: gpt-6.2-astra.
@NORPG
NORPG force-pushed the codex/normalize-lua-conditions branch from 2b211b4 to 3ae175e Compare December 4, 2026 16:14
@NORPG
NORPG marked this pull request as ready for review December 4, 2026 16:19
@NORPG
NORPG merged commit e7bafa3 into ATTWoWAddon:master Dec 4, 2026
3 checks passed
@NORPG
NORPG deleted the codex/normalize-lua-conditions branch December 4, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant