refactor: align @stdlib/array outliers with namespace majority patterns#11771
Closed
Planeshifter wants to merge 0 commit into
Closed
refactor: align @stdlib/array outliers with namespace majority patterns#11771Planeshifter wants to merge 0 commit into
@stdlib/array outliers with namespace majority patterns#11771Planeshifter wants to merge 0 commit into
Conversation
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
24c731e to
b14046a
Compare
@stdlib/array outliers with namespace error-construction majority@stdlib/array outliers with namespace majority patterns
Closed
Planeshifter
commented
Apr 25, 2026
| N = value.length; | ||
| if ( idx+N > this._length ) { | ||
| throw new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' ); | ||
| throw new RangeError( format( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' ) ); |
Member
Author
There was a problem hiding this comment.
Nothing is getting interpolation here and elsewhere; revert these changes
Member
Author
There was a problem hiding this comment.
Acknowledged. You're right — for static messages with no interpolation, plain string literals are the correct stdlib style; the format() wrap was a misread of the namespace majority by the drift detection routine. Reverted all four commits and resetting the branch to develop. Closing the PR.
Generated by Claude Code
0af997c to
5a06940
Compare
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
Aligning outliers in
@stdlib/arraywith namespace majority patterns (random namespace pick, seed20260425).Namespace summary
@stdlib/array, none autogenerated.package.jsonshape (top keys, scripts,directories,main), README section structure,manifest.jsonshape, error-construction style, JSDoc shape.@stdlib/string/format. The remaining 10 mix plain-string throws withformat()-wrapped throws in the samelib/main.js.package.jsonmainfield — 101 of 102 (99%) use"./lib". One outlier uses"lib/index.js".Usage / Notes / Examples / See Alsoat 45%,Usage / Examples / See Alsoat 38%), neither dominant. Several files (docs/types/index.d.ts,docs/repl.txt) are missing in a coherent endian/struct sub-family with no mechanical fix that doesn't introduce TODO stubs, so they are logged for human review rather than corrected here.Per-outlier corrections
Each outlier ships as a single commit. Wrapping a static-string throw in
format( ... )is identity on the message text (formatwith no extra args returns the literal unchanged), so behavior is preserved.array/fixed-endian-factorylib/main.jshad 5 plain-string throws alongside 51format()-wrapped throws (~91% conformance). Plain throws were twothis-context guards, two empty-array reduce guards, and one storage-boundsRangeError. All 5 are now wrapped; file is at 100%.array/incrspacelib/main.jshad 1 plain-string throw alongside 3format()-wrapped throws (~75% conformance). The single outlier was a staticRangeErroron max-array-length. Wrapping it brings the file to 100%.array/little-endian-factorylib/main.jshad 2 plain-string throws alongside 5format()-wrapped throws (~71% conformance). Both plain throws werethis-context guards. Wrapping them brings the file to 100%.array/struct-factorylib/main.jshad 1 plain-string throw alongside 21format()-wrapped throws (~95% conformance). The single outlier was a staticRangeErroron storage bounds. Wrapping it brings the file to 100%.array/basepackage.jsonmainfield set to"lib/index.js"; 101 of 102 sibling packages (99%) use"./lib". Node resolves both identically sincelib/index.jsexists, so this is a purely stylistic alignment with no behavioral effect.Dropped from this PR (logged in the local report)
Six additional outliers were corrected in initial commits but rolled back before this update because their files (or their downstream consumers) carry pre-existing CI failures unrelated to the drift correction:
array/bool(39 plain throws) —lib/main.jstriggers pre-existingmax-linesand FIXME/TODO lint warnings onorigin/develop.array/complex64(41) — pre-existing JSDoc-spacing lint error atlib/main.js:2891and pre-existing assertion failure intest/test.at.js(returns expected imaginary component for index -10).array/complex128(41) — same pre-existingtest/test.at.jsfailure ascomplex64.array/index(8) — drift fix is clean locally, butarray/to-fancy(its main downstream consumer) has multiple pre-existing test failures that reproduce against unmodifieddevelopand tripRun affected tests.array/filled(2) —array/to-fancy/benchmark/benchmark.get.jsrequires@stdlib/array/filled, which makesto-fancyan "affected" dependent of anyfilledchange. Same pre-existingto-fancytest failures as above.array/filled-by(6) — has 1000+ downstream consumers; sampling indicates the same kind of pre-existing-failure noise is likely. Dropped to keep this PR's CI green.The drift in all six is real and the wrap diffs are reproducible. They should be re-applied in a subsequent PR alongside the pre-existing fixes once those are addressed.
Questions
No.
Other
Validation
package.jsonandmanifest.jsonshape) over all 102 members.lib/main.js.confirmed-driftfrom the semantic and structural agents andok-to-fixfrom the cross-reference agent.array/base.main: cross-reference agent confirmed no consumer references the literal"lib/index.js"value; structural agent confirmed"./lib"resolves identically.t.throws( fn, TypeError, '' ), which checks the error class only; the third argument is a tape display label, not a message expectation. No outlier's tests, examples, or external consumers couple to the literal error-construction shape.lib/main.jswas syntax-checked (node -c), the package's tape suite ran clean locally, and the (small) set of downstream consumer tests was sampled clean as well.Deliberately excluded
## See AlsoREADME sections — adding meaningful related-package links requires per-package editorial judgment about which siblings are related and is out of scope for a mechanical drift correction.docs/types/*anddocs/repl.txtgaps in the endian/struct sub-family (fixed-endian-factory,fixed-endian-float32,fixed-endian-float64,little-endian-factory,little-endian-float32,little-endian-float64,struct-factory) are real but require hand-written TypeScript declarations rather than boilerplate; logged in the local report for separate human follow-up.package.json.directoriesmissing thedockey — they also have nodocs/folder, so adding the field without the directory would create a stale reference.throw new Error( 'not implemented' )calls in 12lib/polyfill.jsfiles (e.g.array/buffer/lib/polyfill.js) were not normalized: polyfills are coherent with each other and represent a distinct family from the format()-using majority.array/basedirectories.benchmarkomission — the package has nobenchmark/folder, so adding the field would be a stale reference.The full local report (feature-by-feature majority distribution, per-outlier drift findings, drops with reasons, and decisions) is saved at
~/drift-reports/drift-array-2026-04-25.md.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored entirely by Claude Code, running the cross-package API drift detection routine. The routine: (1) randomly selected the
@stdlib/arraynamespace from the 120 namespaces with ≥8 non-autogenerated direct child packages (seed 20260425); (2) extracted structural features (file tree,package.jsonshape, README headings) and semantic features (error-construction patterns, JSDoc shape) across all 102 members; (3) identifiedformat()-wrapped throws as the namespace majority pattern at ~81% conformance among throwing packages, and"./lib"as themain-field majority at 99% conformance; (4) flagged outliers; (5) validated each via three parallel agents (opus semantic-review, opus cross-reference, sonnet structural-review); (6) applied each surviving correction as one commit per package; (7) dropped six error-construction commits before publishing because those packages either had pre-existing failures in their own files (bool,complex64,complex128) or triggered pre-existing failures in their downstream consumers viaRun affected tests(index,filled,filled-by). Message text is preserved verbatim across all retained commits; no test or example expectations changed.@stdlib-js/reviewers