Repository navigation
Docstrings: crawl commands - #88
Merged
Merged
Conversation
Give every command field, enum member, and result field an attribute docstring, so the generated reference stops rendering them as bare names. Each one says what the value is, where a caller gets it, and what happens when it's wrong. Rewrite the module docstring to lead with the call path and carry a runnable usage block, and add an example to parse_command. Claude-Session: https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa
Extend the wording pass to the docstrings the first commit didn't touch, so the whole module reads the same way. Em dashes and en dashes are gone, semicolon splices are two sentences, the arrow chain is prose, and the coined phrases and tacked-on qualifiers are plain words. The rejection and event lists keep the shape the docs gates parse; only the separator changes from an em dash to a hyphen. Claude-Session: https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa
The Events sections of the commands with a cascade behind them named a few event classes and left the rest as prose, so the reader had nothing to click through to. Trace each handler and name every class it can emit, keeping the condition each one fires under. ResolveBattleRound's list is grouped by phase. Also: name the three referee commands a concluded session withholds instead of implying the exception is a set of modes, drop a minimizer in RevealObjective, and take the bold off a running sentence in TakeTreasure. Claude-Session: https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa
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.
A front-end developer reading the published reference can now build a command without opening the source. Every command field, every
SessionModemember, and the threeCommandResultfields used to render as a bare name and a type; each one now says what the value is, which view or loader the id comes from, and which rejection code a wrong value produces. The module docstring leads with the call path (build a command, execute it, render the events, read state through the view) and carries a runnable usage block that walks from character creation to a serialized command and back, andparse_commandhas an example.The second commit puts the whole module into one register, including the docstrings the first commit did not otherwise touch. Em dashes and en dashes are gone, semicolon splices are two sentences each, the
inactivetoactivetocompletedarrow chain is prose, and coined phrases like "defensive twin of the mode gate" and "salvage door" say what they mean. In the rejection and event lists only the separator changed, from an em dash to a hyphen, so the sections keep the shape the docs gates parse.I corrected one claim while writing it.
BattleDeclaration.moveaccepts four values, but_party_movementinbattle.py(lines 1291-1333) resolves onlyclose,fighting_withdrawal, andretreat. Awithdrawdeclaration passes validation and then moves nobody, so I documented it that way. That looks like a defect rather than a design choice, and it is outside this batch.I also found two comments in
battle.pythat disagree with the code, and left both alone:_party_movement's docstring says the firstclosedeclaration "in marching order" advances the formation, butby_memberis built fromcommand.declarationsin the order they were given, so it is the first entry in the list.EncounterView.immobileinviews.pysayscloseandwithdrawmoves are rejected for its members, which is true but incidental, since thecannot_movecheck covers everymovedeclaration.I left the per-subclass
command_typeandallowed_modesoverrides without docstrings on purpose. Both are documented once onCommand, the rendered signature shows each subclass's literal value, and each class'sModes:section already names the modes in prose, so a docstring on all of them would be the same sentence repeated for every command.https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa