Skip to content

Conversation

@paul-nicolas
Copy link
Contributor

No description provided.

@paul-nicolas paul-nicolas requested a review from a team as a code owner August 20, 2025 13:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

Walkthrough

Endpoint field in the Column plugin config now requires a valid URL via validator tag change to "required,url". A new test asserts that providing a non-URL endpoint triggers a field validation error during plugin construction. No other logic or public API changes.

Changes

Cohort / File(s) Summary
Config validation update
internal/connectors/plugins/public/column/config.go
Updated Config.Endpoint validator from required to required,url to enforce URL format.
Tests for endpoint validation
internal/connectors/plugins/public/column/plugin_test.go
Added test ensuring invalid (non-URL) endpoint causes field validation error during New(...).

Sequence Diagram(s)

sequenceDiagram
  actor Dev as Developer/Test
  participant New as ColumnPlugin.New
  participant V as Validator
  Dev->>New: Provide config { apiKey, endpoint }
  New->>V: Validate struct tags (Endpoint: required,url)
  alt Endpoint is valid URL
    V-->>New: OK
    New-->>Dev: Plugin instance
  else Endpoint invalid
    V-->>New: Validation error
    New-->>Dev: Error (field validation)
  end
  note over V,New: Validation tightened to require URL format
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at endpoints’ fate,
No longer strings that masquerade—validate!
URLs only, hop the gate,
Tests now catch the ones that fake.
With tidy code, I celebrate—
Thump-thump! The column’s running straight. 🥕

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/column-endpoint

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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 (2)
internal/connectors/plugins/public/column/config.go (1)

13-13: Optional: Consider enforcing HTTPS if policy requires it

If endpoints should never be plain HTTP in production, you can tighten the validator. One low-friction option (without custom validators) is to require HTTPS via startswith in addition to url:

Apply this diff:

-    Endpoint string `json:"endpoint" validate:"required,url"`
+    Endpoint string `json:"endpoint" validate:"required,url,startswith=https://"`

Note: This will break tests using httptest.Server (http). If you want to enforce HTTPS only in production, we can instead add a custom validator or allow http for localhost while requiring https otherwise—happy to propose that if helpful.

internal/connectors/plugins/public/column/plugin_test.go (1)

65-71: Tighten the assertion and drop stdout printing in test

Avoid printing the error to stdout and assert the error occurred before inspecting its message. Also check for field and tag to make the test less brittle than matching the generic "Field validation" substring.

Apply this diff:

 It("should report errors in config - endpoint not url", func(ctx SpecContext) {
   config := json.RawMessage(`{"apiKey": "test", "endpoint": "fake"}`)
   _, err := New(connID, ProviderName, logger, config)
-  fmt.Println(err.Error())
-  Expect(err.Error()).To(ContainSubstring("Field validation"))
+  Expect(err).To(HaveOccurred())
+  Expect(err.Error()).To(ContainSubstring("Endpoint"))
+  Expect(err.Error()).To(ContainSubstring("'url'"))
 })

If you want to make it even more robust, prefer type-based checks over string matching:

// imports:
//   "errors"
//   "github.com/go-playground/validator/v10"

var verrs validator.ValidationErrors
Expect(errors.As(err, &verrs)).To(BeTrue())
var endpointURLFound bool
for _, fe := range verrs {
    if fe.Field() == "Endpoint" && fe.Tag() == "url" {
        endpointURLFound = true
        break
    }
}
Expect(endpointURLFound).To(BeTrue(), "expected Endpoint to fail on 'url' tag")
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1322b27 and 8eb54f3.

📒 Files selected for processing (2)
  • internal/connectors/plugins/public/column/config.go (1 hunks)
  • internal/connectors/plugins/public/column/plugin_test.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: paul-nicolas
PR: formancehq/payments#509
File: internal/connectors/plugins/public/powens/create_user_link.go:31-36
Timestamp: 2025-08-08T13:48:23.427Z
Learning: In formancehq/payments Powens plugin validation functions (e.g., validateCreateUserLinkRequest in internal/connectors/plugins/public/powens/create_user_link.go), avoid duplicating core validations like redirect URL format; the core layer already validates these per maintainer preference (paul-nicolas) in PR #509.
🧬 Code Graph Analysis (1)
internal/connectors/plugins/public/column/plugin_test.go (2)
internal/connectors/plugins/public/column/plugin.go (2)
  • New (81-102)
  • ProviderName (16-16)
internal/connectors/plugins/public/column/client/client.go (1)
  • New (67-87)
🔇 Additional comments (1)
internal/connectors/plugins/public/column/config.go (1)

13-13: LGTM: Enforcing URL validation for Endpoint is the right move

Making Endpoint required,url aligns the config with how the client uses it and prevents obvious misconfigurations early.

@codecov
Copy link

codecov bot commented Aug 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.83%. Comparing base (1322b27) to head (8eb54f3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #516      +/-   ##
==========================================
- Coverage   67.84%   67.83%   -0.01%     
==========================================
  Files         737      737              
  Lines       38262    38262              
==========================================
- Hits        25957    25954       -3     
- Misses      10952    10954       +2     
- Partials     1353     1354       +1     

☔ 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 added this pull request to the merge queue Aug 20, 2025
Merged via the queue into main with commit 6dedc4b Aug 20, 2025
8 of 9 checks passed
@paul-nicolas paul-nicolas deleted the fix/column-endpoint branch August 20, 2025 14:06
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.

4 participants