fix(providers): reduce metadata enrichment log noise#187
fix(providers): reduce metadata enrichment log noise#187SantiagoDePolonia merged 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughThe changes refactor metadata enrichment tracking by introducing an Changes
Sequence DiagramsequenceDiagram
participant Init as Init Process
participant Registry as Model Registry
participant Enricher as Enricher
participant Logger as Structured Logger
Init->>Registry: Initialize()
Registry->>Enricher: enrichProviderModelMaps()
Enricher->>Enricher: iterate models & resolve metadata
Enricher-->>Registry: return metadataEnrichmentStats{Enriched, Total, Providers}
Registry->>Logger: slog.Info("model registry initialized", ..., metadata_enriched, metadata_total, metadata_providers)
Logger-->>Registry: log entry emitted
Registry-->>Init: initialization complete
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/providers/registry_test.go`:
- Around line 671-676: This test replaces the global logger via
slog.SetDefault(slog.New(...)) and restores it in t.Cleanup, which is not safe
if the test is made parallel; update the test around the
slog.Default/Slog.SetDefault usage to add a clear inline comment documenting
that the test must not be run in parallel (do not call t.Parallel()) because it
mutates global state, and consider (optionally) guarding the global mutation
with a note referencing the cleanup that restores the original logger.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 28363309-0a57-4ed6-a450-195067c13ff0
📒 Files selected for processing (4)
internal/modeldata/enricher.gointernal/providers/init.gointernal/providers/registry.gointernal/providers/registry_test.go
| var buf bytes.Buffer | ||
| original := slog.Default() | ||
| slog.SetDefault(slog.New(slog.NewJSONHandler(&buf, &slog.HandlerOptions{Level: slog.LevelInfo}))) | ||
| t.Cleanup(func() { | ||
| slog.SetDefault(original) | ||
| }) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider test isolation for parallel safety.
The test modifies slog.Default(), which is a global state. While t.Cleanup properly restores it and this test doesn't call t.Parallel(), future maintainers might inadvertently add parallelism.
Consider adding a comment to document this constraint:
var buf bytes.Buffer
original := slog.Default()
+ // NOTE: This test modifies slog.Default() and must not run in parallel with other tests.
slog.SetDefault(slog.New(slog.NewJSONHandler(&buf, &slog.HandlerOptions{Level: slog.LevelInfo})))🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@internal/providers/registry_test.go` around lines 671 - 676, This test
replaces the global logger via slog.SetDefault(slog.New(...)) and restores it in
t.Cleanup, which is not safe if the test is made parallel; update the test
around the slog.Default/Slog.SetDefault usage to add a clear inline comment
documenting that the test must not be run in parallel (do not call t.Parallel())
because it mutates global state, and consider (optionally) guarding the global
mutation with a note referencing the cleanup that restores the original logger.
Summary
Test Plan
Summary by CodeRabbit
Bug Fixes
Tests