Skip to content

feat: modelcatalog main composer added - #4037

Closed
Pratham-Mishra04 wants to merge 1 commit into
graphite-base/4037from
06-04-feat_modelcatalog_main_composer_added
Closed

feat: modelcatalog main composer added#4037
Pratham-Mishra04 wants to merge 1 commit into
graphite-base/4037from
06-04-feat_modelcatalog_main_composer_added

Conversation

@Pratham-Mishra04

Copy link
Copy Markdown
Collaborator

Summary

Briefly explain the purpose of this PR and the problem it solves.

Changes

  • What was changed and why
  • Any notable design decisions or trade-offs

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Describe the steps to validate this change. Include commands and expected outcomes.

# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

If adding new configs or environment variables, document them here.

Screenshots/Recordings

If UI changes, add before/after screenshots or short clips.

Breaking changes

  • Yes
  • No

If yes, describe impact and migration instructions.

Related issues

Link related issues and discussions. Example: Closes #123

Security considerations

Note any security implications (auth, secrets, PII, sandboxing, etc.).

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Pratham-Mishra04, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes and 1 second. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6aef2f2c-d029-4803-808a-cb8243552be9

📥 Commits

Reviewing files that changed from the base of the PR and between 8f5a92c and 0872473.

📒 Files selected for processing (15)
  • framework/modelcatalog/capabilities_test.go
  • framework/modelcatalog/config.go
  • framework/modelcatalog/datasheet/store.go
  • framework/modelcatalog/main.go
  • framework/modelcatalog/main_test.go
  • framework/modelcatalog/models.go
  • framework/modelcatalog/pool.go
  • framework/modelcatalog/pricing.go
  • framework/modelcatalog/pricing_overrides.go
  • framework/modelcatalog/pricing_overrides_test.go
  • framework/modelcatalog/pricing_test.go
  • framework/modelcatalog/refine_test.go
  • framework/modelcatalog/shims.go
  • framework/modelcatalog/sync.go
  • framework/modelcatalog/utils.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-04-feat_modelcatalog_main_composer_added

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

Pratham-Mishra04 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from 06-04-feat_adds_key_param_in_list_models to graphite-base/4037 June 3, 2026 21:50
@greptile-apps

greptile-apps Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 2/5

Not safe to merge — the package will not compile as written.

Two separate compile-breaking errors in shims.go prevent the entire framework module from building: live.Upsert is called with a spurious time.Now() fifth argument that the function does not accept, and extractModelIDs is declared in both shims.go and pool.go within the same package. Either error alone blocks compilation; together they mean no binary ships from this commit.

framework/modelcatalog/shims.go and framework/modelcatalog/pool.go need immediate attention to fix the argument-count mismatch and the duplicate function declaration.

Important Files Changed

Filename Overview
framework/modelcatalog/shims.go New compatibility shim file with two compile-breaking errors: live.Upsert called with 5 args (signature takes 4), and extractModelIDs redeclared (also defined in pool.go)
framework/modelcatalog/pool.go New file exposing push surface for live/keyconfig stores; defines extractModelIDs which duplicates the same function in shims.go causing a compile error
framework/modelcatalog/main.go Refactored ModelCatalog composer: replaces flat in-memory maps with datasheet/live/keyconfig sub-stores; preserves distributed lock, background sync ticker, and init guard pattern; nil-safe config checks added
framework/modelcatalog/models.go GetModelsForProvider, GetUnfilteredModelsForProvider, GetProvidersForModel rewritten to compose live+datasheet+keyconfig stores; cross-provider special cases preserved verbatim
framework/modelcatalog/config.go Type re-exports and constant re-exports added to preserve backward-compatible API surface for external callers without import changes
framework/modelcatalog/datasheet/store.go Adds NewTestStore constructor to datasheet subpackage; no logic changes to existing read/write paths
framework/modelcatalog/pricing.go Gutted from ~1500 lines to ~60: all pricing logic, types, and cost calculation moved to datasheet subpackage; file now contains thin delegation wrappers only
framework/modelcatalog/capabilities_test.go Deleted — 7 capability tests removed without replacement in the datasheet subpackage test suite

Reviews (1): Last reviewed commit: "feat: modelcatalog main composer added" | Re-trigger Greptile

Comment on lines +28 to +37
mc.live.Upsert(provider, "", false, models, time.Now())
}

// UpsertUnfilteredModelDataForProvider stores the unfiltered provider
// response in a single aggregated entry.
//
// Deprecated: shim. See UpsertModelDataForProvider.
func (mc *ModelCatalog) UpsertUnfilteredModelDataForProvider(provider schemas.ModelProvider, modelData *schemas.BifrostListModelsResponse) {
models := extractModelIDs(modelData, provider)
mc.live.Upsert(provider, "", true, models, time.Now())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Wrong argument count to live.Upsert — won't compile

mc.live.Upsert is called with 5 arguments (provider, "", false/true, models, time.Now()) on lines 28 and 36, but live.Store.Upsert only accepts 4 parameters — the time.Now() argument has no corresponding parameter. The package will fail to compile with "too many arguments in call to mc.live.Upsert".

Comment on lines +47 to +68
// extractModelIDs flattens a list-models response into the bare model
// identifiers the live store expects, filtering entries whose ID prefix
// doesn't match the requested provider.
func extractModelIDs(resp *schemas.BifrostListModelsResponse, provider schemas.ModelProvider) []string {
if resp == nil {
return nil
}
seen := make(map[string]struct{}, len(resp.Data))
out := make([]string, 0, len(resp.Data))
for _, m := range resp.Data {
parsedProvider, parsedModel := schemas.ParseModelString(m.ID, "")
if parsedProvider != "" && parsedProvider != provider {
continue
}
if _, ok := seen[parsedModel]; ok {
continue
}
seen[parsedModel] = struct{}{}
out = append(out, parsedModel)
}
return out
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Duplicate extractModelIDs function — won't compile

extractModelIDs is defined identically in both shims.go (line 50) and pool.go (line 83) within the same modelcatalog package. Go does not allow two top-level declarations with the same name in a package; this produces a "extractModelIDs redeclared in this block" compile error. One of the two definitions must be removed.

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.

2 participants