Skip to content

feat(config): engine defaults as YAML source of truth + ctld-tools (CTLD-TOOLS-CONFIG)#46

Merged
davidp57 merged 2 commits into
developfrom
feature/ctld-tools-config
Jul 20, 2026
Merged

feat(config): engine defaults as YAML source of truth + ctld-tools (CTLD-TOOLS-CONFIG)#46
davidp57 merged 2 commits into
developfrom
feature/ctld-tools-config

Conversation

@davidp57

Copy link
Copy Markdown
Member

Implements the CTLD-TOOLS-CONFIG lot (lot 2 of the ctld-tools program, ADR 0009).

What

  • Engine defaults are now data: moved out of CTLD_config.lua's inline block into
    src/CTLD_config.yaml (single source of truth, sectioned mm_facing / advanced). A committed
    generated src/CTLD_config_defaults.lua defines ctld.__configDefaults, which CTLDConfig:load()
    copies into settings. The TEMPLATES block and user-YAML merge are untouched. No in-game change.
  • New ctld-tools package — isolated poetry sub-project tools/ctld-tools/, following the VMCT
    Python stack (typer, ruamel.yaml, lupa, pytest + ruff + mypy). Commands: extract (one-shot
    Lua→YAML) and gen-config (YAML→Lua, re-emitting ctld.tr() on desc/name — the only i18n fields).
  • Merge order: the generated module is merged after CTLD_i18n_* (it calls ctld.tr at load
    time); committed, not build-generated (VEAF pattern — the Windows build stays pure PowerShell).

Validation

  • Parity: a frozen reference (extracted with a distinctive translator) proves yaml → gen-config → lua → settings == original, including every ctld.tr wrapper (47/47). Plus a drift check
    (committed generated Lua == fresh gen-config).
  • Switchover verified under both lupa (pytest) and lua5.1 (settings + 6 AA TEMPLATES intact).
  • CTLD.lua rebuilt; Python quality gate green locally (ruff + mypy + pytest, 10 passed).

CI

  • New python-quality workflow (ruff check + format + mypy + pytest). Existing lua-lint /
    busted / build jobs cover the Lua side (generated file is Lua-5.1 clean, ≤63-char lines).

Notes

  • ADR 0009 moved to Accepted with implementation notes (ruamel over PyYAML; committed+drift over
    build-generated; single package; merge-after-i18n).
  • Depends on FEAT-USERCONFIG-API (merged). Lot 3 (CTLD-TOOLS-USERCONFIG) builds the MM volet on top.

Implements CTLD-TOOLS-CONFIG (ADR 0009): move CTLD_config.lua's inline defaults
into src/CTLD_config.yaml (single source of truth, sectioned mm_facing/advanced),
generated back into a committed src/CTLD_config_defaults.lua that CTLDConfig:load()
copies into settings. New isolated poetry package tools/ctld-tools (typer, ruamel,
lupa, pytest + ruff + mypy — VMCT stack) with extract + gen-config commands.

Parity guarded (yaml -> lua -> settings == frozen reference, with a distinctive
translator proving the ctld.tr wrappers) + drift check; new python-quality CI job.
Generated Lua merged after CTLD_i18n_* (it calls ctld.tr at load time). No in-game
behaviour change.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @davidp57, your pull request is larger than the review limit of 150000 diff characters

@davidp57
davidp57 merged commit 403b735 into develop Jul 20, 2026
7 checks passed
@davidp57
davidp57 deleted the feature/ctld-tools-config branch July 20, 2026 17:11
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