Skip to content

refactor(clp-s): Replace clp_s::StringUtils function calls with clp::string_utils equivalents and remove redundant implementations.#1103

Merged
gibber9809 merged 2 commits into
y-scope:mainfrom
gibber9809:delete-copied-clp-s-string-utils
Jul 16, 2025
Merged

Conversation

@gibber9809

@gibber9809 gibber9809 commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

Description

This PR deletes functions in clp_s::StringUtils that were copied from clp::string_utils. Deleting these copied functions will simplify performance work and bug-fixes, since for these deduplicated functions we now only need to make changes in one place.

Some functions in clp_s::StringUtils can not be deleted as part of this PR (get_bounds_of_next_var and related functions) since they are currently used for the copied version of the core CLP encoding logic. When we de-duplicate this core encoding logic we can also delete these clp::StringUtils functions.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Validated that build still succeeds
  • Validated that all unit tests pass

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Updated internal string utility usage to leverage a shared external library, resulting in the removal of several internal string utility functions.
    • Adjusted dependency configurations to include the external string utilities library.
    • No changes to user-facing features or behaviour.

@gibber9809 gibber9809 requested review from a team and wraymo as code owners July 14, 2025 18:46
@coderabbitai

coderabbitai Bot commented Jul 14, 2025

Copy link
Copy Markdown
Contributor
## Walkthrough

This change removes a large set of string utility functions from the `StringUtils` class and replaces their usage with the external `clp::string_utils` library. It updates CMake dependencies to require and link against `clp::string_utils` for relevant targets and adjusts code to use the new namespace and headers.

## Changes

| File(s)                                                                                      | Change Summary                                                                                                          |
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| components/core/cmake/Options/options.cmake                                                  | Added `CLP_BUILD_CLP_STRING_UTILS` as a required dependency for `CLP_BUILD_CLP_S_ARCHIVEREADER` and `CLP_BUILD_CLP_S_SEARCH`. |
| components/core/src/clp_s/CMakeLists.txt                                                     | Added `clp::string_utils` as a public dependency for `clp_s_archive_reader`.                                           |
| components/core/src/clp_s/search/CMakeLists.txt                                              | Added `clp::string_utils` as a private dependency for `clp_s_search`.                                                  |
| components/core/src/clp_s/Utils.cpp, components/core/src/clp_s/Utils.hpp                     | Removed string utility methods from `StringUtils` and replaced internal calls with `clp::string_utils` equivalents.    |
| components/core/src/clp_s/DictionaryReader.hpp                                               | Updated wildcard matching to use `clp::string_utils::wildcard_match_unsafe` and changed header include accordingly.    |
| components/core/src/clp_s/search/QueryRunner.cpp                                             | Replaced `StringUtils::wildcard_match_unsafe` usages with `clp::string_utils::wildcard_match_unsafe`; updated includes.|
| components/core/src/clp_s/search/clp_search/Grep.cpp                                         | Replaced all `StringUtils` utility calls with `clp::string_utils` equivalents; updated header include.                 |

## Possibly related PRs

- [y-scope/clp#754](https://github.com/y-scope/clp/pull/754): Refactored string utility functions out of `StringUtils` and reorganized them, similar to the modularization in this PR.
- [y-scope/clp#955](https://github.com/y-scope/clp/pull/955): Introduced the build flag and dependency validation infrastructure that this PR extends for `clp::string_utils`.
- [y-scope/clp#930](https://github.com/y-scope/clp/pull/930): Related to string conversion utilities in `clp::string_utils` used by this PR.

## Suggested reviewers

- kirkrodrigues
- haiqi96

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f268c82 and 5f81b98.

📒 Files selected for processing (1)
  • components/core/src/clp_s/Utils.hpp (0 hunks)
💤 Files with no reviewable changes (1)
  • components/core/src/clp_s/Utils.hpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: build-macos (macos-13, false)
  • GitHub Check: build-macos (macos-14, false)
  • GitHub Check: build-macos (macos-15, false)
  • GitHub Check: build-macos (macos-14, true)
  • GitHub Check: lint-check (macos-latest)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@wraymo wraymo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.
For the title, what about
refactor(clp-s): Replace clp_s::StringUtils methods with clp::string_utils equivalents and remove redundant implementations.

@gibber9809 gibber9809 changed the title refactor(clp-s): Delete clp_s::StringUtils functions that have equivalent implementations in clp::string_utils. refactor(clp-s): Replace clp_s::StringUtils methods with clp::string_utils equivalents and remove redundant implementations. Jul 16, 2025

@kirkrodrigues kirkrodrigues 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.

Deferring to @wraymo's review.

@gibber9809 gibber9809 changed the title refactor(clp-s): Replace clp_s::StringUtils methods with clp::string_utils equivalents and remove redundant implementations. refactor(clp-s): Replace clp_s::StringUtils function calls with clp::string_utils equivalents and remove redundant implementations. Jul 16, 2025
@gibber9809 gibber9809 merged commit c1ef21b into y-scope:main Jul 16, 2025
24 checks passed
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
…p::string_utils` equivalents and remove redundant implementations. (y-scope#1103)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants