Reviewer · Documentation
Document rationale and dependencies
Comments and API/schema descriptions should explain *why* something exists and what it depends on, not merely restate what the code does, and must be attached directly to the symbol they describe. When trimming or rewriting a doc block, keep the reasoning that justifies the code's existence or behavior (e.g., "this retries because bootstrap runs on first...
Comments and API/schema descriptions should explain why something exists and what it depends on, not merely restate what the code does, and must be attached directly to the symbol they describe. When trimming or rewriting a doc block, keep the reasoning that justifies the code’s existence or behavior (e.g., “this retries because bootstrap runs on first read/write after deploy, so failure here fails the caller’s request”) rather than reducing it to a one-line summary of mechanics. Use precise, verifiable language: prefer exact relational wording (while vs until) and name the concrete field/flag a behavior depends on (e.g., auto_apply_filters) instead of vague phrasing, so API consumers can act on the description. Any non-obvious or conditional behavior that affects API consumers—such as an authorization check that only applies under certain request bodies—must be documented where it will be surfaced (schema meta.description, route descriptions) so it appears in generated docs (e.g., OAS). Finally, verify that multi-block JSDoc comments land on the declaration they are meant to document; a stacked comment above the wrong export silently documents nothing.
Example:
/**
* Retries the Elasticsearch errors a starting/busy cluster produces, and results the caller
* marks as incomplete. Resource creation runs on the first read or write after a deploy, when
* the cluster is least likely to be ready, so a failure here fails the caller's request rather
* than only the installation.
*/
export const retryTransientEsErrors = ...;
// Schema description naming the actual dependency and using precise wording:
required: z.boolean().meta({
description:
"When `true`, dashboard panels do not render while the control has no selection. " +
"If the dashboard's `auto_apply_filters` option is `false`, the selection must also be applied before panels render.",
});
</description> </invoke>