Repository navigation
feat: run the proposed action in the automatic onboarding worker (CM-1841) - #4918
Conversation
PR SummaryHigh Risk Overview
Reviewed by Cursor Bugbot for commit 8db0d04. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent onboarding workflows can overwrite integration repository mappings and soft-delete a newly added repository.
1 open finding
What changed in this PR
Runs evaluated proposedAction values during automatic onboarding and connects repositories to existing LF segments when appropriate.
Changes:
- Dispatches onboarding based on the proposed action.
- Adds GitHub integration creation/update support with repository merging.
- Adds unit coverage for dispatch and integration behavior.
| File | Description |
|---|---|
services/libs/project-onboarding/src/types.ts |
Adds segment and GitHub integration types. |
services/libs/project-onboarding/src/onboarder.ts |
Adds repository-to-segment integration logic. |
services/libs/project-onboarding/src/onboarder.test.ts |
Tests integration payloads and merging. |
services/apps/automatic_onboarding_worker/src/activities/proposedAction.ts |
Dispatches proposed onboarding actions. |
services/apps/automatic_onboarding_worker/src/activities/proposedAction.test.ts |
Tests action dispatch and errors. |
services/apps/automatic_onboarding_worker/src/activities/activities.ts |
Integrates action dispatch into onboarding. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| try { | ||
| const integration = await queryGithubIntegration(segmentId, config.apiUrl, config.apiToken) | ||
| const input = { owner, repo, repoUrl, segmentId } | ||
| if (integration) { | ||
| await addRepoToGithubIntegration(input, integration, config) | ||
| } else { | ||
| await createGithubIntegration(input, config) |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0045aca. Configure here.
|
Review fixes in 04b6de5:
|
…1841) Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
…rls (CM-1841) Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
04b6de5 to
e9e4071
Compare
…thub integration (CM-1841) Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
|
Addressed the mapping comment: |


Summary
PR 7 of the onboarding-core plan (CM-1841). The automatic onboarding worker now runs the
proposedActionthe evaluation worker stored on theprojectCatalogrow instead of always creating a non-LF segment.create_segment(andnull, rows routed before the classification columns existed): unchanged,onboardProjectcreates the non-LF segment underlf-oss-indexand its GitHub integration.create_integration/update_integration: the worker resolves the CDP segment frompccProjectId(createCdpSegmentLookup) and calls the newconnectRepoToSegment, which queries the segment'sgithub-nangointegration and either creates it or adds the repo to it.human_review: never onboarded, the row ends inerrorwith an explicit reason. Same for a missingpccProjectId, no / duplicate CDP segments, or a legacygithub(v1) integration on the segment.Why one
connectRepoToSegmentinstead of two functionsThe plan listed
createIntegrationOnSegmentandupdateNangoIntegration. Two things in the backend made a single live-state function safer:POST /github-nango-connectwithintegrationIdreplacessettings.orgsandmapUnifiedRepositoriessoft-deletes every repo of the integration that is missing from the mapping (backend/src/services/integrationService.ts). The library therefore reads the existing integration (/integration/query, which hydratesorgs[].reposfrom the repositories table) and sends back the existing orgs and repos merged with the new one (mergeGithubOrgSettings). The backend is untouched: the UI relies on the replace semantics.createOrUpdatereuses an existing integration of the same platform on the segment, so a blind "create" on a segment that already has one would have replaced it. Deciding create vs update from the live state also covers two rows of the same project in one run (first creates, second updates).Not in scope
/crowd onboard-project, Force onboarding and the public onboarding API keep callingonboardProjectas before.Test plan
onboarder.test.ts: org merge, payload mapping,connectRepoToSegmentcreate / update / error pathsproposedAction.test.ts: dispatch perproposedAction, every error branchpnpm lint --deny-warnings,pnpm format,pnpm tsc-checkreviewrow approved for an LF project with an existing nango integration keeps its other repos after the run🤖 Generated with Claude Code