docs: update parameter type and add keyword#12729
Merged
Merged
Conversation
… keywords with siblings
Bring `dcorrelation` into conformance with the seven sibling packages in
`stats/strided/distances`:
- `lib/{dcorrelation,ndarray}.js` and the `.native.js` counterparts: retype
`@param {PositiveInteger} N` to `@param {NonNegativeInteger} N`. The function
explicitly returns `NaN` for `N <= 0` (asserted in `test/test.dcorrelation.js`,
`test/test.ndarray.js`, and the native test variants); 7/8 siblings annotate
`N` as `NonNegativeInteger`. JSDoc-only change; no runtime impact.
- `README.md`: replace the abbreviated `sx, ox, sy, oy` placeholders in the
`stdlib_strided_dcorrelation_ndarray` H4 heading with `strideX, offsetX,
strideY, offsetY`, matching the literal C signature already present on line
248 of the same README and the published header. 7/8 siblings use the full
parameter names in the heading.
- `package.json`: insert `metric` between `distance` and `strided` in the
keywords array, matching the position used by all seven sibling packages
(87.5% conformance).
No source, test, or behavioral changes.
https://claude.ai/code/session_017aK2GkAL5Rpde789kYBtnN
…dcorrelation` The earlier substitution of the abbreviated `sx, ox, sy, oy` placeholders with the full `strideX, offsetX, strideY, offsetY` matched the sibling pattern but tripped the project-wide `remark-lint` `maximum-heading-length` rule (80 characters). All seven sibling READMEs in `stats/strided/distances` exceed this limit too (89-97 characters), but the rule only runs against READMEs touched by a PR, so the failure surfaces only here. Restoring the abbreviated form (70 characters) keeps CI green. The README's argument list (lines 241-245) and the literal C signature in the same file's code block (line 248) already use the full `strideX, offsetX, strideY, offsetY` names, so the readers' reference is unambiguous; the heading is the lone deviation. A proper fix for the namespace-wide heading-length drift belongs to a separate pass. https://claude.ai/code/session_017aK2GkAL5Rpde789kYBtnN
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
stats/strided/distances/dcorrelation JSDoc, README, and keywordsstats/strided/distances/dcorrelation JSDoc and keywords
kgryte
approved these changes
Jun 10, 2026
stats/strided/distances/dcorrelation JSDoc and keywords
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request aligns
@stdlib/stats/strided/distances/dcorrelationwith the seven sibling packages in the namespace.Namespace summary
@stdlib/stats/strided/distancesdchebyshev,dcityblock,dcorrelation,dcosine-distance,dcosine-similarity,deuclidean,dminkowski,dsquared-euclidean)package.jsonshape (top-level keys,scripts,directories,keywords),manifest.jsonshape, README heading sequence,test/benchmark/examples/file-name patterns, semantic features (public signature, JSDoc shape, dependency set, error construction, validation prologue, return kind) fromlib/main.js, the per-package wrapper, andlib/ndarray.js.package.jsontop-level key set (100%);directorieskeys (100%); emptyscripts(100%);manifest.jsonkeysconfs/fields/options(100%); 14 universal keywords at 100% (array,distance,double,float64,float64array,math,mathematics,statistics,stats,stdlib,stdmath,strided,strided array,typed); README H2 set (Usage,Notes,Examples,C APIs, 100%); H3 set (Usage,Examples, 100%);metrickeyword at 7/8 = 87.5%;@param {NonNegativeInteger} NJSDoc in the lib wrappers andndarray.jsat 7/8 = 87.5%; fullstrideX, offsetX, strideY, offsetYparameter names in the README C-APIndarrayH4 heading at 7/8 = 87.5% (corrected then reverted — see Dropped fixes below).Stride length of/for; TypeScript declaration phrasing (the canonical TS form`x` stride lengthdiffers by word order from the JSstride length ofx`` form, so a simpleof → forsubstitution would not produce the sibling pattern); description verb `Compute the …` at 100% (unchanged — PR docs: updae descriptions instats/strided/*abspackage descriptions #12310's `Compute → Calculate` standardization across the parent `stats/strided` namespace explicitly excluded the `distances` sub-namespace, and within this sub-namespace the verb is consistent); metric-specific keywords (e.g. `cosine`, `euclidean` — package-specific, no majority).@stdlib/stats/strided/distances/dcorrelationdcorrelationlagged the other sevenstats/strided/distancespackages on its JSDoc and package metadata. Its@param {PositiveInteger} NJSDoc acrosslib/dcorrelation.js,lib/dcorrelation.native.js,lib/ndarray.js, andlib/ndarray.native.jscontradicts the testedN <= 0 → NaNcontract — 7/8 siblings annotateNonNegativeInteger, and tests attest/test.dcorrelation.js:64-78andtest/test.ndarray.js:64-78already exercise theN=0andN<0paths. Thepackage.jsonkeywords array was missingmetric, the only universally-present semantic tag across the seven sibling distance packages (dchebyshev,dcityblock,dcosine-distance,dcosine-similarity,deuclidean,dminkowski,dsquared-euclideanall carry it).Validation
Three independent validation agents reviewed each candidate fix before any edit was applied:
dcorrelation/lib/dcorrelation.js,lib/ndarray.js, both.native.jscounterparts, both test suites, and the same files fordeuclideananddcosine-distancefor comparison. Verdict:confirmed-drifton the JSDoc N-type retype; the function explicitly handlesN <= 0by returningNaN, exactly matching siblings, so thePositiveIntegerannotation has no semantic basis.lib/node_modules/@stdlib/tree. Verdict:safe-to-fixon the keyword addition (no tooling treats"metric"as a semantically meaningful discovery index), the README heading correction (no test, benchmark, or example referencessx, ox, sy, oy), and the JSDoc retype (no runtime check, test, or.d.tsconsumes the JSDoc type tag). Verdict:needs-humanon a broader REPL/TS wording cleanup — the candidate conflatedlib/ndarray.js's universalstride length ofform (which is not drifted) withdocs/repl.txt's driftedStride length ofform and withdocs/types/index.d.ts's entirely different`x` stride lengthword order; that bucket was dropped."metric"semantically applies to a correlation-distance package — the correlation distanced_c = 1 - r(X, Y)is a valid pseudometric (non-negative, symmetric, triangle inequality), and the sibling pattern applies the keyword uniformly across the group regardless of strict-metric vs pseudometric distinction (dcosine-similarity, which is not itself a metric, also carries the keyword).Dropped fixes (after agent validation passed)
## C APIsndarrayH4 heading: initially replaced abbreviatedsx, ox, sy, oyplaceholders with the fullstrideX, offsetX, strideY, offsetYform (matching all 7 siblings) in commit4415b3397. CI'sRun changed examplesjob flagged the resulting 91-character heading againstremark-lint'smaximum-heading-length: 80rule. Every sibling heading in the namespace exceeds the same limit (89-97 characters), but the rule only runs on PR-touched READMEs; the violation has accumulated silently. Reverted in commita000843e6. The README's argument list (lines 241-245) and the literal C signature in the same file (line 248) already use the full parameter names, so readers see the correct names; only the heading retains the abbreviation. The namespace-wide heading-length issue is a separate concern.Other deliberately excluded
Stride length of→Stride length forindocs/repl.txt) and the TypeScript declaration rewording (stride length ofx→xstride length, `starting index of `x→starting index forx`` indocs/types/index.d.ts) — agent Feature/sum-series #2 flagged the candidate as ambiguous; the underlying drift is real but the fix requires file-by-file disambiguation rather than a single substitution. Logged for a future targeted pass."dcorrelation"keyword (1/8 occurrence; siblings exclude the d-prefixed package name) — outside the validated scope and would need a separatechore:-level run.dcorrelation/src/main.c@paramC-comment phrasing — real drift, but outside the agent-validated scope of this run.Related Issues
This pull request has no related issues.
Questions
No.
Other
package.jsonkeyword insertion, four JSDoc@param Nretypes).~/drift-reports/drift-stats-strided-distances-2026-06-09.mdoutside the repo working tree.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running the cross-package API drift detection routine on the randomly-selected
@stdlib/stats/strided/distancesnamespace. Structural features (file tree,package.jsonshape, README headings, etc.) were extracted across all eight members; semantic features (JSDoc shape, public signature, dependency set, validation prologue, return kind) were read directly from each member'slib/main.js, per-package wrapper, andlib/ndarray.js. Three independent validation agents (opus semantic-review, opus cross-reference, sonnet structural-review) reviewed each candidate fix before any file was edited. A human should audit before promoting from draft.@stdlib-js/reviewers