Skip to content
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

Remove deprecated internal function _pgr_prim #2744

Conversation

cvvergara
Copy link
Member

@cvvergara cvvergara commented Feb 6, 2025

…E raised about deprecation

Fixes #2743

Changes proposed in this pull request:

  • Remove the SQL signature
  • Send a notice on the C code about deprecation of the internal C function

@pgRouting/admins

Summary by CodeRabbit

  • New Features:

    • Expanded the library’s routing and graph analysis capabilities with several functions now officially supported.
  • Chores:

    • Removed deprecated and obsolete functions to streamline the codebase and improve performance.
  • Documentation:

    • Updated the release notes and related documentation to accurately reflect these improvements in version 4.0.0.

@cvvergara cvvergara added Deprecation Prim Remove rm of deprecated function or internal function labels Feb 6, 2025
@cvvergara cvvergara added this to the Release 4.0.0 milestone Feb 6, 2025
@cvvergara cvvergara requested a review from robe2 February 6, 2025 19:39
Copy link

coderabbitai bot commented Feb 6, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request updates the pgRouting project for the 4.0.0 release by promoting several functions and signatures (e.g., pgr_trsp, various pgr_withPoints functions, pgr_aStar, and pgr_dijkstra variations) to official status. Deprecated SQL functions and internal functions are removed, and a new internal function (_pgr_primv4) replaces the old _pgr_prim. The C code now issues a deprecation notice when invoking _pgr_prim, aligning the changes with documented deprecations and cleanup efforts.

Changes

File(s) Change Summary
NEWS.md, doc/src/release_notes.rst Updated release notes to reflect the promotion of functions/signatures to official status and removal of deprecated elements.
sql/sigs/pgrouting--4.0.sig, sql/spanningTree/_prim.sql Removed the deprecated SQL signature for _pgr_prim; in _prim.sql, _pgr_prim is replaced by the new _pgr_primv4 function.
src/spanningTree/prim.c Added a deprecation notice (ereport) in the _pgr_prim function and updated its declaration to log usage of the deprecated internal function.

Assessment against linked issues

Objective Addressed Explanation
Remove the deprecated SQL signature _pgr_prim(text, anyarray, text, bigint, double precision) [#2743]
Send a deprecation notice on the C code for _pgr_prim [#2743] The C code now issues an ereport notice when _pgr_prim is invoked.

Possibly related PRs

Suggested reviewers

  • robe2

Poem

I'm a rabbit, hopping on code paths bright,
Skipping through functions from day to night.
Deprecated carrots are tossed away,
New crunchy features now lead the way.
With each commit, my garden grows tight! 🐰


🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@cvvergara
Copy link
Member Author

cvvergara commented Feb 6, 2025

@coderabbitai review
@coderabbitai summary

@cvvergara cvvergara linked an issue Feb 6, 2025 that may be closed by this pull request
Copy link

coderabbitai bot commented Feb 6, 2025

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find files related to _pgr_prim
echo "Files containing _pgr_prim:"
rg "_pgr_prim" -l

# Get the diff to see the changes
git diff origin/main...HEAD

# Check NEWS.md for documentation
echo -e "\nNEWS.md changes:"
git diff origin/main...HEAD -- NEWS.md

Length of output: 733


🏁 Script executed:

#!/bin/bash
# Get the latest commit changes
git show

# Check content of key files
echo -e "\nContent of sql/spanningTree/_prim.sql:"
cat sql/spanningTree/_prim.sql

echo -e "\nContent of src/spanningTree/prim.c:"
cat src/spanningTree/prim.c

echo -e "\nContent of NEWS.md:"
cat NEWS.md

Length of output: 66848


@cvvergara The changes look good. The PR properly handles the deprecation of the internal function _pgr_prim by:

  1. Removing the SQL signature from v4.0 signature file
  2. Adding deprecation notice in C code using ereport with ERRCODE_FEATURE_NOT_SUPPORTED
  3. Documenting the changes in NEWS.md under appropriate sections

🧠 Learnings used
Learnt from: cvvergara
PR: pgRouting/pgrouting#0
File: :0-0
Timestamp: 2025-01-27T01:49:25.212Z
Learning: In pgRouting, when deprecating internal functions:
1. Add deprecation notice in C code using ereport with ERRCODE_FEATURE_NOT_SUPPORTED
2. Update tests with version checks (min_version, min_lib_version)
3. Document changes in NEWS.md under appropriate sections
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c4cd95c and d97edf6.

📒 Files selected for processing (5)
  • NEWS.md (2 hunks)
  • doc/src/release_notes.rst (2 hunks)
  • sql/sigs/pgrouting--4.0.sig (0 hunks)
  • sql/spanningTree/_prim.sql (0 hunks)
  • src/spanningTree/prim.c (2 hunks)
💤 Files with no reviewable changes (2)
  • sql/sigs/pgrouting--4.0.sig
  • sql/spanningTree/_prim.sql
🧰 Additional context used
📓 Learnings (1)
src/spanningTree/prim.c (1)
Learnt from: cvvergara
PR: pgRouting/pgrouting#0
File: :0-0
Timestamp: 2025-01-27T01:49:25.212Z
Learning: In pgRouting, when deprecating internal functions:
1. Add deprecation notice in C code using ereport with ERRCODE_FEATURE_NOT_SUPPORTED
2. Update tests with version checks (min_version, min_lib_version)
3. Document changes in NEWS.md under appropriate sections
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
src/spanningTree/prim.c (2)

174-178: LGTM! Clear deprecation comments.

The comments clearly indicate this is deprecated code used in v3.6 and under, with a TODO note for future cleanup.


190-194: LGTM! Proper deprecation notice implementation.

The deprecation notice follows best practices:

  • Uses ereport with ERRCODE_FEATURE_NOT_SUPPORTED
  • Includes function name, deprecation version, and upgrade hint

NEWS.md Show resolved Hide resolved
doc/src/release_notes.rst Show resolved Hide resolved
@cvvergara cvvergara force-pushed the remove-deprecated-internal-function-_pgr_prim branch from d97edf6 to 3fcd49c Compare February 6, 2025 22:01
@cvvergara cvvergara merged commit 1fa5da4 into pgRouting:develop Feb 7, 2025
26 checks passed
@cvvergara cvvergara deleted the remove-deprecated-internal-function-_pgr_prim branch February 7, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecation Prim Remove rm of deprecated function or internal function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the deprecated signature: _pgr_prim
2 participants