refactor: replaced ModelMatcher interface with ModelCatalog struct to avoid having to do to nil checks using reflect#1589
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Caution Review failedThe pull request is closed. 📝 WalkthroughSummary by CodeRabbit
WalkthroughReplaces the governance plugin's ModelMatcher dependency with a ModelCatalog field, updates related code and tests to use ModelCatalog, and adds an exported NewTestCatalog helper to construct minimal ModelCatalog instances for testing. No background sync or production initialization behavior changed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@framework/modelcatalog/main.go`:
- Around line 638-648: NewTestCatalog returns a minimal ModelCatalog but doesn't
initialize the done channel, so calling Cleanup (which closes mc.done) can
panic; update NewTestCatalog to initialize the ModelCatalog.done channel (e.g.,
make(chan struct{})) when constructing the return value so Cleanup can safely
close it; refer to NewTestCatalog, ModelCatalog, and Cleanup to locate and fix
the initialization.
35ce660 to
26647b0
Compare
Merge activity
|
26647b0 to
1913341
Compare
d21585b to
871d512
Compare
1913341 to
6328738
Compare
871d512 to
fda220f
Compare
… avoid having to do to nil checks using reflect
6328738 to
d3cb70e
Compare

Summary
replaced
ModelMatcherinterface withModelCatalogstruct to avoid having todo to nil checks using reflect
Changes
NewTestCatalogfunction to create a minimal ModelCatalog for testingpurposes
mockModelMatcherwith the newNewTestCatalogfunctionin governance tests
ModelMatcher interface
modelMatchertomodelCatalogthroughout thecodebase
Type of change
Affected areas
How to test
Breaking changes
Related issues
N/A
Security considerations
No security implications as this is a testing utility.
Checklist