feat: add multi tenant service api key#571
Conversation
Upgrade lib-commons to pick up WithServiceAPIKey option in tenant manager client. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add service API key field to Config structs, require it when MULTI_TENANT_ENABLED=true via validation, pass it to the tenant manager client via WithServiceAPIKey, and cover both paths with unit tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis pull request introduces a new MULTI_TENANT_SERVICE_API_KEY configuration parameter used by manager and worker components. It uncomments circuit-breaker timeout settings in .env.example files, adds MultiTenantServiceAPIKey fields to Config structs, enforces validation that the key is required when MULTI_TENANT_ENABLED is true, passes the key to tenant-manager HTTP client initialization, and adds tests for the validation. The go.mod dependency for lib-commons is bumped to v4.1.0-beta.4. Sequence Diagram(s)mermaid 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
|
Consider updating CHANGELOG.md to document this change. If this change doesn't need a changelog entry, add the |
🔒 Security Scan Results —
|
🔒 Security Scan Results —
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/manager/.env.example`:
- Around line 165-167: Add a single trailing newline at the end of the
.env.example file so the file ends with a blank line; ensure the file terminates
after the last commented variable (e.g.,
MULTI_TENANT_CIRCUIT_BREAKER_TIMEOUT_SEC and MULTI_TENANT_SERVICE_API_KEY) to
satisfy dotenv-linter and standard POSIX newline expectations.
In `@components/worker/.env.example`:
- Line 124: Add a trailing newline at EOF in components/worker/.env.example to
satisfy dotenv-linter's EndingBlankLine rule; simply ensure the last line
containing "#MULTI_TENANT_SERVICE_API_KEY=" is followed by a single newline
character so the file ends with a blank line.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 702ec6d0-3c24-4c7e-b98e-f53103c1f9ec
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (10)
components/manager/.env.examplecomponents/manager/internal/bootstrap/config.gocomponents/manager/internal/bootstrap/config_test.gocomponents/manager/internal/bootstrap/init_tenant.gocomponents/worker/.env.examplecomponents/worker/internal/bootstrap/config.gocomponents/worker/internal/bootstrap/config_multitenant.gocomponents/worker/internal/bootstrap/config_test.gocomponents/worker/internal/bootstrap/config_validation.gogo.mod
…eter ComputeStatus was using time.Now() internally, causing AdvanceRecurrence tests with hardcoded dates to become flaky once the real clock passed those dates. Accept an optional now variadic so AdvanceRecurrence can forward its own reference time while existing callers remain unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Consider updating CHANGELOG.md to document this change. If this change doesn't need a changelog entry, add the |
📊 Unit Test Coverage Report:
|
| Metric | Value |
|---|---|
| Overall Coverage | 87.3% ✅ PASS |
| Threshold | 85% |
Coverage by Package
| Package | Coverage |
|---|---|
github.com/LerianStudio/reporter/components/manager/internal/adapters/http/in |
87.3% |
github.com/LerianStudio/reporter/components/manager/internal/services |
88.6% |
Generated by Go PR Analysis workflow
📊 Unit Test Coverage Report:
|
| Metric | Value |
|---|---|
| Overall Coverage | 90.7% ✅ PASS |
| Threshold | 85% |
Coverage by Package
| Package | Coverage |
|---|---|
github.com/LerianStudio/reporter/components/worker/internal/services |
92.6% |
Generated by Go PR Analysis workflow
gandalf-at-lerian
left a comment
There was a problem hiding this comment.
Same service API key plumbing as fetcher — consistent across both repos. Bonus: ComputeStatus now accepts optional now param instead of relying on time.Now() — much better for deterministic tests. lib-commons v4 bump to beta.4. LGTM ✅
Pull Request Checklist
Pull Request Type
Checklist
Please check each item after it's completed.
Additional Notes
Obs: Please, always remember to target your PR to develop branch instead of main.