Skip to content

fix: improve type specificity for JSON serialization in stats/base/ztest/one-sample#12934

Draft
Planeshifter wants to merge 1 commit into
developfrom
philipp/fix-propagation-2026-06-17
Draft

fix: improve type specificity for JSON serialization in stats/base/ztest/one-sample#12934
Planeshifter wants to merge 1 commit into
developfrom
philipp/fix-propagation-2026-06-17

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

Propagating the type-specificity fix from d8fdfb7f ("fix: improve type specificity for JSON serialization") to the one-sample Z-test results to-json sibling, which shared the same defect: res2json was typed as returning the input Results interface, but the serialized form differs in the shape of ci (Float64Array | Float32Array -> { type: string; data: Array<number> }). Adds a distinct ResultsJSON interface and updates the return type and $ExpectType assertion accordingly.

Related Issues

None.

Questions

No.

Other

This PR was originally a single-PR bundle covering three source patterns from the prior 24-hour window. Per maintainer feedback (squash-merge requires per-commit-type accuracy to avoid spurious patch releases), the bundle was split:

  • fix: Pattern (this PR): d8fdfb7f type-specificity fix propagated to @stdlib/stats/base/ztest/one-sample/results/to-json.
  • style: Pattern (split into a sibling PR): 8e421b2b missing-decimal fix propagated to @stdlib/stats/base/dists/erlang/mgf.
  • style: Pattern (deferred): 91c5dd10 0.0/0.0 -> 0.0 / 0.0 spacing sweep across 212 stats/base/dists/*/src/main.c files exceeded the Run affected tests CI 30-minute budget and was dropped from same-day propagation. Recommended as a maintainer-direct push with [skip ci].

Validation

  • Search scoped to stats/base/ztest/*/results/to-json; the one-sample sibling was the only candidate site.
  • Two independent opus validation passes plus a sonnet style-consistency pass confirmed the new ResultsJSON interface mirrors the one-sample Results interface field-for-field, with ci replaced by { type, data } exactly as in the two-sample reference.

Checklist

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 on behalf of @Planeshifter as an automated propagation of fixes merged to develop over the prior 24 hours. Candidate source commits were filtered for generalizable patterns, sibling sites located via grep-able pattern signatures, and each proposed patch independently validated by parallel reviewer agents before commits were applied in the primary worktree. A human will audit and promote the PR out of draft.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Statistics Issue or pull request related to statistical functionality. label Jun 17, 2026
@stdlib-bot

stdlib-bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/base/ztest/one-sample/results/to-json $\\color{green}122/122$
$\\color{green}+0.00\\%$
$\\color{green}3/3$
$\\color{green}+0.00\\%$
$\\color{green}1/1$
$\\color{green}+0.00\\%$
$\\color{green}122/122$
$\\color{green}+0.00\\%$

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

…test/one-sample`

Propagates fix from d8fdfb7 ("fix: improve type specificity for JSON
serialization") to the one-sample Z-test results to-json sibling, which
shared the same defect: `res2json` was typed as returning the input
`Results` interface, but the serialized form differs in the shape of
`ci` (Float64Array/Float32Array -> { type, data }). Adds a distinct
`ResultsJSON` interface and points the declaration's return type at it,
mirroring the two-sample fix verbatim.
@Planeshifter Planeshifter force-pushed the philipp/fix-propagation-2026-06-17 branch from 7fd2090 to d95378c Compare June 17, 2026 14:25
@Planeshifter Planeshifter changed the title fix: propagate recent develop fixes to sibling stats/base packages chore: propagate recent develop fixes to sibling stats/base packages Jun 17, 2026
@Planeshifter Planeshifter changed the title chore: propagate recent develop fixes to sibling stats/base packages fix: propagate recent develop fixes to sibling stats/base packages Jun 17, 2026
@Planeshifter

Copy link
Copy Markdown
Member Author

For accurate commit types and history, will have to create separate PRs given we always squash commits upon merging. As-is, fix: will trigger new patch release for stats/base/dists/erlang/mgf during next release cycle, which wouldn't be necessary.

@Planeshifter Planeshifter requested a review from kgryte June 17, 2026 14:39
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jun 17, 2026
@Planeshifter Planeshifter force-pushed the philipp/fix-propagation-2026-06-17 branch from d95378c to f4a318d Compare June 17, 2026 14:40
@Planeshifter Planeshifter changed the title fix: propagate recent develop fixes to sibling stats/base packages fix: improve type specificity for JSON serialization in stats/base/ztest/one-sample Jun 17, 2026
@Planeshifter Planeshifter mentioned this pull request Jun 17, 2026
7 tasks

Copy link
Copy Markdown
Member Author

Split the bundle. This PR now carries only the fix: propagation to @stdlib/stats/base/ztest/one-sample/results/to-json; the style: decimal fix for stats/base/dists/erlang/mgf lives in #12937. The third source pattern (the 91c5dd10 0.0/0.0 spacing sweep across 212 stats/base/dists/* files) was dropped — Run affected tests rebuilds every NAPI add-on touched by the PR, which exceeded the 30-minute job budget; recommending that one as a direct push with [skip ci] if you want it landed.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review A pull request which needs code review. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants