Skip to content

refactor: use format for error messages in stats/base/dists/hypergeometric/ctor - #13799

Closed
Planeshifter wants to merge 1 commit into
developfrom
philipp/drift-stats-base-dists-hypergeometric-2026-07-31
Closed

refactor: use format for error messages in stats/base/dists/hypergeometric/ctor#13799
Planeshifter wants to merge 1 commit into
developfrom
philipp/drift-stats-base-dists-hypergeometric-2026-07-31

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves N/A.

Description

What is the purpose of this pull request?

This pull request:

  • Routes the two constructor RangeError messages in @stdlib/stats/base/dists/hypergeometric/ctor (the K > N and n > N guards in lib/main.js) through @stdlib/string/format, the canonical error-construction helper.

@stdlib/stats/base/dists/hypergeometric/ctor

The two constructor cross-parameter RangeError guards were the only throws in the package built from plain string literals; every other throw in the same file — the three TypeError argument checks and all six property setters — already uses format. All 34 stats/base/dists/*/ctor packages construct thrown errors via format (100% conformance), leaving these two the sole plain-string outliers. Message text is unchanged and the thrown type stays RangeError, so no observable behavior or test expectation changes.

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.

Diff is +2/-2 in a single file. format is already imported. The package tests assert error type (RangeError) only, not message text, and format returns a constant (no %-specifier) message unchanged, so the change is mechanical with no cascade into tests, examples, or docs.

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 PR was authored by Claude Code running the cross-package drift-detection routine. The namespace @stdlib/stats/base/dists/hypergeometric was selected by uniform-random pick over eligible directories (≥8 direct child packages) under lib/node_modules/@stdlib/; structural and per-package semantic features were extracted across all 11 members; majority patterns were computed at the 75% threshold; and three independent validation agents (opus semantic-review, opus cross-reference, sonnet structural-review) confirmed this correction as confirmed-drift before any file was edited. The within-namespace vote was internally consistent (matching prior run #12647); this correction was surfaced by the canonical-format error-construction invariant and confirmed by the ≥90% ecosystem-wide gate.


@stdlib-js/reviewers


Generated by Claude Code

…eometric/ctor`

Route the two constructor `RangeError` messages (`K > N` and `n > N`
guards) through `@stdlib/string/format`, matching the canonical
error-construction convention. Every other throw in this file already
uses `format` (three `TypeError` argument checks and all six property
setters), and all 34 `stats/base/dists/*/ctor` packages construct
thrown errors via `format` (100% conformance); this package held the
only two plain-string throws. Message text is unchanged and the thrown
error type remains `RangeError`, so no observable behavior or test
expectation changes (tests assert error type only).
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Jul 31, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/hypergeometric/ctor $\\color{green}415/415$
$\\color{green}+100.00\\%$
$\\color{green}41/41$
$\\color{green}+100.00\\%$
$\\color{green}17/17$
$\\color{green}+100.00\\%$
$\\color{green}415/415$
$\\color{green}+100.00\\%$

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

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no variables to interpolate in the error message string. Closing...

@kgryte kgryte closed this Jul 31, 2026
@kgryte
kgryte deleted the philipp/drift-stats-base-dists-hypergeometric-2026-07-31 branch July 31, 2026 11:15
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