Skip to content

Say whether rolled ability scores are sub-par - #350

Merged
mmacy merged 5 commits into
mainfrom
sub-par-scores
Nov 26, 2026
Merged

mmacy merged 5 commits into
mainfrom
sub-par-scores

Conversation

@mmacy

@mmacy mmacy commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Closes #345.

The SRD's "Sub-Par Characters" rule lets a referee allow a player to discard a character with very poor ability scores. osrlib now says whether a roll is sub-par, and never discards or rerolls anything itself.

  • osrlib.core.character.scores_are_sub_par(scores) is true when every score is 8 or less, the SRD's own example, or when two or more scores are 5 or less. The second clause is osrlib's reading of "an extremely low rating in more than one ability", recorded in docs/adaptations.md as an interpretation: every ability table in the SRD has a row boundary between 6 and 5.
  • AbilityScoreRolls.sub_par is a computed field that calls the function, so it's in the JSON of a roll result, a document can't state a wrong value, and a result recorded by 2.8.0 parses and carries the right value.
  • AbilityScoreRolls.scores refuses scores that aren't all six abilities, each from 3 to 18. Its docstring already stated that range and nothing enforced it.

There is no Ruleset flag, because osrlib has nothing to apply: whether a referee allows the discard is the front end's setting. create_character creates a sub-par character as before, and no draw changes.

How it was checked

The acceptance tests in tests/test_sub_par_scores.py were written before the implementation by a different agent. An independent review compared the branch with osrlib 2.8.0 over 20,000 seeds: roll_ability_scores and create_character agree on every one, and sub_par equals the rule computed independently for every roll. Of the 20,000 3d6 rolls, 613 are sub-par, 8 by the first clause and 607 by the second. All eleven mutations of the rule and the validator were caught. The review also confirmed that no save contains a roll result, so the stricter validation can't refuse a released save.

https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3

The new names are stubs with their final docstrings: `scores_are_sub_par` in
osrlib.core.character, which takes six scores and raises NotImplementedError until the chunk
lands, and `AbilityScoreRolls.sub_par`, a pydantic computed field that calls it (#345). The
scores are sub-par when every score is 8 or less, the SRD's own example, or when two or more
are 5 or less, the band below 6 to 8 in every ability table on the SRD's Ability Scores page.
Both docstrings quote the SRD's "Sub-Par Characters" sentence and say that `Ruleset` has no
flag for it and that `create_character` never refuses or rerolls.

tests/test_sub_par_scores.py marks the behaviour and documentation tests xfail until the
sub-par-scores chunk lands. Its unmarked tests pin that the named seeds roll the scores written
there, that `create_character` draws for a sub-par roll exactly what it drew before, the field's
serialization and validation schemas, and the two docstrings. tests/saves/ gains a creation result
that osrlib 2.8.0 wrote from seed 6, whose scores are sub-par. The new function's docstring example
is marked expected to fail in both docs example harnesses. No golden file changes.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
`scores_are_sub_par` checks that the scores are all six abilities, each from 3 to 18, with the
same helper `Character` uses, and then returns true when every score is 8 or less or two or more
are 5 or less (#345). It draws nothing, so no RNG stream changes.

`AbilityScoreRolls.scores` now has the field validator its docstring promised, so a document with
a missing or out-of-range score fails to parse instead of failing later in `sub_par`. Step 1 of the
module's creation walkthrough mentions `sub_par`. The function's docstring example moves to lines
1198-1211. No golden file changes.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
The quickstart says where to read `sub_par` on a creation result, the spec's rules scope lists
the test, and the adaptations register records 5 or less as osrlib's reading of the SRD's
"extremely low rating", with the ability-table steps between 6 and 5 that justify it. The
changelog adds the feature under Added (#345) and the stricter `AbilityScoreRolls.scores`
validation under Fixed.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
…er review

The acceptance tests of the sub-par check now run as ordinary tests, and the
docstring example is no longer listed as expected to fail. Every ability
table has a row boundary between 6 and 5, but four columns don't change
there, so the reason no longer says the tables step down. The changelog says
why SCHEMA_VERSION stays 4 for the stricter validation of the scores.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
@mmacy
mmacy merged commit 7b70114 into main Nov 26, 2026
5 checks passed
@mmacy
mmacy deleted the sub-par-scores branch November 26, 2026 16:21
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.

Say whether rolled ability scores are sub-par, for the SRD's sub-par characters rule

1 participant