Skip to content

feat: decide a github organization request once, with one question, one card and one status line (lfx-cdp-insights-ops#817) - #5015

Merged
ulemons merged 8 commits into
mainfrom
feat/issue-817-one-decision-per-org
Oct 19, 2026
Merged

ulemons merged 8 commits into
mainfrom
feat/issue-817-one-decision-per-org

Conversation

@ulemons

@ulemons ulemons commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Second of three PRs for #817. An organization request (#5014) is now handled as one decision instead of one per repository: the rows of the organization are classified together, get one question or one review card, and a reviewer's click decides all of them. The onboarding of the whole list in one integration call, with the cap raised, comes in the third PR.

  • Rows know their organization. The ingest stores requestHints.organization = <owner> on every row expanded from an organization link (no migration, hints are already JSONB). organizationSiblings / organizationGroupKey (@crowd/project-onboarding) group rows by origin message and owner.
  • One classification per organization. classifyAndRouteProjects classifies the first row of a group and reuses the result for its siblings: one parser call and one PCC/CDP lookup instead of N.
  • New non-LF organizations go to the CDP team by hand. create_segment on an organization would create one project per repository (the project name derives from the repository), so until the third PR the group is routed to review with proposedAction = human_review and the reason " isn't in LFX Insights yet; a new non-LF project with the N repositories of github.com/ is created by the CDP team". New review case new_project_by_hand: "Not in LFX Insights yet · Create as a non-LF project in CDP with these repositories by hand, then mark as done". No LLM evaluation runs for these rows.
  • One question per organization. askRequester posts the question once for the lead row and stamps the same message ts on the siblings; the answer command answers every sibling of that message and re-runs the check for all of them. The question reads "❓ github.com/ (N repositories): …".
  • One review card per organization. notifyReviewRequest posts a single card for the group ("github.com/ · N repositories", buttons "Add N repos to " / "Connect GitHub and add N repos", confirm texts with the count) and stamps its ts on all rows. Approve, Reject and Mark as done resolve the lead and every sibling that shares the card; Approve starts one onboardProjects run with all the ids (each row still runs its own create_integration / update_integration, which is safe because the integration is created once and then extended). The card closure after onboarding and the refused-click refresh keep the organization heading.
  • One status line per organization. The living status message folds the group into "👀 github.com/ · N repositories · with the CDP team: " (or a count summary when the rows differ), and the thread replies speak of the organization ("… (N repositories) weren't added", "were added by hand").
  • Also carries the Slack-formatting fix for organization links that was pushed to feat: onboard the public repositories of a github organization from one bot request (lfx-cdp-insights-ops#817) #5014 after its merge.

Still per repository in this PR: the onboardProjects run approves N rows one by one, and the cap stays at 20 repositories.

Refs linuxfoundation/lfx-cdp-insights-ops#817

Test plan

  • pnpm tsc-check, pnpm lint --deny-warnings
  • Unit tests: group helpers, shared classification and by-hand routing, organization card and decision message, grouped question and answer, grouped review decision with one onboarding run, status line, thread replies, ingest hints (557 tests across project-onboarding, slack, both workers and the backend Slack services)
  • Prod, after deploying api, projects-evaluation-worker and automatic-onboarding-worker (no evaluateProjects run in flight):
    • onboard OpenDataPlane, LF project, https://github.com/opendataplane/ → one status line "github.com/opendataplane · 5 repositories · with the CDP team: …", one card with the count, Reject closes all five rows and one thread reply
    • an organization of an LF project already in LFX Insights with a modern GitHub connection → one "Add N repos to " card; Approve starts one onboarding run for all rows and the card closes with the organization heading
    • an organization with an unknown name → one question "❓ github.com/ (N repositories): …"; one answer re-runs all rows

🤖 Generated with Claude Code

…h the parser answer

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
…ne card and one status line

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 08:46
@ulemons ulemons self-assigned this Oct 19, 2026
@cursor

cursor Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core project-catalog classification, Slack interactions, and Temporal onboarding/evaluation workflows with multi-row DB transactions; incorrect grouping could mis-route or bulk-approve repositories.

Overview
GitHub organization onboarding is treated as one request across all expanded repos instead of per-repository flows.

Catalog rows get requestHints.organization at ingest (and on provenance promotion for already-catalogued repos). New organizationGroup helpers group siblings by Slack thread + owner and drive shared classification (one classify call per org, with per-repo exceptions for already-tracked repos), one Slack question (shared messageTs, one answer updates all matching siblings in a transaction), one review card (approve/reject/mark-done resolves siblings; one onboardProjects / evaluateProjects run with multiple catalogIds), and folded status/thread copy (*github.com/<owner>* (N repositories)).

New non-LF multi-repo orgs are routed to human_review (new_project_by_hand) until true multi-repo project creation exists. Evaluation batching withWholeOrganizations keeps org batches intact; review cards close only when all org members settle, with partial onboard counts on closure.

Also fixes Slack-wrapped GitHub org links in parsing (stripSlackFormatting) and org extraction in githubRepoUrl.

Reviewed by Cursor Bugbot for commit be49996. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Copilot AI left a comment

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.

🟡 Changes recommended

Group consistency, failure recovery, and outcome reporting have unresolved correctness issues.

8 open issues
What changed in this PR

This PR extends organization-link onboarding so CDP handles each GitHub organization request as one grouped decision, while retaining per-repository onboarding and the 20-repository cap.

Changes:

  • Stores organization hints and reuses classification across sibling repositories.
  • Groups Slack questions, review cards, decisions, and status messages.
  • Routes new non-LF organization projects to manual review and adds regression tests.
File Description
services/​libs/​slack/​src/​reviewRequest.ts Adds organization headings and decision copy.
services/​libs/​slack/​src/​reviewRequest.test.ts Tests organization card formatting.
services/​libs/​project-onboarding/​src/​reviewCard.ts Supports organization cards and manual creation.
services/​libs/​project-onboarding/​src/​reviewCard.test.ts Tests card mapping and manual routing.
services/​libs/​project-onboarding/​src/​requestStatus.ts Groups organization status lines.
services/​libs/​project-onboarding/​src/​requestStatus.test.ts Tests grouped and mixed statuses.
services/​libs/​project-onboarding/​src/​requestQuestion.ts Adds organization question formatting.
services/​libs/​project-onboarding/​src/​requestQuestion.test.ts Tests grouped question text.
services/​libs/​project-onboarding/​src/​requestParser.ts Expands trailing-formatting removal.
services/​libs/​project-onboarding/​src/​requestParser.test.ts Tests Slack-formatted links.
services/​libs/​project-onboarding/​src/​organizationRequest.ts Reuses organization formatting helpers.
services/​libs/​project-onboarding/​src/​organizationGroup.ts Introduces grouping and sibling helpers.
services/​libs/​project-onboarding/​src/​organizationGroup.test.ts Tests group identity and lookup.
services/​libs/​project-onboarding/​src/​index.ts Exports organization helpers.
services/​libs/​project-onboarding/​src/​botThreadReply.ts Adds organization-aware replies.
services/​libs/​project-onboarding/​src/​botThreadReply.test.ts Tests grouped outcome replies.
services/​libs/​project-onboarding/​src/​botCopy.ts Adds manual project-creation copy.
services/​libs/​project-onboarding/​src/​botCopy.test.ts Tests the new review case.
services/​libs/​data-access-layer/​src/​project-catalog/​types.ts Adds organization request hints.
services/​libs/​data-access-layer/​src/​project-catalog/​projectCatalog.ts Persists hints during bulk insertion.
services/​apps/​projects_evaluation_worker/​src/​activities/​classifyAndRoute.ts Shares classification and routes manual creation.
services/​apps/​projects_evaluation_worker/​src/​activities/​classifyAndRoute.test.ts Tests shared classification and routing.
services/​apps/​projects_evaluation_worker/​src/​activities/​activities.ts Posts grouped questions and review cards.
services/​apps/​automatic_onboarding_worker/​src/​activities/​activities.ts Updates shared cards after onboarding.
backend/​src/​services/​slack/​reviewDecisionCommand.ts Applies decisions across card siblings.
backend/​src/​services/​slack/​reviewDecisionCommand.test.ts Tests grouped approval and workflow startup.
backend/​src/​services/​slack/​onboardingRequestBot.ts Associates ingested repositories with organizations.
backend/​src/​services/​slack/​onboardingRequestBot.test.ts Updates ingestion expectations.
backend/​src/​services/​slack/​onboardingRequestBot.run.test.ts Verifies organization hints during ingestion.
backend/​src/​services/​slack/​answerRequestCommand.ts Applies answers across question siblings.
backend/​src/​services/​slack/​answerRequestCommand.test.ts Tests grouped answers and evaluation startup.

Review effort: Balanced

Comment thread backend/src/services/slack/answerRequestCommand.ts Outdated
Comment thread backend/src/services/slack/reviewDecisionCommand.ts Outdated
Comment thread services/apps/projects_evaluation_worker/src/activities/activities.ts Outdated
Comment thread services/apps/projects_evaluation_worker/src/activities/classifyAndRoute.ts Outdated
Comment thread backend/src/services/slack/onboardingRequestBot.ts
Comment thread services/apps/automatic_onboarding_worker/src/activities/activities.ts Outdated
Comment thread services/libs/project-onboarding/src/requestParser.ts Outdated
… repo and lock whole groups

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 09:50

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread services/apps/automatic_onboarding_worker/src/activities/activities.ts Outdated

Copilot AI left a comment

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.

Comment thread services/apps/projects_evaluation_worker/src/activities/classifyAndRoute.ts Outdated
Comment thread services/apps/automatic_onboarding_worker/src/activities/activities.ts Outdated
Comment thread services/apps/projects_evaluation_worker/src/activities/classifyAndRoute.ts Outdated
…rsisted classifications

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:26

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread services/apps/automatic_onboarding_worker/src/activities/activities.ts Outdated

Copilot AI left a comment

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.

🟡 Changes recommended

Singleton organization failures can display successful completion, and repeated organization lookups lack a supporting database index.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Add index on projectCatalog.sourceUrl

services/​libs/​project-onboarding/​src/​organizationGroup.ts:69

Organization processing now repeatedly calls this lookup during batch expansion, question/card posting, decisions, and card closure. findProjectCatalogBySourceUrl filters on projectCatalog.sourceUrl (projectCatalog.ts:101), but the migrations provide no index on that column. Each lookup therefore scans the catalog for a small request group. Add a migration indexing projectCatalog.sourceUrl to avoid repeated full-table scans as the catalog grows.

4 resolved since last review

Review effort: Balanced

Comment thread services/apps/automatic_onboarding_worker/src/activities/activities.ts Outdated
…lings on a posted card only

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:44

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 d0766e0. Configure here.

Comment thread services/apps/projects_evaluation_worker/src/activities/classifyAndRoute.ts Outdated
…ion still waiting

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>

Copilot AI left a comment

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.

🟡 Changes recommended

Repository links can trigger organization-wide expansion, and answered groups unnecessarily repeat classification.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Exclude repository URLs before stripping trailing formatting underscores

services/​libs/​common/​src/​githubRepoUrl.ts:177

Removing trailing underscores before checking the URL shape turns a repository link such as https://github.com/acme/_ into https://github.com/acme/. When the request parser is unavailable, this incorrectly expands the entire organization instead of just the requested repository, or rejects the request because the organization exceeds the cap. Exclude repository URLs before stripping unmatched formatting underscores.

1 resolved since last review

Review effort: Balanced

Comment thread services/apps/projects_evaluation_worker/src/activities/classifyAndRoute.ts Outdated
Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:50

Copilot AI left a comment

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.

🔵 Needs a closer look

Stale classifications during adoption need correction, and the cross-worker grouping lifecycle requires human validation.

1 open issue
1 resolved since last review

Review effort: Balanced

…ever expand a repo link

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 11:16

Copilot AI left a comment

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.

🔵 Needs a closer look

Cross-worker shared decisions need human validation, particularly with an unresolved mismatch between grouped review targets.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread services/libs/project-onboarding/src/organizationGroup.ts Outdated
… same pcc project

Refs linuxfoundation/lfx-cdp-insights-ops#817

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 12:43

Copilot AI left a comment

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.

🔵 Needs a closer look

Cross-service grouped transitions need human validation, and two correctness findings remain unresolved.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread services/libs/common/src/githubRepoUrl.ts
Comment thread services/libs/project-onboarding/src/botCopy.ts
Copilot AI balanced review requested due to automatic review settings October 19, 2026 12:51

Copilot AI left a comment

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.

🟡 Changes recommended

Concurrent classification and notification can still split an organization into separate messages and partial decisions.

1 open issue
2 resolved since last review

Review effort: Balanced

@ulemons
ulemons merged commit 29a148a into main Oct 19, 2026
16 of 17 checks passed
@ulemons
ulemons deleted the feat/issue-817-one-decision-per-org branch October 19, 2026 13:11
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