Skip to content

feat: plan the levels the backend creates with a new pcc group - #5406

Open
ulemons wants to merge 1 commit into
mainfrom
feat/issue-180-pcc-cascade-levels
Open

ulemons wants to merge 1 commit into
mainfrom
feat/issue-180-pcc-cascade-levels

Conversation

@ulemons

@ulemons ulemons commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

What

The creation plan now includes the project and the sub-project that the backend creates
together with a new project group, and checks them for conflicts.

Why

POST /segment/projectGroup creates the group, a project and a sub-project with the same name
and slug. For a standalone project the plan already had the three levels. For a new group that
has projects under it, the plan listed the group only, so:

  • the dry-run numbers were lower than what would be created;
  • a project or sub-project already holding the slug or name of the group was not detected,
    and the backend would reject the call later.

How

  • When the group is missing and the project is a different PCC project, planCreation adds the
    group's project and sub-project to the plan and runs the usual checks on them. A conflict
    blocks the plan with SLUG_OR_NAME_TAKEN.
  • buildCreationSteps needs no change: it already skips the levels a project group call
    creates.

Effect on production data

Checked against the dry run of 2026-11-20: 33 new groups have projects under them. None of
them has a conflict in segments or insightsProjects, so creatable (709) and blocked (48)
projects stay the same. Segments to create go from 1,419 to 1,485.

The only visible change after deploy is segmentsToCreate in the job log.

Tests

creationPlan.test.ts: one test updated, three added (project with the slug of a new group,
sub-project with its name, no block when the group already exists).

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

🤖 Generated with Claude Code

@ulemons ulemons self-assigned this Nov 20, 2026
Copilot AI balanced review requested due to automatic review settings November 20, 2026 16:01

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.

🟢 Approval recommended

No active review issues remain for the PCC sync creation-planning update.

No open issues 🎉

What changed in this PR

Updates PCC sync creation planning to account for the project and sub-project automatically created with a new project group, aligning dry-run counts and conflict checks with backend behavior.

Changes:

  • Include the group’s automatic child segments when planning a new group with a distinct PCC project.
  • Check those segments for slug or name conflicts without changing existing-group behavior.
  • Update expected segment counts and add regression tests for conflicts and existing groups.
File Description
services/​apps/​pcc_sync_worker/​src/​consumer/​creationPlan.ts Plans and checks the child segments automatically created with a new group.
services/​apps/​pcc_sync_worker/​src/​consumer/​creationPlan.test.ts Covers expanded plans, conflict detection, existing groups, and summary counts.

Review effort: Balanced

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

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons
ulemons force-pushed the feat/issue-180-pcc-cascade-levels branch from 189f7a5 to d3068f5 Compare November 23, 2026 16:13
@ulemons
ulemons marked this pull request as ready for review November 23, 2026 16:13
@ulemons
ulemons requested review from a team and lfx-one as code owners November 23, 2026 16:13
@ulemons
ulemons requested review from epipav and a balanced review from Copilot November 23, 2026 16:13
@cursor

cursor Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes PCC→CDP creation planning and conflict detection used for dry-run metrics and create gating; production create/blocked project counts are expected unchanged but segment counts in job logs will rise.

Overview
Creation planning for new PCC project groups now mirrors what the backend does on POST /segment/projectGroup: when the group is missing and the target project is not the same PCC node as the group, planCreation adds the companion project and sub-project (same name/slug as the group) to the planned segments and runs the usual slug/name conflict checks on those levels.

That fixes dry-run segmentsToCreate undercounting and catches SLUG_OR_NAME_TAKEN earlier—e.g. an existing project with the group’s slug or a sub-project with the group’s name now blocks the plan instead of failing only at create time. When the group already exists, a colliding project slug is still ignored as before.

Tests in creationPlan.test.ts reflect the expanded plans and the new block cases; summary counts now expect more projects/sub-projects to create.

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

@lfx-one

lfx-one commented Nov 23, 2026 •

Copy link
Copy Markdown

@ulemons I'm starting review 1 of this pull request now (started 2026-11-23 16:13 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.


Hi @ulemons, thanks for the clear write-up and the production dry-run numbers.

Summary

This change makes planCreation include the project and sub-project that the backend creates with a new project group. It also runs the usual slug and name conflict checks on them. The change is small and focused, and the tests cover the new behavior.

Decision

✅ Approved

Details

Overall impression: When the group is missing and the target project is a different PCC project, the plan adds the group's project and sub-project and blocks on SLUG_OR_NAME_TAKEN. I traced the effect on buildCreationSteps and it matches the PR description: it already skips the levels that a project group call creates, so it needs no change. When the group already exists, the new code does not run, so existing behavior is unchanged. The tests cover a slug conflict, a name conflict, an existing group, and the updated summary counts. I found no blocking, minor or nit issues. Copilot and Cursor Bugbot also found no issues, and I have nothing to add or dispute.

Other reviewers and CI checks: The required DCO check passed on d3068f5.

Rule files: read AGENTS.md; skipped none

Questions, problems, or feedback: https://github.com/linuxfoundation/lfx-review-agent/issues

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.

🟢 Approval recommended

No active review issues were identified for the PCC sync creation-plan changes.

No open issues 🎉

Review effort: Balanced

@lfx-one lfx-one 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.

Approved. The plan now includes the project and sub-project the backend creates with a new group, and conflicts on them block the plan with SLUG_OR_NAME_TAKEN. I found no blocking or minor issues. The required DCO check passed.

@gaspergrom gaspergrom 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.

Looks good to me, LGTM.

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.

4 participants