Skip to content

feat: support multi config#30

Merged
ren0503 merged 1 commit intomasterfrom
feat/ren/29-support-multi-config
Sep 2, 2025
Merged

feat: support multi config#30
ren0503 merged 1 commit intomasterfrom
feat/ren/29-support-multi-config

Conversation

@ren0503
Copy link
Contributor

@ren0503 ren0503 commented Sep 2, 2025

No description provided.

@ren0503 ren0503 added this to the Fetch Release v2.0.2 milestone Sep 2, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 2, 2025

Caution

Review failed

The pull request is closed.

Summary by CodeRabbit

  • New Features

    • Added support for multiple named configurations, allowing you to register and use several providers side-by-side and select them by name.
  • Tests

    • Added tests covering multi-configuration usage and factory-based provisioning.
  • Chores

    • Expanded Makefile with dedicated tasks for audit, format, lint, tidy, test, coverage (HTML report), and benchmark to streamline project maintenance.
    • Updated a core dependency to the latest minor version for improvements and compatibility.

Walkthrough

Adds multi-configuration support to the fetch module with named config registration and name-based injection. Updates tests to cover new registration and factory paths. Bumps github.com/tinh-tinh/tinhtinh/v2 in go.mod. Refactors Makefile into discrete phony targets: audit, format, lint, tidy, test, coverage, benchmark.

Changes

Cohort / File(s) Summary
Build tooling
Makefile
Replaced the previous combined test-coverage target with discrete phony targets: audit, format, lint, tidy, test, coverage, and benchmark, each with explicit commands.
Dependency update
go.mod
Updated github.com/tinh-tinh/tinhtinh/v2 from v2.1.1 to v2.3.2.
Fetch multi-config API
module.go
Added MConfig type, RegisterMulti, MConfigFactory, RegisterMultiFactory, and InjectByName to support registering multiple named configurations and retrieving a *Fetch by name.
Tests for multi-config
module_test.go
Added tests verifying RegisterMulti and RegisterMultiFactory behavior and name-based retrieval (InjectByName), asserting per-name header isolation.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor App
  participant Core as Core.RefProvider
  participant Fetch as fetch.Module

  rect rgb(235,243,255)
  note over App,Fetch: Register multiple named configs
  App->>Fetch: RegisterMulti([MConfig{Name,Config}]...)
  Fetch->>Core: Export(Name, *Fetch created via Create(&cfg))
  end

  rect rgb(240,255,240)
  note over App,Fetch: Register via factory
  App->>Fetch: RegisterMultiFactory(factory)
  Fetch->>App: factory(Core) -> []MConfig
  Fetch->>Core: Export(Name, *Fetch) for each MConfig
  end

  rect rgb(255,248,230)
  note over App,Core: Name-based injection
  App->>Core: Provide(Name)
  Core-->>App: *Fetch or nil
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop through configs, one, two, three—
Names like carrots in a tidy spree.
Fetch by label, crisp and bright,
Headers twinkle in the night.
Makefile drums a cleaner beat,
Mods refreshed, tests complete—
Thump-thump! This ship feels fleet. 🥕🚀


📜 Recent 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 3ee3fda and 395c8e3.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • Makefile (1 hunks)
  • go.mod (1 hunks)
  • module.go (1 hunks)
  • module_test.go (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ren/29-support-multi-config

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 or @coderabbit 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.

@ren0503 ren0503 linked an issue Sep 2, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ren0503 ren0503 force-pushed the feat/ren/29-support-multi-config branch from 3ee3fda to 395c8e3 Compare September 2, 2025 14:12
@ren0503 ren0503 merged commit 4c14347 into master Sep 2, 2025
2 checks passed
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.

Support Multi Instance When Register Module

1 participant