Skip to content

test: collapse exact-match guard in stats/base/dists/wald tests#11880

Merged
kgryte merged 1 commit intodevelopfrom
philipp/fix-propagation-2026-05-01
May 2, 2026
Merged

test: collapse exact-match guard in stats/base/dists/wald tests#11880
kgryte merged 1 commit intodevelopfrom
philipp/fix-propagation-2026-05-01

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Propagates fixes merged to develop between 2026-05-01 02:09:52 -0700 and 2026-05-01 04:48:43 -0500 to sibling packages.

stats/base/dists/wald: collapse exact-match-or-tolerance test guard

Propagates the eeaf7c4 refactor from stats/base/dists/wald/mode — which collapsed the branched exact-match-or-tolerance guard into a single unconditional t.strictEqual( isAlmostSameValue( y, expected[i], TOL ), true, ... ) — to the 7 test files across stats/base/dists/wald/pdf, stats/base/dists/wald/variance, and stats/base/dists/wald/skewness. The collapse is safe because isAlmostSameValue(a, a, tol) returns true for any finite tolerance, so the exact-match branch was always redundant.

Source: eeaf7c4 (refactor: reduce number of arithmetic operations)

Targets:

  • lib/node_modules/@stdlib/stats/base/dists/wald/pdf/test/test.factory.js
  • lib/node_modules/@stdlib/stats/base/dists/wald/pdf/test/test.native.js
  • lib/node_modules/@stdlib/stats/base/dists/wald/pdf/test/test.pdf.js
  • lib/node_modules/@stdlib/stats/base/dists/wald/skewness/test/test.js
  • lib/node_modules/@stdlib/stats/base/dists/wald/skewness/test/test.native.js
  • lib/node_modules/@stdlib/stats/base/dists/wald/variance/test/test.js
  • lib/node_modules/@stdlib/stats/base/dists/wald/variance/test/test.native.js

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.

Validation. Search scope was lib/node_modules/@stdlib/stats/base/dists/wald/**/test/*.js. Two independent validation agents read each candidate file in full and confirmed the defect; an adaptation agent produced concrete patches preserving each site's tolerance and else-branch message verbatim; a style-consistency agent checked indentation and spacing against the source commit's form. All 7 sites were unanimously confirmed and self-contained within the target test file.

Excluded.

  • dabdc73c (docs: update examples, ndarray/vector/ctor): the dtypes('real_and_generic')dtypes('integer_and_generic') change pairs an integer-valued discreteUniform generator with the appropriate dtype filter. 4 textually similar example sites exist under ndarray/base/{nullary,unary}-strided1d-dispatch{,-factory}, but each requires a judgment call about the example's intended dtype kind and was therefore deferred to manual review per the routine's high-signal-only criterion.
  • 642af215 (docs: remove extra empty line, stats/base/ndarray/dmeanlipw/README.md): no remaining sibling READMEs with the <!-- /.c -->\n\n\n* * * double-blank-line pattern.
  • eeaf7c48 arithmetic-reduction part (3.0*r/2.0 repeated subexpression in wald/mode/lib/main.js and src/main.c): no other distribution function reuses that exact algebraic form.

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.".

This PR was prepared by Claude Code as part of an automated fix-propagation routine: the recent develop commit window was scanned for generalizable fixes, candidate sibling sites were enumerated by rg, and four parallel validation/adaptation/style agents independently confirmed each propagation site before the patches were applied.


@stdlib-js/reviewers


Generated by Claude Code

Propagates the test-assertion simplification from eeaf7c4 ("refactor:
reduce number of arithmetic operations") to sibling Wald distribution
packages (pdf, variance, skewness). Replaces the redundant
`if ( y === expected[i] ) { t.strictEqual( y, ... ) } else { t.ok(
isAlmostSameValue( y, expected[i], TOL ) ) }` block with an unconditional
`t.strictEqual( isAlmostSameValue( y, expected[i], TOL ), true, ... )`,
since `isAlmostSameValue` already accepts exact matches.
@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label May 1, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/wald/pdf $\color{green}360/360$
$\color{green}+100.00%$
$\color{green}33/33$
$\color{green}+100.00%$
$\color{green}4/4$
$\color{green}+100.00%$
$\color{green}360/360$
$\color{green}+100.00%$
stats/base/dists/wald/skewness $\color{green}185/185$
$\color{green}+100.00%$
$\color{green}10/10$
$\color{green}+100.00%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{green}185/185$
$\color{green}+100.00%$
stats/base/dists/wald/variance $\color{green}176/176$
$\color{green}+100.00%$
$\color{green}10/10$
$\color{green}+100.00%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{green}176/176$
$\color{green}+100.00%$

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

@Planeshifter Planeshifter marked this pull request as ready for review May 1, 2026 22:02
@Planeshifter Planeshifter requested a review from a team May 1, 2026 22:02
@Planeshifter Planeshifter changed the title refactor: collapse exact-match guard in stats/base/dists/wald tests test: collapse exact-match guard in stats/base/dists/wald tests May 1, 2026
@Planeshifter Planeshifter requested a review from kgryte May 1, 2026 22:03
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label May 1, 2026
@kgryte kgryte added Tests Pull requests specifically adding tests. and removed Needs Review A pull request which needs code review. labels May 2, 2026
@kgryte kgryte merged commit bda2f4f into develop May 2, 2026
75 checks passed
@kgryte kgryte deleted the philipp/fix-propagation-2026-05-01 branch May 2, 2026 08:58
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. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants