Skip to content

fix(@stdlib/blas/ext/find-index): supply default fromIndex to gfindIndex - #14533

Closed
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-gfind-index-2026-08-22
Closed

fix(@stdlib/blas/ext/find-index): supply default fromIndex to gfindIndex#14533
Planeshifter wants to merge 1 commit into
developfrom
philipp/ci-fix-gfind-index-2026-08-22

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • fixes a TypeError: Cannot read properties of undefined (reading 'data') in blas/ext/find-index/test/test.assign.js and test.main.js, thrown from ndarraylike2scalar via data-buffer via gfindIndex
  • feat!: add fromIndex support to blas/ext/base/ndarray/gfind-index #14478 changed gfindIndex(arrays, clbk, thisArg) to require arrays[1] be a zero-dimensional ndarray specifying a starting search index, calling ndarraylike2scalar(arrays[1]) unconditionally
  • blas/ext/find-index registers gfindIndex directly as the default entry in a @stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by-factory table; the shared dispatch machinery (@stdlib/ndarray/base/unary-reduce-strided1d-by) always calls table functions with a single-element arrays array containing only the input view, with no concept of a fromIndex parameter — so arrays[1] was undefined
  • in blas/ext/find-index/lib/base.js, wraps gfindIndex in a local indexOf(arrays, clbk) that supplies a constant zero-dimensional fromIndex ndarray (value 0) via scalar2ndarray(0, {dtype: 'generic'}), restoring pre-feat!: add fromIndex support to blas/ext/base/ndarray/gfind-index #14478 default behavior (search the whole array from the start)
  • the fix is scoped entirely to the one broken consumer package; the shared dispatch factory and the gfind-index kernel are untouched

Related Issues

Does this pull request have any related issues?

None.

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.

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-index suites pass: test.js (3/3), test.main.js (162/162), test.assign.js (200/200)
  • confirmed via git stash that the crash reproduces on pre-fix code and disappears with the fix applied
  • make eslint-files on the changed file is clean
  • blas/ext/find-last-index checked and unaffected — its kernel gfind-last-index has not yet received the analogous breaking change (pending in unmerged feat: add fromIndex support to blas/ext/base/ndarray/gfind-last-index #14479)
  • no other file in the repo reaches into find-index/lib/base.js directly

Reviewed independently by three reviewers (correctness, regression scope, style/conventions); all three approved, no blocking findings.

Non-blocking notes for follow-up:

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

…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
@stdlib-bot stdlib-bot added the BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). label Aug 22, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/ext/find-index $\\color{green}507/507$
$\\color{green}+100.00\\%$
$\\color{green}55/55$
$\\color{green}+100.00\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}507/507$
$\\color{green}+100.00\\%$

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

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what is desired.

@kgryte kgryte closed this Aug 22, 2026
@kgryte
kgryte deleted the philipp/ci-fix-gfind-index-2026-08-22 branch August 22, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants