Skip to content

refactor: align stats/base/dists/hypergeometric/mean with namespace conventions#11693

Draft
Planeshifter wants to merge 1 commit intodevelopfrom
philipp/drift-stats-base-dists-hypergeometric-2026-04-21
Draft

refactor: align stats/base/dists/hypergeometric/mean with namespace conventions#11693
Planeshifter wants to merge 1 commit intodevelopfrom
philipp/drift-stats-base-dists-hypergeometric-2026-04-21

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Aligns outliers in stats/base/dists/hypergeometric with namespace majority patterns (random namespace pick, seed 1776774012099).

Namespace summary

  • Members (non-autogenerated): 11 — cdf, ctor, kurtosis, logpmf, mean, mode, pmf, quantile, skewness, stdev, variance.
  • Features analyzed: file tree, package.json shape (top-level, scripts, stdlib, directories, engines, os, types, repository), manifest.json shape, README ##/### heading sequence, test//benchmark//examples/ file naming, public signature, return kind, validation prologue, error construction, JSDoc shape, @stdlib/* dependency set.
  • Features with clear majority (≥75% conformance): core file set (10/11–11/11), package.json top-level keys (11/11), README ## section sequence [Usage, Examples] (11/11), moment-function validation prologue (4/5 = 80% among moment-computing siblings with explicit validation), return kind value (11/11), JSDoc hasExample (11/11).
  • Features without clear majority (excluded from drift detection): native-addon scaffolding — binding.gyp, src/*, manifest.json, benchmark/benchmark.native.js, test/test.native.js, benchmark/c/*, examples/c/* (7/11 = 64%); presence of lib/factory.js (4/11); errorConstruction (only ctor constructs errors, which already uses format).

stats/base/dists/hypergeometric/mean

Removes a redundant isnan(N)||isnan(K)||isnan(n) guard and the associated @stdlib/math/base/assert/is-nan require from stats/base/dists/hypergeometric/mean. Within stats/base/dists/hypergeometric, the four sibling moment utilities kurtosis, mode, skewness, and variance (80% conformance) rely solely on the !isNonNegativeInteger predicate to reject NaN inputs — !isNonNegativeInteger(NaN) is true, so the separate NaN guard is unreachable dead code. Behavior and test coverage are unchanged.

Validation

  • Structural feature extraction: file tree, package.json / manifest.json keys, README ##/### heading sequence, test//benchmark//examples/ filenames.
  • Semantic feature extraction via per-package agents (11 packages): public signature, return kind, validation prologue, error-construction style, JSDoc shape, @stdlib/* dependency set.
  • Three-agent drift validation: semantic review (opus), cross-reference check against tests/examples/sibling docs (opus), structural review against sibling-distribution ctor packages (sonnet).
  • Deliberately excluded from corrections:
    • ctor missing test/fixtures/julia/{REQUIRE,data.json,runner.jl} — sibling-distribution ctor packages (stats/base/dists/normal/ctor, .../binomial/ctor, .../poisson/ctor, .../beta/ctor) also lack Julia fixtures; the ctor test is a structural class test and numeric correctness is already covered by the delegated-to sibling packages. Classified as intentional deviation.
    • Native-addon scaffolding drift (7/11 packages ship C accelerators): below the 75% majority threshold; not drift, just a feature-set difference.

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.

Output of a cross-package drift-detection routine over a randomly selected stdlib namespace (stats/base/dists/hypergeometric, seed 1776774012099). See the local drift report for the full per-feature tally, excluded findings, and agent verdicts. Draft PR: a maintainer should audit before promoting to ready-for-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

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

Claude Code executed a cross-package drift-detection routine that randomly selected the stats/base/dists/hypergeometric namespace (seed 1776774012099), extracted structural and semantic features across the 11 sibling packages, computed majority patterns, and identified outliers. Three validation agents (opus × 2, sonnet × 1) independently verified each drift candidate; only findings classified as confirmed-drift by all relevant agents were applied as mechanical, behavior-preserving patches. A maintainer must audit before promoting from draft.


@stdlib-js/reviewers

… conventions

Dropped the redundant `isnan(N)||isnan(K)||isnan(n)` guard block at the
top of `mean()`; `!isNonNegativeInteger()` already rejects NaN, matching
the 7-guard validation prologue used by `kurtosis`, `mode`, `skewness`,
and `variance` (80% of hypergeometric moment-computing siblings with
explicit validation). Also removed the now-unused `@stdlib/math/base/assert/is-nan`
require. Behavior is preserved — NaN inputs still return NaN.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Apr 21, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/hypergeometric/mean $\color{green}194/194$
$\color{green}+100.00%$
$\color{green}13/13$
$\color{green}+100.00%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{green}194/194$
$\color{green}+100.00%$

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

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.

3 participants