Skip to content

feat!: migrate math/base/ops/add to number/float64/base/add #5063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

gururaj1512
Copy link
Member

Progresses #2261.

Description

What is the purpose of this pull request?

This pull request:

  • feat: migrate math/base/ops/add to number/float64/base/add

Related Issues

Does this pull request have any related issues?

This pull request:

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.


@stdlib-js/reviewers

---
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: missing_dependencies
  - task: lint_c_examples
    status: missing_dependencies
  - task: lint_c_benchmarks
    status: missing_dependencies
  - 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
---
---
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: na
  - 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: missing_dependencies
  - 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: na
  - task: lint_license_headers
    status: passed
---
---
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: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - 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: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---

---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
  - task: run_javascript_examples
    status: passed
  - task: run_c_examples
    status: passed
  - task: run_cpp_examples
    status: na
  - task: run_javascript_readme_examples
    status: passed
  - task: run_c_benchmarks
    status: passed
  - task: run_cpp_benchmarks
    status: na
  - task: run_fortran_benchmarks
    status: na
  - task: run_javascript_benchmarks
    status: passed
  - task: run_julia_benchmarks
    status: na
  - task: run_python_benchmarks
    status: na
  - task: run_r_benchmarks
    status: na
  - task: run_javascript_tests
    status: passed
---
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Feb 5, 2025
@kgryte kgryte changed the title feat: migrate math/base/ops/add to number/float64/base/add feat!: migrate math/base/ops/add to number/float64/base/add Feb 5, 2025
@kgryte kgryte added release: Major Breaking change requiring a new major release. Math Issue or pull request specific to math functionality. labels Feb 5, 2025
@kgryte
Copy link
Member

kgryte commented Feb 5, 2025

@gururaj1512 This PR has a bug. Namely, stdlib_base_add should become stdlib_base_float64_add. This is why the tests are failing. However, need to be careful to avoid renaming things like stdlib_base_addf, stdlib_base_add3, etc.

@kgryte
Copy link
Member

kgryte commented Feb 5, 2025

You can add a single commit fixing this bug, and I should still be able to merge, provided everything else checks out.

fix: update C function name in downstream dependencies

@kgryte
Copy link
Member

kgryte commented Feb 5, 2025

But actually, sorry, we still cannot merge this. Your three commits are lacking the expected commit bodies.

@kgryte
Copy link
Member

kgryte commented Feb 5, 2025

@gururaj1512 Okay, since you are very persistent about this (which I can appreciate!), here is the sequence which needs to be followed:


The following outlines a sequence of steps to follow in order to migrate a single API package which is in math/base/ops to, e.g., number/float64/base.

Steps

1. Copy package

cp -R lib/node_modules/@stdlib/math/base/ops/add lib/node_modules/@stdlib/number/float64/base/add

2. Update package contents

This includes include directory tree and header guards.

3. Commit new package

git add lib/node_modules/@stdlib/number/float64/base/add && git commit

Sample commit message:

feat: add `number/float64/base/add`

Ref: https://github.com/stdlib-js/stdlib/issues/2261

4. Update paths using a global find-and-replace

math/base/ops/add
number/float64/base/add

Notes:

  • Be very careful here to avoid erroneously updating the paths of packages whose names have a common prefix (e.g., math/base/ops/add, math/base/ops/addf, math/base/ops/add3). Those packages should not be inadvertently updated.

  • Additionally, ensure that, for packages having C implementations, if a package basename (e.g., add) has a hyphen, then downstream include paths also need to be updated. E.g., for package math/base/ops/foo-bar with include file math/base/ops/foo_bar, downstream packages which include the previous header file need to be updated accordingly (e.g., math/base/ops/foo_bar).

5. Update global C symbols

stdlib_base_add
stdlib_base_float64_add

Notes:

  • Be very careful here to avoid erroneously updating global symbols having a common prefix (e.g., stdlib_base_add, stdlib_base_addf, stdlib_base_add3). Those symbols should not be inadvertently updated.

6. Remove the package export from its parent namespace

See, e.g., math/base/ops/lib/index.js.

7. Avoid updating original package and error database

git checkout -- ./lib/node_modules/@stdlib/math/base/ops/add && git checkout -- ./lib/node_modules/@stdlib/error && git status

8. Commit changes

git add . && git commit

Sample commit message:

refactor: update paths

Ref: https://github.com/stdlib-js/stdlib/issues/2261

9. Remove original package

rm -rf lib/node_modules/@stdlib/math/base/ops/add

10. Commit changes

git add lib/node_modules/@stdlib/math/base/ops/add && git commit

Sample commit message

remove: remove `math/base/ops/add`

This commit removes `@stdlib/math/base/ops/add` in favor of
`@stdlib/number/float64/base/add`.

BREAKING CHANGE: remove `math/base/ops/add`

To migrate, users should update their require/import paths to use
`@stdlib/number/float64/base/add` which provides the same API and
implementation.

Ref: https://github.com/stdlib-js/stdlib/issues/2261

Other

Example commit sequence:

  1. 3371722
  2. e0799e5
  3. f698e2c

Notes

  • Notice that every commit includes a Ref: link back to the RFC issue on the main project repository. This is useful for providing additional context regarding changes, especially those involving deprecations.
  • As mentioned above, be very careful when performing global find-and-replace. It can be easy to mistakenly update non-applicable paths, thus breaking packages and all downstream dependents. You've been warned.

@kgryte
Copy link
Member

kgryte commented Feb 5, 2025

I'll need to go ahead and close this PR, as it cannot be merged, as is.

@kgryte kgryte closed this Feb 5, 2025
@kgryte kgryte added Invalid Invalid question, issue, or pull request. and removed Needs Review A pull request which needs code review. labels Feb 5, 2025
@kgryte
Copy link
Member

kgryte commented Feb 5, 2025

@gururaj1512 Yes, and then by removing the package in the third commit, you broke every downstream package which was expecting stdlib_base_add.

@gururaj1512
Copy link
Member Author

@gururaj1512 Yes, and then by removing the package in the third commit, you broke every downstream package which was expecting stdlib_base_add.

Didn't notice that silly mistake. Thanks for clarifying and explaining. I'll work on it.

@gururaj1512 gururaj1512 deleted the migrate-math-base-ops-add branch February 5, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Invalid question, issue, or pull request. Math Issue or pull request specific to math functionality. release: Major Breaking change requiring a new major release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants