Skip to content

Label every spell mode and give sibling modes their own prose - #348

Merged
mmacy merged 7 commits into
mainfrom
spell-mode-names
Nov 26, 2026
Merged

mmacy merged 7 commits into
mainfrom
spell-mode-names

Conversation

@mmacy

@mmacy mmacy commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Closes #340.

A client's cast dialog could tell the three modes of a reversed light spell apart only by their keys, because all three had the whole text of the reversed form as their prose.

  • SpellMode.display_name is a short label for a mode, an instruction in sentence case such as "Conjure darkness", "Blind a creature", and "Cancel light". The SRD compiler fills it for every mode of the built-in catalog, from the SRD's lead-in where the page prints one and from a table in the compiler otherwise. No two modes of one form share a label.
  • A mode with no label, or one that is empty or only spaces, gets a label made from its key, so a spell document, an adventure, and a save from 2.8.0 still load and no mode has an empty label.
  • Sibling modes no longer share prose. The reverses of light and continual light, charm monster, and silence 15' radius have the part of the SRD text that covers each mode. A reversed form's own prose stays the whole text.

Against 2.8.0, the compiled spell data changes only in the 149 new labels and 15 prose values. No golden file changes, and SCHEMA_VERSION stays 4.

How it was checked

The acceptance tests in tests/test_spell_mode_names.py were written before the implementation by a different agent. An independent review diffed the compiled data against 2.8.0 and read each label against its mode. After it, the contract was amended: a label of only spaces counts as missing, labels from keys with stray underscores are trimmed, and the two sleep labels say which creatures each mode works on.

Filed from this work: #342, #343, #344, #347.

https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3

`SpellMode.display_name` is a stub with an empty default (#340). The compiled spells.json is
regenerated for the new field, so every mode has an empty label until the compiler fills them.
The docstrings of `SpellMode.prose` and `ReversedForm.prose` state how each mode of a passage that
covers several usages gets its own part of the text.

The tests in tests/test_spell_mode_names.py are marked xfail until the chunk lands. They pin the
label of every mode of every form with more than one mode, the key-derived label of every other
mode and of a mode written without one, distinct labels and distinct prose among sibling modes,
the divided prose of darkness, continual darkness, charm monster, and silence 15' radius, and a
save from osrlib 2.8.0, written by a scratch copy of that release, whose bundled spell is labelled
from its keys. Two guards pass today: the reverse keeps its whole text, and the normal light modes
keep their usages' prose.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
A mode written without a display_name, or with an empty one, now takes a label made from its key, so
a spell, adventure, or save from 2.8.0 loads with a label on every mode. The SRD compiler labels each
mode of a multi-mode form from the lead-in of the usage it binds, turning a gerund into an
instruction ("Blinding a creature:" is "Blind a creature"). The modes whose page prints no lead-in,
or one that names a situation or a subject, have labels written in _SPELL_MECHANICS. The compiler
fails if a mode of a multi-mode form ends with no label or a sibling's label, or if a written label
stands in for a lead-in's.

The packet asked for those written labels in tools/srd_compile/overrides/spells.json. They are in
the mechanics table instead because tests/test_spell_data.py pins that no built-in spell has
overrides_applied entries, and apply_overrides records one for each path it sets.

The compiler divides the one passage of the reverses of light and continual light, of charm
monster, and of silence 15' radius among their modes in the page's words, and fails if a page no
longer matches the division. ReversedForm.prose keeps the whole text.

spells.json is regenerated: 149 modes gain a display_name and 15 modes change prose. No other
generated file and no golden file changes.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
The changelog names SpellMode.display_name and shows the old and new prose of darkness's blind
mode. The custom content guide lists display_name among SpellMode's fields and says how a mode
without one is labelled.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
A label of only spaces now counts as missing, and a label made from a key
with underscores at either end, a run of underscores, or a first character
whose capital is two characters is pinned. The two sleep labels say which
creatures each mode works on, in the page's words, because "Put a creature
to sleep" read as any one creature.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
A display_name of only whitespace now counts as missing. The label made from a key turns each run of
underscores into one space, drops spaces at either end, and capitalizes the first character only
when its capital is one character, so "ß_key" stays "ß key". A key of only underscores is its own
label, so no label is empty. This follows the amended SpellMode.display_name contract in 2ea7921.

The sleep labels now say which creatures each mode works on, in the page's words: "Put a creature
with 4+1 Hit Dice to sleep" and "Put creatures of 4 Hit Dice or lower to sleep". spells.json is
regenerated for those two labels, and no other generated or golden file changes.

The changelog bullet and the custom content guide state the trimmed key rule.

Claude-Session: https://claude.ai/code/session_01V7Ertq3gKJ46oFQD6635f3
@mmacy
mmacy merged commit e0b4d6b into main Nov 26, 2026
5 checks passed
@mmacy
mmacy deleted the spell-mode-names branch November 26, 2026 16:06
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.

The modes of darkness share one prose, so a client can't tell them apart

1 participant