Skip to content

Conversation

@headlessNode
Copy link
Member

Resolves stdlib-js/metr-issue-tracker#122.

Description

What is the purpose of this pull request?

This pull request:

  • add ndarray/find-last

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

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.

No.

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

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

@headlessNode headlessNode added the Feature Issue or pull request for adding a new feature. label Dec 2, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 2, 2025

Coverage Report

Package Statements Branches Functions Lines
ndarray/find-last $\color{green}417/417$
$\color{green}+0.00%$
$\color{green}44/44$
$\color{green}+0.00%$
$\color{green}5/5$
$\color{green}+0.00%$
$\color{green}417/417$
$\color{green}+0.00%$

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

@headlessNode headlessNode requested a review from kgryte December 2, 2025 20:38
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 2, 2025
@kgryte
Copy link
Member

kgryte commented Dec 19, 2025

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Dec 19, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Dec 19, 2025
@kgryte
Copy link
Member

kgryte commented Dec 19, 2025

@headlessNode Remind me. Why is the option named sentinelValue rather than just sentinel?

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Dec 19, 2025
@headlessNode
Copy link
Member Author

@kgryte no specific reason for it being sentinelValue rather than sentinel.

@kgryte
Copy link
Member

kgryte commented Dec 19, 2025

2c: we should rename sentinelValue to sentinel here and in ndarray/find.

@headlessNode headlessNode marked this pull request as ready for review December 22, 2025 07:32
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 22, 2025
@headlessNode
Copy link
Member Author

headlessNode commented Dec 22, 2025

@kgryte Ready for review. The CI error is due to renaming sentinelValue. I'll open a PR to change that for ndarray/find. Need to merge #9307 first.

@headlessNode headlessNode removed the Needs Changes Pull request which needs changes before being merged. label Dec 30, 2025
@kgryte kgryte removed the Needs Review A pull request which needs code review. label Jan 9, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: passed
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

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

LGTM after extensive clean-up. There were a number of things wrong with this PR. Two notable things which perhaps could have been caught given some reflection:

  1. All results were transposed. This should have been an obvious sign that things were not implemented correctly. You failed to account for the fact that, if find were provided a reversed input ndarray view, it would also write values in the opposite order as well. Hence, you needed to flip the output array, in addition to the input array.
  2. For similar reasons to (1), the indices being passed to the callback were not correct. Those indices were from the perspective of the view, not the original array. Hence, you needed to compute the complement of the indices in the callback wrapper.

@kgryte
Copy link
Member

kgryte commented Jan 9, 2026

For METR,

review_time: 120 minutes

@kgryte kgryte added the METR Pull request associated with the METR project. label Jan 9, 2026
@kgryte kgryte merged commit 483acba into stdlib-js:develop Jan 9, 2026
30 checks passed
@headlessNode headlessNode deleted the ndarray-find-last branch January 10, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add ndarray/find-last

3 participants