fix(character): resolve default rolling method from config, not "standard"#150
Merged
Merged
Conversation
…dard" roll_generated_value fell back to Map.get(rolling_methods, method_id || "standard") — a rolling-method ID authored in dnd_5e_srd's TOML, hardcoded in library source in violation of the library/config boundary. A second system without a method named "standard" got a nil.dice crash for any methodless generated node, and an unknown explicit method id crashed the same way. The config mechanism for this already existed: rolling methods carry a "default" flag (dnd's standard method sets default = true) that the loader parses and the library then ignored. Methodless generated nodes now resolve to the method flagged default = true; both failure modes (unknown method id, methodless node with no default) raise messages naming the problem instead of nil.dice. Load-time validation (consistent with the loader's warn-and-degrade posture for concept-level mistakes): - the missing-method warning moved from per-node parse time to a post-load pass, because a methodless node is now legitimate when a default method exists — possibly in a different concept file, so the check needs the fully-loaded rolling_methods map. It fires only when no default is declared. - a node referencing an unknown rolling method warns. - drop values other than "lowest" warn and are ignored (previously silently ignored, undocumented). - multiple default = true methods warn as ambiguous. Also documents the "rolling_method" reserved concept type and its keys (name/dice/drop/default) in the structural-vocabulary moduledoc — it was special-cased in process_type but absent from the reserved-types list. Full centralization of vocabulary constants remains #125. Closes #123
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.
Closes #123
Why
roll_generated_valuefell back toMap.get(rolling_methods, method_id || "standard")— domain vocabulary from dnd_5e_srd's TOML hardcoded in library source, violating the library/config boundary. A second system without a method named"standard"crashed withnil.dicefor any methodless generated node; an unknown explicit method id crashed the same way.What
The config mechanism already existed: rolling methods carry a
defaultflag (dnd'sstandardsetsdefault = true), parsed by the loader and then ignored by the library. Now:default = true.nil.dice.Load-time validation added (warn-and-degrade, matching loader posture):
rolling_methodsmap. It fires only when no default is declared.methodreference on a generated node warns.dropvalues other than"lowest"warn and are ignored (previously silent).default = truemethods warn as ambiguous.The
"rolling_method"reserved concept type and its keys (name/dice/drop/default) are now documented in the structural-vocabulary moduledoc; it was special-cased in code but missing from the reserved-types list. (Vocabulary constant centralization stays #125.)Verification
grep '"standard"' apps/ex_ttrpg_dev/lib/— zero hits.Summary by Bito