Skip to content

docs: fix example - #14152

Merged
kgryte merged 4 commits into
developfrom
philipp/drift-stats-base-dists-degenerate-2026-08-10
Aug 10, 2026
Merged

kgryte merged 4 commits into
developfrom
philipp/drift-stats-base-dists-degenerate-2026-08-10

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Corrects two documentation/metadata inconsistencies in the stats/base/dists/degenerate namespace so that outlier packages match the conventions shared by their siblings.

Description

What is the purpose of this pull request?

This pull request normalizes summary strings and fixes a broken factory example uncovered by a cross-package consistency audit of the @stdlib/stats/base/dists/degenerate namespace (15 members). Two members deviated from namespace conventions; both corrections are mechanical, sibling-derived, and change no observable behavior.

Namespace summary

  • Members analyzed: 15 — cdf, ctor, entropy, logcdf, logpdf, logpmf, mean, median, mgf, mode, pdf, pmf, quantile, stdev, variance.
  • Features analyzed: file tree, package.json shape and values, manifest.json shape, README section structure, JSDoc / @module summaries, public signatures, validation prologues, error construction, and require() dependencies.
  • Features with a clear majority (≥75%): package summary leading phrase — "Degenerate distribution ..." (14/15 = 93%); factory @example variable convention (7/8 factory-bearing members).
  • Features without a clear majority (excluded): @param {number} mu prose (three variants, max 8/15) and per-function @returns descriptions (function-specific). Left untouched.

@stdlib/stats/base/dists/degenerate/logpmf

This package's summary string diverged from the degenerate namespace convention, under which every sibling leads with "Degenerate distribution ..."; logpmf alone read "Natural logarithm of the probability mass function (PMF) for a degenerate distribution." The package.json description and the lib/index.js @module summary are normalized to the logcdf/logpdf form ("Degenerate distribution logarithm of probability mass function (logPMF).") — 14/15 = 93% conformance. Metadata and documentation only; no functional or behavioral change.

@stdlib/stats/base/dists/degenerate/mgf

The lib/index.js @module factory @example declared the returned function as mgf via factory( 10.0 ) but then invoked an undefined identifier mymgf, which throws a ReferenceError if executed. The call is renamed to mgf so the declared and invoked identifiers match, consistent with the factory examples in 7 of 8 factory-bearing sibling packages, which invoke the same identifier they declare (for example, var pdf = factory( 10.0 ); var y = pdf( 10.0 );). Documentation only; no functional change.

Validation

Structural features were extracted from the filesystem (file trees, package.json / manifest.json shape, README sections); semantic features (signatures, validation prologues, error construction, JSDoc shape, dependencies) were extracted per package and cross-checked by independent review agents. Each candidate correction passed a three-lens drift validation covering semantic intent, cross-reference against tests and examples, and structural applicability. Deliberately excluded from correction: intentional deviations — ctor is a class constructor and legitimately lacks the C/native layer, and mean/median/mode return mu directly so they correctly omit the isnan guard that variance/stdev/entropy require; features without a ≥75% majority; and any change that would touch tests, REPL fixtures (repl.txt), or generated type declarations (*.d.ts).

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Both corrections are documentation/metadata only (package.json description, a lib/index.js @module summary, and a JSDoc @example); no source logic, tests, or public signatures are modified. Opened as a draft for maintainer review.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This pull request was authored by Claude Code running an automated cross-package API drift-detection routine. The routine audited the stats/base/dists/degenerate namespace via majority vote, validated each candidate correction against sibling conventions, and applied the mechanical fixes. All changes were reviewed for correctness.


@stdlib-js/reviewers

claude added 2 commits August 10, 2026 20:24
Normalize the package summary strings to follow the sibling naming
convention shared across the `degenerate` namespace.

- package.json `description`: rewrote "Natural logarithm of the
  probability mass function (PMF) for a degenerate distribution." to
  "Degenerate distribution logarithm of probability mass function
  (logPMF)." to match the `logcdf`/`logpdf` package descriptions
  (14/15 = 93% of members lead with "Degenerate distribution ...").
- lib/index.js `@module` summary: applied the same leading-phrase
  normalization, mirroring `logpdf`'s "Degenerate distribution natural
  logarithm of ... (logPDF)." form.

No functional changes; documentation and metadata only.
The `lib/index.js` `@module` factory example declared `mgf` via
`factory( 10.0 )` but invoked an undefined `mymgf`, which would throw a
`ReferenceError` if executed. Rename the call to `mgf` so the declared and
invoked identifiers match. This aligns with the factory examples in the
sibling packages (7/8 factory-bearing members use
`var <name> = factory( ... ); var y = <name>( ... );`).

No functional changes; documentation only.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Aug 10, 2026
@stdlib-bot

stdlib-bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/degenerate/logpmf $\\color{green}249/249$
$\\color{green}+0.00\\%$
$\\color{green}19/19$
$\\color{green}+0.00\\%$
$\\color{green}4/4$
$\\color{green}+0.00\\%$
$\\color{green}249/249$
$\\color{green}+0.00\\%$
stats/base/dists/degenerate/mgf $\\color{green}253/253$
$\\color{green}+0.00\\%$
$\\color{green}14/14$
$\\color{green}+0.00\\%$
$\\color{green}4/4$
$\\color{green}+0.00\\%$
$\\color{green}253/253$
$\\color{green}+0.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte
kgryte marked this pull request as ready for review August 10, 2026 20:48
@kgryte
kgryte requested a review from a team August 10, 2026 20:48
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 10, 2026
@kgryte kgryte changed the title docs: correct summary phrasing and factory example in stats/base/dists/degenerate docs: fix example Aug 10, 2026
@kgryte
kgryte merged commit fc38da1 into develop Aug 10, 2026
30 checks passed
@kgryte
kgryte deleted the philipp/drift-stats-base-dists-degenerate-2026-08-10 branch August 10, 2026 20:54
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants