Skip to content

Docstrings: crawl exploration - #87

Merged
mmacy merged 3 commits into
mainfrom
docs/api-ref-crawl-exploration
Sep 14, 2026
Merged

Docstrings: crawl exploration#87
mmacy merged 3 commits into
mainfrom
docs/api-ref-crawl-exploration

Conversation

@mmacy

@mmacy mmacy commented Sep 14, 2026

Copy link
Copy Markdown
Owner

I rewrote the module docstring and the eleven exported members of osrlib.crawl.exploration so a reader on the published reference can work from that page alone. The module docstring now leads with where the module sits: which command models in osrlib.crawl.commands it answers, that GameSession.execute is the entry point and HANDLERS the lookup it uses, and that what comes back is a CommandResult of rejections or osrlib.crawl.events models. It then names the per-turn bookkeeping the session runs on its own cadence, and closes with a usage block that enters a dungeon, moves, gets a move rejected, and reads the exploration rate.

The four effect-kind constants, EXHAUSTED_DEFINITION, HANDLERS and HEALING_SERVICES had no docstrings and rendered as bare names. They now say what each is for, how to query it, and what to use instead: the kind constants go through EffectsLedger.active_on, HANDLERS says to send commands through execute rather than calling a handler out of the mapping, and HEALING_SERVICES says its keys are exactly the values PurchaseHealing.service accepts. Every function and both mappings carry a runnable example, and all of them ran under the docs harness.

I corrected one docstring because the code disagrees with it. check_fatigue said it returns nothing "once fatigue is already active on every living member", but the guard at src/osrlib/crawl/exploration.py:776 short-circuits on any(...), not every member, so the docstring now says the list is empty when any living member is already fatigued. I also replaced wandering_interval's "an effectively unreachable value outside a dungeon" with the number the function actually returns, 1000000000, since a caller comparing against it needs to know what it is.

No examples are no-run, and I left nothing in __all__ undocumented. The underscore-prefixed handlers stay undocumented: the renderer filters them out, and the members that would send a reader to one name the command class instead.

https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa

Rewrite the module docstring and the eleven exported members of
osrlib.crawl.exploration for a reader working from the published API
reference alone: where the module sits between the command models, the
session that dispatches them, and the events they emit; what each
member is for; what to call instead; and a runnable example on every
function and mapping.

Claude-Session: https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa
Say that an exploration rate of 0 also covers a party with no living
member, and that _handle_move_party rejects with reason `overloaded`
either way. Name Character.movement_rate as what to call for one
character's allowance. Say in the module docstring that DropItems and
UseItem also serve encounter mode. Say that adding a key to
HEALING_SERVICES adds no service, because PurchaseHealing.service
rejects a name that isn't already on it.

Claude-Session: https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa
Bring the internal docstrings and the code comments into the same
register as the public ones. Em and en dashes go, semicolon splices
become two sentences, and "pinned" gives way to the fact each comment
was compressing: what osrlib fixes where the rules leave a choice, and
which of those the adaptations register records. Checked each reworded
claim against the code, and the module's executable statements are
byte-identical to origin/main.

Claude-Session: https://claude.ai/code/session_01GL26QnA6dCrvUc3WmhzFSa
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.

1 participant