Write a Module Overview From Source Code That Explains Intent, Invariants, and Gotchas
Read the source code below and write an overview document for an engineer who is new to this module. The goal is understanding, not a restatement of each function. Structure: 1. **Purpose** in two or three sentences: what problem this module solves and for whom. If you cannot tell from the code, say so rather than guessing. 2. **Mental model.** The main concepts and how they relate, using the names that appear in the code. 3. **Key flows.** Walk through the two or three most important paths end to end (for example "a request comes in" or "a job is retried"). 4. **Invariants.** Rules the code relies on that are not enforced by types or tests, such as ordering assumptions, required locks, units, or expected non-null values. 5. **Gotchas.** Surprising behavior, hidden side effects, performance cliffs, and places where the name does not match what the code does. 6. **Where to change what.** For common kinds of changes, name the file or function to start from and what to double-check afterward. 7. **Open questions.** Things that look intentional but you could not verify, phrased as questions for the code's owners. Rules: only state what the code supports and mark inferences as inferences. Quote short identifiers, not long code blocks. Keep it under 700 words. SOURCE: [paste code here]
Sign in to upvote this prompt.