Accept per-tenant integration slug on /os/provision - #5
Conversation
Shared executor hosts multiple CF OS instances. Each gatekeeper sends its own GraphQL integration slug so priuscenter does not clobber erxes-officenext.
Reviewer's GuideThe provisioning endpoint now supports an optional validated integration slug, defaulting to Sequence diagram for per-tenant integration provisioningsequenceDiagram
participant Client
participant Worker
participant Executor
Client->>Worker: POST /os/provision
Worker->>Worker: parseIntegrationSlug(input.integration)
alt Invalid integration slug
Worker-->>Client: 400 Invalid request
else Valid or omitted integration
Worker->>Executor: GET /api/graphql/integrations/{integration}
alt Integration missing
Worker->>Executor: POST /api/graphql/integrations
Executor-->>Worker: Integration created
end
Worker->>Executor: POST /api/connections
Executor-->>Worker: Connection response
Worker-->>Client: Provisioning response
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 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.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="apps/host-cloudflare/src/worker.ts" line_range="109-113" />
<code_context>
- name: "OfficeNext",
- description: "OfficeNext Erxes GraphQL API",
+ slug: integration,
+ name: integration,
+ description: `${integration} Erxes GraphQL API`,
authenticationTemplate: [
</code_context>
<issue_to_address>
**issue (broader_impact):** The default `erxes-officenext` provisioning no longer preserves the existing OfficeNext-facing metadata: the integration name, description, connection name, identity label, and connection description become `erxes-officenext`-based values instead of `OfficeNext`/`Your OfficeNext account`. This breaks the stated compatibility guarantee that officenext remains unchanged and changes the labels shown to existing internal SSO users.
**Triggers:** When `integration` is omitted and the default OfficeNext integration is provisioned or its connection is refreshed.
**Suggested fix:** Keep the legacy OfficeNext metadata when `integration === DEFAULT_ERXES_INTEGRATION`, and use slug-derived metadata only for custom integrations.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and a caller-supplied slug now controls which integration is looked up and which integration and connection records are created, so an incorrect slug could associate credentials with the wrong integration and leave persisted records behind after a revert. The records and affected connection can be identified and removed or recreated, making the impact bounded and repairable.
Blocking findings: apps/host-cloudflare/src/worker.ts:113
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| name: integration, | ||
| description: `${integration} Erxes GraphQL API`, | ||
| authenticationTemplate: [ | ||
| { | ||
| slug: "cookie", |
There was a problem hiding this comment.
issue (broader_impact): The default erxes-officenext provisioning no longer preserves the existing OfficeNext-facing metadata: the integration name, description, connection name, identity label, and connection description become erxes-officenext-based values instead of OfficeNext/Your OfficeNext account. This breaks the stated compatibility guarantee that officenext remains unchanged and changes the labels shown to existing internal SSO users.
Triggers: When integration is omitted and the default OfficeNext integration is provisioned or its connection is refreshed.
Suggested fix: Keep the legacy OfficeNext metadata when integration === DEFAULT_ERXES_INTEGRATION, and use slug-derived metadata only for custom integrations.
Summary
/os/provisionaccepts optionalintegrationin the POST bodyerxes-officenextwhen omitted (officenext unchanged)erxes-priuscenteron the shared executorTest plan
erxes-officenextintegration: erxes-priuscentercreates a separate GraphQL integrationReplaces #4 (that PR accidentally included upstream UsefulSoftwareCo divergence).
Summary by Sourcery
Support tenant-specific integration provisioning while retaining the existing OfficeNext default.
New Features:
/os/provisioncallers to select a valid per-tenant integration slug.erxes-officenext.Enhancements: