fix(@stdlib/blas/ext/find-index): supply default fromIndex to gfindIndex - #14533
Closed
Planeshifter wants to merge 1 commit into
Closed
fix(@stdlib/blas/ext/find-index): supply default fromIndex to gfindIndex#14533Planeshifter wants to merge 1 commit into
fromIndex to gfindIndex#14533Planeshifter wants to merge 1 commit into
Conversation
…dIndex` The job "Run JavaScript tests" (run_affected_tests) and the macOS Node.js v16 test job failed on develop with `TypeError: Cannot read properties of undefined (reading 'data')` in `blas/ext/find-index/test/test.assign.js` and `test.main.js`. Root cause: PR #14478 changed `@stdlib/blas/ext/base/ndarray/gfind-index` to require a second, zero-dimensional `fromIndex` ndarray in its `arrays` argument. This package registers `gfindIndex` directly as the `default` entry of a `@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by-factory` table, and that shared dispatch machinery always invokes table functions with a single-element `arrays` array containing only the input view, so `arrays[1]` was `undefined`. This commit wraps `gfindIndex` in a local `indexOf` function that supplies a constant zero-dimensional `fromIndex` ndarray (value `0`), restoring the pre-#14478 default of searching from the start of the array, without changing the shared dispatch factory or the `gfind-index` kernel. Ref: https://github.com/stdlib-js/stdlib/actions/runs/32550930877
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
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:
TypeError: Cannot read properties of undefined (reading 'data')inblas/ext/find-index/test/test.assign.jsandtest.main.js, thrown fromndarraylike2scalarviadata-bufferviagfindIndexfromIndexsupport toblas/ext/base/ndarray/gfind-index#14478 changedgfindIndex(arrays, clbk, thisArg)to requirearrays[1]be a zero-dimensional ndarray specifying a starting search index, callingndarraylike2scalar(arrays[1])unconditionallyblas/ext/find-indexregistersgfindIndexdirectly as thedefaultentry in a@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by-factorytable; the shared dispatch machinery (@stdlib/ndarray/base/unary-reduce-strided1d-by) always calls table functions with a single-elementarraysarray containing only the input view, with no concept of afromIndexparameter — soarrays[1]wasundefinedblas/ext/find-index/lib/base.js, wrapsgfindIndexin a localindexOf(arrays, clbk)that supplies a constant zero-dimensionalfromIndexndarray (value0) viascalar2ndarray(0, {dtype: 'generic'}), restoring pre-feat!: addfromIndexsupport toblas/ext/base/ndarray/gfind-index#14478 default behavior (search the whole array from the start)gfind-indexkernel are untouchedRelated Issues
None.
Questions
No.
Other
Failing run: https://github.com/stdlib-js/stdlib/actions/runs/32550930877 (
run_affected_tests/ "Run JavaScript tests"), also reproduced in a macOS Node.js v16 scheduled run (32564148576).Diff is one file:
lib/node_modules/@stdlib/blas/ext/find-index/lib/base.js(+23/-1).Validation:
find-indexsuites pass:test.js(3/3),test.main.js(162/162),test.assign.js(200/200)git stashthat the crash reproduces on pre-fix code and disappears with the fix appliedmake eslint-fileson the changed file is cleanblas/ext/find-last-indexchecked and unaffected — its kernelgfind-last-indexhas not yet received the analogous breaking change (pending in unmerged feat: addfromIndexsupport toblas/ext/base/ndarray/gfind-last-index#14479)find-index/lib/base.jsdirectlyReviewed independently by three reviewers (correctness, regression scope, style/conventions); all three approved, no blocking findings.
Non-blocking notes for follow-up:
unary-reduce-strided1d-by/lib/nd.jscallsfcn(v, f, opts), inconsistent with thefcn(v, opts, f)order used by ~40 sibling call sites. Pre-existing, unrelated to this fix, not touched here. Worth a separate issue if a maintainer thinks it's worth fixing.fromIndexsupport toblas/ext/base/ndarray/gfind-last-index#14479 merges (fromIndexforgfind-last-index),blas/ext/find-last-index/lib/base.jswill hit the identicalarrays[1]crash — that PR does not update the consumer. Flagging on feat: addfromIndexsupport toblas/ext/base/ndarray/gfind-last-index#14479 directly.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored autonomously by an AI agent (a scheduled CI-monitoring routine, using Claude) based on failure analysis of the linked GitHub Actions run. Root-cause analysis, the fix, and validation were performed by the agent; changes were reviewed by three independent review passes before submission.
Generated by Claude Code