move event gw db to new schema#2650
Conversation
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (20)
📝 WalkthroughWalkthroughEvent-gateway schemas, storage registration, control-plane hooks, lifecycle handlers, HMAC synchronization, and configuration-dump handling were added. Core schemas and event types were reassigned to the event-gateway module, while WebSub/WebBroker authorization route mappings were removed. ChangesEvent-Gateway integration
Admin configuration dump
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ControlPlaneClient
participant Hooks
participant APIUtilsService
participant GatewayStorage
participant EventHub
ControlPlaneClient->>Hooks: Dispatch WebSub/WebBroker lifecycle event
Hooks->>APIUtilsService: Fetch API definition ZIP or JSON secrets
APIUtilsService-->>Hooks: Definition or secret data
Hooks->>GatewayStorage: Update API state and secret references
Hooks->>EventHub: Publish API update
Hooks-->>ControlPlaneClient: Send deployment acknowledgment
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
gateway/gateway-controller/pkg/utils/api_utils.go (1)
651-687: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winBound the response body with
io.LimitReaderbefore reading into memory.
FetchResourceZip(Line 677) andFetchResourceJSON(Line 714) read the network response body without an upper bound, so an unexpectedly large upstream payload could exhaust memory. Wrap the body inio.LimitReaderwith a configurable ceiling beforeio.ReadAll/Decode.As per coding guidelines: "Wrap every user- or network-originated
io.Readerinio.LimitReaderbefore reading it into memory. Source the byte limit from configuration (environment variable or config file), provide a safe default, and do not hardcode the ceiling."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gateway/gateway-controller/pkg/utils/api_utils.go` around lines 651 - 687, The response bodies read by FetchResourceZip and FetchResourceJSON are unbounded; wrap each network response body with io.LimitReader before io.ReadAll or decoding. Source the maximum byte limit from configuration with a safe default, rather than hardcoding it, and preserve the existing success and error handling behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@gateway/gateway-controller/pkg/utils/api_utils.go`:
- Around line 651-687: The response bodies read by FetchResourceZip and
FetchResourceJSON are unbounded; wrap each network response body with
io.LimitReader before io.ReadAll or decoding. Source the maximum byte limit from
configuration with a safe default, rather than hardcoding it, and preserve the
existing success and error handling behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 63f0b092-a8da-4c69-ba24-6b5d7abd6420
📒 Files selected for processing (20)
event-gateway/gateway-controller/cmd/controller/main.goevent-gateway/gateway-controller/pkg/controlplanehooks/events.goevent-gateway/gateway-controller/pkg/controlplanehooks/hooks.goevent-gateway/gateway-controller/pkg/dbschema/dbschema.goevent-gateway/gateway-controller/pkg/dbschema/eventgateway-db.postgres.sqlevent-gateway/gateway-controller/pkg/dbschema/eventgateway-db.sqlevent-gateway/gateway-controller/pkg/dbschema/eventgateway-db.sqlserver.sqlevent-gateway/gateway-controller/pkg/kindsupport/kindsupport.gogateway/gateway-controller/cmd/controller/main.gogateway/gateway-controller/pkg/api/handlers/handlers.gogateway/gateway-controller/pkg/controlplane/client.gogateway/gateway-controller/pkg/controlplane/eventgateway_hooks.gogateway/gateway-controller/pkg/controlplane/events.gogateway/gateway-controller/pkg/storage/gateway-controller-db.postgres.sqlgateway/gateway-controller/pkg/storage/gateway-controller-db.sqlgateway/gateway-controller/pkg/storage/gateway-controller-db.sqlserver.sqlgateway/gateway-controller/pkg/storage/sql_store.gogateway/gateway-controller/pkg/storage/sqlite_test.gogateway/gateway-controller/pkg/utils/api_utils.gogateway/gateway-controller/tests/integration/schema_test.go
💤 Files with no reviewable changes (3)
- gateway/gateway-controller/pkg/storage/sqlite_test.go
- gateway/gateway-controller/cmd/controller/main.go
- gateway/gateway-controller/pkg/api/handlers/handlers.go
05d5947 to
bab1ae1
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
gateway/gateway-controller/pkg/utils/api_utils.go (1)
658-658: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer
http.NewRequestWithContextfor outbound network calls.Consider accepting a
context.Contextparameter in these helper functions to support timeouts and cancellations.
gateway/gateway-controller/pkg/utils/api_utils.go#L658-L658: Update to usehttp.NewRequestWithContext(ctx, "GET", url, nil).gateway/gateway-controller/pkg/utils/api_utils.go#L695-L695: Update to usehttp.NewRequestWithContext(ctx, "GET", url, nil).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gateway/gateway-controller/pkg/utils/api_utils.go` at line 658, Update both outbound GET request sites in gateway/gateway-controller/pkg/utils/api_utils.go at lines 658-658 and 695-695: have the containing helper functions accept a context.Context parameter and use it with http.NewRequestWithContext for each request, propagating the caller’s context to preserve timeout and cancellation support.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@gateway/gateway-controller/pkg/utils/api_utils.go`:
- Around line 672-681: Limit all network response-body reads in
api_utils.go:672-681 and api_utils.go:709-717 by wrapping resp.Body with
io.LimitReader before io.ReadAll and json.NewDecoder; use a configured byte
limit from PlatformAPIConfig and add a safe default for these requests. Preserve
the existing success and error handling while applying the limit in every listed
path.
---
Nitpick comments:
In `@gateway/gateway-controller/pkg/utils/api_utils.go`:
- Line 658: Update both outbound GET request sites in
gateway/gateway-controller/pkg/utils/api_utils.go at lines 658-658 and 695-695:
have the containing helper functions accept a context.Context parameter and use
it with http.NewRequestWithContext for each request, propagating the caller’s
context to preserve timeout and cancellation support.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: eb50bc55-1b12-44f8-8945-4e9b14e0345c
📒 Files selected for processing (20)
event-gateway/gateway-controller/cmd/controller/main.goevent-gateway/gateway-controller/pkg/controlplanehooks/events.goevent-gateway/gateway-controller/pkg/controlplanehooks/hooks.goevent-gateway/gateway-controller/pkg/dbschema/dbschema.goevent-gateway/gateway-controller/pkg/dbschema/eventgateway-db.postgres.sqlevent-gateway/gateway-controller/pkg/dbschema/eventgateway-db.sqlevent-gateway/gateway-controller/pkg/dbschema/eventgateway-db.sqlserver.sqlevent-gateway/gateway-controller/pkg/kindsupport/kindsupport.gogateway/gateway-controller/cmd/controller/main.gogateway/gateway-controller/pkg/api/handlers/handlers.gogateway/gateway-controller/pkg/controlplane/client.gogateway/gateway-controller/pkg/controlplane/eventgateway_hooks.gogateway/gateway-controller/pkg/controlplane/events.gogateway/gateway-controller/pkg/storage/gateway-controller-db.postgres.sqlgateway/gateway-controller/pkg/storage/gateway-controller-db.sqlgateway/gateway-controller/pkg/storage/gateway-controller-db.sqlserver.sqlgateway/gateway-controller/pkg/storage/sql_store.gogateway/gateway-controller/pkg/storage/sqlite_test.gogateway/gateway-controller/pkg/utils/api_utils.gogateway/gateway-controller/tests/integration/schema_test.go
💤 Files with no reviewable changes (3)
- gateway/gateway-controller/pkg/storage/sqlite_test.go
- gateway/gateway-controller/pkg/api/handlers/handlers.go
- gateway/gateway-controller/cmd/controller/main.go
🚧 Files skipped from review as they are similar to previous changes (15)
- event-gateway/gateway-controller/pkg/dbschema/eventgateway-db.postgres.sql
- gateway/gateway-controller/pkg/controlplane/events.go
- event-gateway/gateway-controller/cmd/controller/main.go
- gateway/gateway-controller/pkg/storage/gateway-controller-db.sqlserver.sql
- event-gateway/gateway-controller/pkg/dbschema/eventgateway-db.sqlserver.sql
- event-gateway/gateway-controller/pkg/kindsupport/kindsupport.go
- event-gateway/gateway-controller/pkg/dbschema/eventgateway-db.sql
- event-gateway/gateway-controller/pkg/dbschema/dbschema.go
- gateway/gateway-controller/pkg/controlplane/client.go
- event-gateway/gateway-controller/pkg/controlplanehooks/events.go
- gateway/gateway-controller/pkg/storage/gateway-controller-db.postgres.sql
- gateway/gateway-controller/pkg/controlplane/eventgateway_hooks.go
- gateway/gateway-controller/pkg/storage/gateway-controller-db.sql
- event-gateway/gateway-controller/pkg/controlplanehooks/hooks.go
- gateway/gateway-controller/pkg/storage/sql_store.go
bab1ae1 to
36f34b6
Compare
move event gw db to new schema