8000 fix(local): fix missing doc and target about plugin compilation by paul-nicolas · Pull Request #422 · formancehq/payments · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(local): fix missing doc and target about plugin compilation #422

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

paul-nicolas
Copy link
Contributor

No description provided.

Copy link
Contributor
coderabbitai bot commented Apr 23, 2025

Walkthrough

This change introduces a new shell script for generating a Go plugin list file, updates build and development workflows to use this script, and enhances the build system to optionally save the generated file locally. The documentation is updated to reflect the new workflow, and the pre-commit process is extended to include plugin compilation. The Earthfile's compile-plugins target now accepts a local_save argument, enabling local persistence of the generated file when specified.

Changes

File(s) Change Summary
CONTRIBUTING.md Updated documentation to include a step for compiling plugins locally before launching the Connectivity Service.
Earthfile Modified compile-plugins target to use a new script for generating list.go and added local_save argument.
Justfile Added a compile-plugins recipe and included it as a dependency for pre-commit.
tools/compile-plugins/compile-plugin.sh Introduced a new shell script to automate the creation of a Go plugin list file based on directory contents.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Justfile
    participant compile-plugin.sh
    participant Earthfile

    Developer->>Justfile: Run pre-commit or compile-plugins
    Justfile->>compile-plugin.sh: Execute with list.go and plugin dir
    compile-plugin.sh->>compile-plugin.sh: Generate list.go with imports
    Justfile->>Earthfile: Optionally trigger compile-plugins with local_save
    Earthfile->>compile-plugin.sh: Execute script as part of build
    Earthfile->>Earthfile: Conditionally save list.go locally if local_save=true
Loading

Possibly related PRs

  • fix(earthfile): fix missing list files when releasing #275: Both PRs modify the handling of the list.go plugin list file in the Earthfile build process, with the main PR adding a local save option and script-based generation, while the retrieved PR ensures the list.go file is copied into various build stages for release and testing.

Suggested labels

build-images

Suggested reviewers

  • laouji

Poem

A bunny in the build burrow,
Writes scripts with nimble furrow.
Plugins now compile with ease,
Local saves, if you please!
Docs and recipes freshly spun,
Pre-commit hops—work well done!
🐇✨


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

@paul-nicolas paul-nicolas force-pushed the fix/local-testing-compile-plugins branch from d2951a8 to c19200f Compare April 23, 2025 16:20
@paul-nicolas paul-nicolas marked this pull request as ready for review April 23, 2025 16:21
@paul-nicolas paul-nicolas requested a review from a team as a code owner April 23, 2025 16:21
Copy link
Contributor
@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: 5

🧹 Nitpick comments (4)
tools/compile-plugins/compile-plugin.sh (1)

10-12: Command substitution can break with spaces in directory names.

The loop may have issues with directory names containing spaces. Also, ls -d */ isn't a reliable way to list directories as it doesn't handle hidden directories and can be affected by shell globbing.

-for c in $(ls -d */ | sed 's#/##'); do
-    printf "    _ \"github.com/formancehq/payments/internal/connectors/plugins/public/$c\"\n" >> $1
-done
+find . -mindepth 1 -maxdepth 1 -type d | while read -r dir; do
+    c=$(basename "$dir")
+    printf "    _ \"github.com/formancehq/payments/internal/connectors/plugins/public/%s\"\n" "$c" >> "$1"
+done
CONTRIBUTING.md (2)

745-745: Fix Markdown linting issue with command documentation.

The line violates the Markdown linting rule MD014 which recommends not using dollar signs before commands without showing output.

-$ earthly -P +compile-plugins --local_save=true
+```bash
+earthly -P +compile-plugins --local_save=true
+```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

745-745: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


744-747: Document the plugin compilation step purpose.

The new command is added without any explanation about what it does or why it's necessary before running the service.

+```bash
+# First compile the Go plugins and save locally
+earthly -P +compile-plugins --local_save=true
-$ earthly -P +compile-plugins --local_save=true
 $ docker compose up
+```
+
+The first command generates a `list.go` file with all available plugins, which is necessary for the Connectivity Service to discover and load the plugins.
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

745-745: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)


746-746: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)

Earthfile (1)

23-23: Consider proper error handling for the compile-plugin.sh script.

The script execution doesn't verify if the script runs successfully. If it fails, the build might continue with an invalid or missing list.go file.

-    RUN ./src/tools/compile-plugins/compile-plugin.sh list.go /src/internal/connectors/plugins/public
+    RUN set -e && \
+        if [ ! -f ./src/tools/compile-plugins/compile-plugin.sh ]; then \
+            echo "Error: compile-plugin.sh script not found!" && \
+            exit 1; \
+        fi && \
+        ./src/tools/compile-plugins/compile-plugin.sh list.go /src/internal/connectors/plugins/public
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f36068f and c19200f.

📒 Files selected for processing (4)
  • CONTRIBUTING.md (1 hunks)
  • Earthfile (1 hunks)
  • Justfile (2 hunks)
  • tools/compile-plugins/compile-plugin.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
tools/compile-plugins/compile-plugin.sh

[warning] 7-7: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 14-14: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🪛 markdownlint-cli2 (0.17.2)
CONTRIBUTING.md

745-745: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests
🔇 Additional comments (2)
Justfile (1)

6-6: Good integration of compile-plugins into the pre-commit workflow.

The change correctly integrates the new compile-plugins step into the pre-commit workflow.

Earthfile (1)

20-27: Good implementation of conditional local file saving.

The changes to the compile-plugins target improve the build workflow by allowing optional local saving with a clean conditional statement.

Copy link
codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.93%. Comparing base (f36068f) to head (02b324f).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #422   +/-   ##
=======================================
  Coverage   60.93%   60.93%           
=======================================
  Files         566      566           
  Lines       28843    28843           
=======================================
  Hits        17576    17576           
  Misses      10317    10317           
  Partials      950      950           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paul-nicolas paul-nicolas force-pushed the fix/local-testing-compile-plugins branch from c19200f to 02b324f Compare April 23, 2025 16:46
Copy link
Contributor
@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: 0

🧹 Nitpick comments (1)
CONTRIBUTING.md (1)

745-745: Remove leading $ prompt in shell code block
Per markdownlint rule MD014, avoid including prompt characters without showing command output. Consider removing the $ or adding expected output.

-$ earthly -P +compile-plugins --local_save=true
+earthly -P +compile-plugins --local_save=true
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

745-745: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c19200f and 02b324f.

📒 Files selected for processing (4)
  • CONTRIBUTING.md (1 hunks)
  • Earthfile (1 hunks)
  • Justfile (2 hunks)
  • tools/compile-plugins/compile-plugin.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • Justfile
  • tools/compile-plugins/compile-plugin.sh
  • Earthfile
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CONTRIBUTING.md

745-745: Dollar signs used before commands without showing output
null

(MD014, commands-show-output)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests

@paul-nicolas paul-nicolas merged commit b06b085 into main Apr 23, 2025
9 checks passed
@paul-nicolas paul-nicolas deleted the fix/local-testing-compile-plugins branch April 23, 2025 16:51
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
0