feat: validate_power_budget -- power-balance budget validator#6
Merged
Conversation
Adds validate_power_budget(species_data, class_data, subclass_data, level) -> list[str] in dndwright/rules/homebrew_validator.py. Baselines DERIVED from dndwright content: 9 SRD 5.2.1 species (3-5 traits, 3 high-impact max) and 12 SRD classes (cumulative features active by level at 1/3/5/10/20). Three checks: 1. Species trait budget: max 5 total, max 3 high-impact (flight, innate casting, resistance weighted) 2. Class+subclass feature budget per level: max observed across SRD classes at that level 3. Combined split: species+class total must stay within sum of budgets (no Superman+Batman stacking) 17 new tests, 1635 total (was 1618), no regressions.
Two gaps from Boss review: 1. Added validate_power_budget to dndwright/__init__.py import and __all__ 2. Version bump to 0.25.0 in pyproject.toml, __init__, CHANGELOG Also updated test_api_contract.py EXPECTED_PUBLIC and EXPECTED_SIGNATURES. 1635 tests green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
validate_power_budget(species_data, class_data, subclass_data, level) -> list[str]indndwright/rules/homebrew_validator.py.Problem
Today the only balance signal for homebrew characters is the LLM's self-graded
balance_score, never enforced. A "Superman (species-heavy) + Batman (class-heavy)" concept can stack a full species' traits AND a full class's features.Approach
Three checks against SRD baselines derived from dndwright's own content (not invented):
species.jsonclasses.jsonHigh-impact traits (flight, innate casting, resistance, breath weapon, darkvision/tremorsense) are weighted heavier.
Tests
17 new tests: balanced passes, species-over/fails, class-over/fails, combined-over (Superman+Batman)/fails, edge cases (empty data, missing traits, malformed lists, features below level).
1635 total (was 1618). No regressions.
Baseline derivation
Methodology documented in the source comments: counted traits per SRD species, cumulative features active at level per SRD class, set budgets slightly above SRD max to allow homebrew creativity while catching over-stacking.