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

refactor(mod)!: rename the go module of this repository #11

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

amimart
Copy link
Member

@amimart amimart commented Oct 5, 2024

Summary

This PR mark the decision of making this repository a hard fork of https://github.com/ichiban/prolog by renaming the go module to github.com/axone-protocol/prolog.

Motivations

The existence of this repository was originally motivated by our needs in https://github.com/axone-protocol/axoned (e.g. to make this VM deterministic, increase execution control flow, control memory allocation, etc...), and the intention was at first, to propose to integrate these changes to the original repository.

As of today, we consider that these changes would have structural and behavioural impacts mismatching the approach conveyed by the original project, leading us to make this module independent, so that codebases depending on it are totally detached from ichiban/prolog.

Impacts

Regarding codebases using this module, they must now directly import it under the new module name in their sources, and mention it under the require directives of their go.mod, removing the replace directive.

Misc benefits

As we'll be detached from the original repository, we'll be able to rework the CI 💪.

We now consider this project a hard fork, meaning we do not seek to
integrate the changes in the original repository as those a too
structural and only present for how specific requirements (e.g.
determinism, execution control flow, etc...).

By changing the module name we do not rely on importing the original
module and use the replace directore anymore, to be used this project
must now be imported directly.
@amimart amimart self-assigned this Oct 5, 2024
Copy link

coderabbitai bot commented Oct 5, 2024

Walkthrough

The pull request involves a comprehensive update of import paths for the Prolog library across multiple files, transitioning from github.com/ichiban/prolog to github.com/axone-protocol/prolog. This change affects the initialization and usage of the Prolog interpreter in various components, including the main application and example programs. Despite these updates, the overall functionality, logic, and control flow of the application remain unchanged, with no modifications to the declarations of exported or public entities.

Changes

File Change Summary
cmd/1pl/interpreter.go Updated import paths from github.com/ichiban/prolog and github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog and github.com/axone-protocol/prolog/engine.
cmd/1pl/main.go Updated import paths from github.com/ichiban/prolog and github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog and github.com/axone-protocol/prolog/engine.
examples/call_go_from_prolog/main.go Updated import paths from github.com/ichiban/prolog and github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog and github.com/axone-protocol/prolog/engine.
examples/dcg/main.go Updated import path from github.com/ichiban/prolog to github.com/axone-protocol/prolog.
examples/embed_prolog_into_go/main.go Updated import path from github.com/ichiban/prolog to github.com/axone-protocol/prolog.
examples/hanoi/main.go Updated import paths from github.com/ichiban/prolog and github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog and github.com/axone-protocol/prolog/engine.
examples/initialization/main.go Updated import path from github.com/ichiban/prolog to github.com/axone-protocol/prolog.
examples/sandboxing/main.go Updated import paths from github.com/ichiban/prolog and github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog and github.com/axone-protocol/prolog/engine.
interpreter.go Updated import path from github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog/engine.
interpreter_test.go Updated import path from github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog/engine.
solutions.go Updated import path from github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog/engine.
solutions_test.go Updated import path from github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog/engine.

Possibly related PRs

  • Remove atoms table  #5: The changes in this PR involve modifications to the engine package, specifically altering how atoms are represented from a numeric type to strings, which aligns with the changes in the main PR that also updates import paths for the Prolog library.

Suggested reviewers

  • bdeneux: Suggested for review due to familiarity with the Prolog library changes.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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 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.

@amimart amimart requested a review from ccamel October 5, 2024 10:37
Copy link

codecov bot commented Oct 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #11   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files          23       23           
  Lines        6579     6579           
=======================================
  Hits         6467     6467           
  Misses         81       81           
  Partials       31       31           
Files with missing lines Coverage Δ
cmd/1pl/interpreter.go 100.00% <ø> (ø)
interpreter.go 97.20% <ø> (ø)
solutions.go 98.83% <ø> (ø)

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

🧹 Outside diff range and nitpick comments (3)
examples/embed_prolog_into_go/main.go (1)

Line range hint 1-62: Optional enhancements for improved code quality

While not directly related to the PR's main objective, consider the following suggestions to enhance the example:

  1. Replace panic with proper error handling. For example:
if err := p.Exec(`...`); err != nil {
    log.Fatalf("Failed to execute Prolog code: %v", err)
}
  1. Add comments explaining the Prolog queries and their expected results to improve readability.

  2. Define the struct used for scanning results outside the loop for better reusability:

type QueryResult struct {
    Course  string
    Student string
}

// ... in the loop
var s QueryResult
if err := sols.Scan(&s); err != nil {
    log.Printf("Failed to scan solution: %v", err)
    continue
}

These changes would make the example more robust and easier to understand, especially for users new to Prolog or this library.

cmd/1pl/main.go (1)

Line range hint 44-47: Consider updating the comment to reflect the new project name.

The comment still refers to "ichiban/prolog". Consider updating it to reflect the new project name "axone-protocol/prolog" for consistency.

Here's a suggested update:

-Top level for ichiban/prolog %s
-This is for testing purposes only!
-See https://github.com/ichiban/prolog for more details.
+Top level for axone-protocol/prolog %s
+This is for testing purposes only!
+See https://github.com/axone-protocol/prolog for more details.
interpreter.go (1)

12-12: Reminder: Update documentation and other references.

While the code change is correct, remember to update any documentation, README files, or other references that might still point to the old repository or import path.

Consider running the following script to identify potential areas that need updating:

#!/bin/bash
# Description: Find potential documentation and references that might need updating

# Test 1: Search for references to the old repository in markdown files
echo "Searching for references to 'ichiban/prolog' in markdown files:"
rg --type md 'ichiban/prolog'

# Test 2: Search for references to the old repository in Go doc comments
echo "Searching for references to 'ichiban/prolog' in Go doc comments:"
rg --type go '// .* ichiban/prolog'

# Test 3: Check if README.md exists and contains the new repository name
echo "Checking if README.md exists and contains the new repository name:"
if [ -f README.md ]; then
    grep 'axone-protocol/prolog' README.md
else
    echo "README.md not found"
fi
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a7e37dc and c5dcae9.

⛔ Files ignored due to path filters (1)
  • go.mod is excluded by !**/*.mod
📒 Files selected for processing (12)
  • cmd/1pl/interpreter.go (1 hunks)
  • cmd/1pl/main.go (1 hunks)
  • examples/call_go_from_prolog/main.go (1 hunks)
  • examples/dcg/main.go (1 hunks)
  • examples/embed_prolog_into_go/main.go (1 hunks)
  • examples/hanoi/main.go (1 hunks)
  • examples/initialization/main.go (1 hunks)
  • examples/sandboxing/main.go (1 hunks)
  • interpreter.go (1 hunks)
  • interpreter_test.go (1 hunks)
  • solutions.go (1 hunks)
  • solutions_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • cmd/1pl/interpreter.go
  • examples/hanoi/main.go
  • examples/sandboxing/main.go
  • interpreter_test.go
  • solutions.go
  • solutions_test.go
🔇 Additional comments (8)
examples/initialization/main.go (1)

7-7: LGTM! Import statement updated correctly.

The import statement has been successfully updated to use the new module path github.com/axone-protocol/prolog. This change aligns with the PR objectives to rename the Go module and establish it as an independent fork.

To ensure consistency across the codebase, please run the following verification script:

This script will help ensure that the module renaming has been applied consistently throughout the project.

examples/call_go_from_prolog/main.go (2)

Line range hint 1-73: Verify functionality with the new module.

The import changes appear to be the only modifications in this file. The rest of the code remains unchanged, which suggests that the API of the new github.com/axone-protocol/prolog module is compatible with the previous github.com/ichiban/prolog module. This is a positive sign for maintaining backwards compatibility.

However, to ensure that the functionality remains intact with the new module:

  1. Please run the example code to confirm it still works as expected.
  2. Consider adding or updating any existing tests to verify the behavior with the new module.

If you encounter any issues during testing, please update the code accordingly or consider documenting any breaking changes if they exist.


7-8: LGTM: Import statements updated correctly.

The import statements have been successfully updated to reflect the new module name github.com/axone-protocol/prolog. This change is consistent with the PR objectives of renaming the Go module.

To ensure the change is consistent throughout the file, let's run the following script:

✅ Verification successful

Import statements correctly updated.

All references to the old module github.com/ichiban/prolog have been successfully removed, and the new module github.com/axone-protocol/prolog is used consistently in the import statements.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all references to the old module have been updated.

# Test: Search for any remaining references to the old module. Expect: No results.
rg --type go 'github.com/ichiban/prolog' examples/call_go_from_prolog/main.go

# Test: Confirm that the new module is used consistently. Expect: Only the import statements.
rg --type go 'github.com/axone-protocol/prolog' examples/call_go_from_prolog/main.go

Length of output: 241

examples/dcg/main.go (3)

Line range hint 1-85: Confirmed: No further changes needed in this file.

I've reviewed the entire file, and I can confirm that no additional changes are necessary. The usage of the prolog package remains the same throughout the file, and the functionality of the program should be unaffected by the module renaming.


Line range hint 1-85: Summary: Module renaming successfully implemented in this example.

This file demonstrates that the module renaming has been successfully implemented without affecting the functionality of existing code. The only required change was updating the import statement, which was done correctly. This example serves as a good reference for other codebases that need to update their imports to use the new module path.


7-7: LGTM: Import statement updated correctly.

The import statement has been successfully updated to use the new module path github.com/axone-protocol/prolog. This change aligns with the PR objective of renaming the Go module and establishing it as an independent fork.

To ensure this change is consistent across the codebase, let's run the following script:

✅ Verification successful

[Verified] Import statements updated correctly.

All active import statements now use the new module path github.com/axone-protocol/prolog, aligning with the PR objective. The previous module path only appears in comments, which does not affect functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all imports of the prolog package use the new path

# Test: Search for any remaining imports of the old package. Expect: No results.
rg --type go 'github.com/ichiban/prolog'

# Test: Confirm that the new import is used consistently. Expect: Consistent usage across all Go files.
rg --type go 'github.com/axone-protocol/prolog'

Length of output: 1895

interpreter.go (2)

12-12: LGTM: Import path updated as per PR objectives.

The change from github.com/ichiban/prolog/engine to github.com/axone-protocol/prolog/engine aligns with the PR objective to rename the Go module. This modification is correct and necessary for establishing this repository as a hard fork of the original project.


12-12: Verify consistency of import path changes across the project.

While this change is correct, it's crucial to ensure that all files in the project have been updated consistently with the new import path.

Let's verify the consistency of this change across the project:

✅ Verification successful

Import path changes are consistent across the project.

  • All import statements have been updated to github.com/axone-protocol/prolog.
  • No remaining import statements reference github.com/ichiban/prolog.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the old import path

# Test 1: Search for any remaining references to the old import path
echo "Searching for any remaining references to 'github.com/ichiban/prolog':"
rg --type go 'github.com/ichiban/prolog'

# Test 2: Verify that go.mod has been updated
echo "Checking go.mod for the new module name:"
grep 'module github.com/axone-protocol/prolog' go.mod

# Test 3: Check for any replace directives in go.mod
echo "Checking for any replace directives in go.mod:"
grep 'replace' go.mod

Length of output: 1230


Script:

#!/bin/bash
# Description: Search for import statements referencing the old import path

# Test 1: Using ast-grep to find imports of 'github.com/ichiban/prolog'
echo "Searching for import statements referencing 'github.com/ichiban/prolog':"
ast-grep --lang go --pattern $'import $_ "github.com/ichiban/prolog/$_"' .

Length of output: 236

examples/embed_prolog_into_go/main.go Show resolved Hide resolved
cmd/1pl/main.go Show resolved Hide resolved
Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

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

Our will be done! Let us merge this and pave the way for what is to come!

@amimart amimart merged commit be8584f into main Oct 6, 2024
2 checks passed
@amimart amimart deleted the refactor/hard-fork branch October 6, 2024 09:49
@coderabbitai coderabbitai bot mentioned this pull request Nov 25, 2024
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.

2 participants