Skip to content

fix(crm): align tenant-manager module name with provisioning (crm → crm-api)#2125

Merged
jeffersonrodrigues92 merged 1 commit into
mainfrom
hotfix/crm-module-name-tenant-lookup
May 28, 2026
Merged

fix(crm): align tenant-manager module name with provisioning (crm → crm-api)#2125
jeffersonrodrigues92 merged 1 commit into
mainfrom
hotfix/crm-module-name-tenant-lookup

Conversation

@jeffersonrodrigues92
Copy link
Copy Markdown
Contributor

Summary

  • CRM was registering with tenant-manager using moduleName = "crm" (components/crm/internal/bootstrap/config.tenant.go:29), but tenant databases are provisioned under module crm-api.
  • This caused runtime failures in multi-tenant mode:
    no MongoDB config for tenant <id> service plugin-crm module crm
  • Fix: change the constant to "crm-api" so the module identity matches what tenant-manager has provisioned for the service.

Scope

Single one-line change. Service name (plugin-crm) and OTel resource name (crm) intentionally left untouched — only the multi-tenant identifier moves.

Test plan

  • Deploy in a multi-tenant environment and confirm tmmongo resolves a tenant DB config for module crm-api (no more "no MongoDB config for tenant" error)
  • Verify single-tenant mode is unaffected (the constant is only consumed inside initTenantMiddleware, which is a no-op when MULTI_TENANT_ENABLED=false)

🤖 Generated with Claude Code

…rm-api) 🐛

The CRM service registers with tenant-manager using moduleName "crm" but
tenant databases are provisioned under module "crm-api", causing
"no MongoDB config for tenant ... module crm" errors at runtime in
multi-tenant mode.
@jeffersonrodrigues92 jeffersonrodrigues92 requested a review from a team as a code owner May 28, 2026 16:57
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7cdbc084-2171-4e48-b051-e1b89653e7f4

📥 Commits

Reviewing files that changed from the base of the PR and between c716dcf and 3f38a8c.

📒 Files selected for processing (1)
  • components/crm/internal/bootstrap/config.tenant.go

Walkthrough

This PR updates the CRM tenant bootstrap configuration to change the module name identifier from "crm" to "crm-api". The change affects the module label passed into the Mongo manager options during initialization.

Changes

CRM Bootstrap Configuration

Layer / File(s) Summary
Module name constant update
components/crm/internal/bootstrap/config.tenant.go
The moduleName constant is changed from "crm" to "crm-api" to align the module identifier passed to Mongo manager options.

Comment @coderabbitai help to get the list of available commands and usage tips.

@jeffersonrodrigues92 jeffersonrodrigues92 merged commit 015140d into main May 28, 2026
16 of 17 checks passed
@jeffersonrodrigues92 jeffersonrodrigues92 deleted the hotfix/crm-module-name-tenant-lookup branch May 28, 2026 16:59
@lerian-studio
Copy link
Copy Markdown
Contributor

🔒 Security Scan Results — crm

Trivy

Filesystem Scan

✅ No vulnerabilities or secrets found.

Docker Image Scan

✅ No vulnerabilities found.


Docker Hub Health Score Compliance

✅ Policies — 4/4 met

Policy Status
Default non-root user ✅ Passed
No fixable critical/high CVEs ✅ Passed
No high-profile vulnerabilities ✅ Passed
No AGPL v3 licenses ✅ Passed

Pre-release Version Check

✅ No unstable version pins found.


🔍 View full scan logs

@lerian-studio
Copy link
Copy Markdown
Contributor

📊 Unit Test Coverage Report: midaz-crm

Metric Value
Overall Coverage 87.7% ✅ PASS
Threshold 85%

Coverage by Package

Package Coverage
github.com/LerianStudio/midaz/v3/components/crm/internal/adapters/http/in 86.2%
github.com/LerianStudio/midaz/v3/components/crm/internal/adapters/mongodb/alias 92.1%
github.com/LerianStudio/midaz/v3/components/crm/internal/adapters/mongodb/holder 87.1%
github.com/LerianStudio/midaz/v3/components/crm/internal/services 95.2%

Generated by Go PR Analysis workflow

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants