Skip to content

feat: resolveproject group in the segments middleware (CM-189)#4011

Merged
ulemons merged 34 commits intomainfrom
feat/standardize-segments-api
Apr 24, 2026
Merged

feat: resolveproject group in the segments middleware (CM-189)#4011
ulemons merged 34 commits intomainfrom
feat/standardize-segments-api

Conversation

@ulemons
Copy link
Copy Markdown
Contributor

@ulemons ulemons commented Apr 9, 2026

Note

Medium Risk
Changes request segment scoping by allowing project group/project IDs to be expanded to leaf subprojects server-side, which can affect data visibility and query results across many endpoints. Also adjusts activity querying and Tinybird parameter handling, with moderate risk of pagination/count discrepancies if segment expansion/capping is incorrect.

Overview
Segments handling is centralized in the backend. segmentMiddleware now ignores req.params, safely parses segments from query/body, and resolves any non-leaf segment IDs (project group/project) into their active leaf subprojects before setting currentSegments.

Frontend requests are simplified to pass project-group IDs. Multiple views (activity timeline, member/org lists, banners, filters, and the Axios interceptor) stop expanding project groups into subproject IDs client-side and instead send [selectedProjectGroup.id], relying on the middleware for expansion; the activity timeline also guards invalid joinedAt timestamps and can send an empty segments array.

Activity/Tinybird querying is hardened. The activities SQL path switches the count call to pipeSql, Tinybird activity params now cap the segments array (with a warning) to avoid Tinybird 400s on large groups, and Tinybird client logs non-retriable error details; noisy advanced-query cache info logs were removed for members/orgs background refreshes.

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

@ulemons ulemons self-assigned this Apr 9, 2026
@ulemons ulemons added the Feature Created by Linear-GitHub Sync label Apr 9, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 9, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread backend/src/middlewares/segmentMiddleware.ts Fixed
Copilot AI review requested due to automatic review settings April 17, 2026 07:20
@ulemons ulemons marked this pull request as ready for review April 17, 2026 07:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates segment scoping so the frontend can send project group (non-leaf) segment IDs, and the backend middleware will resolve them into leaf sub-project segments for downstream queries.

Changes:

  • Backend: enhance segmentMiddleware to expand non-leaf segment IDs into active leaf sub-project segments.
  • Frontend: stop expanding project groups into subproject segments in a few call sites and instead pass [projectGroup.id].
  • Frontend: adjust organization merge suggestions calls to use the selected project group ID.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/src/modules/organization/services/organization.api.service.ts Uses selected project group ID(s) for merge suggestions / create payloads.
frontend/src/modules/organization/organization-service.js Sends only selected project group ID for merge suggestions.
frontend/src/modules/lf/layout/components/lf-banners.vue Integration listing now scoped by [projectGroup.id].
frontend/src/modules/activity/components/activity-timeline.vue Activity query now scoped by selected project group ID when no explicit segment is selected.
backend/src/middlewares/segmentMiddleware.ts Resolves provided segment IDs to leaf sub-project segments before attaching req.currentSegments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/modules/activity/components/activity-timeline.vue Outdated
Comment thread backend/src/middlewares/segmentMiddleware.ts Outdated
Comment thread backend/src/middlewares/segmentMiddleware.ts Outdated
Comment thread frontend/src/modules/organization/organization-service.js Outdated
Comment thread frontend/src/modules/activity/components/activity-timeline.vue Outdated
@ulemons ulemons force-pushed the feat/standardize-segments-api branch from 765829e to 9d33a06 Compare April 17, 2026 09:32
Copilot AI review requested due to automatic review settings April 17, 2026 09:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/libs/data-access-layer/src/collections/index.ts
Comment thread backend/src/middlewares/segmentMiddleware.ts
Copilot AI review requested due to automatic review settings April 17, 2026 09:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/src/middlewares/segmentMiddleware.ts Outdated
Comment thread backend/src/middlewares/segmentMiddleware.ts
Comment thread frontend/src/modules/organization/organization-service.js Outdated
Comment thread backend/src/middlewares/segmentMiddleware.ts
@ulemons ulemons force-pushed the feat/standardize-segments-api branch from ee72d68 to 5faf875 Compare April 17, 2026 12:14
Copilot AI review requested due to automatic review settings April 17, 2026 12:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/src/middlewares/segmentMiddleware.ts
Comment thread backend/src/middlewares/segmentMiddleware.ts
Comment thread backend/src/middlewares/segmentMiddleware.ts Outdated
@ulemons ulemons force-pushed the feat/standardize-segments-api branch from 9a013b6 to e58e568 Compare April 17, 2026 13:03
Comment thread backend/src/middlewares/segmentMiddleware.ts
Copilot AI review requested due to automatic review settings April 17, 2026 14:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/src/middlewares/segmentMiddleware.ts
Comment thread backend/src/middlewares/segmentMiddleware.ts Outdated
Copilot AI review requested due to automatic review settings April 17, 2026 15:14
ulemons added 27 commits April 24, 2026 16:09
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons ulemons force-pushed the feat/standardize-segments-api branch from 22ad67d to 2ded93e Compare April 24, 2026 14:09
@ulemons ulemons merged commit 574713f into main Apr 24, 2026
16 checks passed
@ulemons ulemons deleted the feat/standardize-segments-api branch April 24, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants