Skip to content

Conversation

@themarolt
Copy link
Contributor

@themarolt themarolt commented Dec 15, 2025

Note

Adds Temporal workflows for leaf→project/group aggregate rollups, optimizes segment aggregate tables and drops indexed_entities, and simplifies search sync to direct OpenSearch updates.

  • Database:
    • Replace surrogate PKs with composite PKs on memberSegmentsAgg and organizationSegmentsAgg (segmentId, memberId|organizationId), add supporting indexes, and drop redundant ones.
    • Drop indexed_entities table.
  • Profiles Worker (Temporal):
    • Add leaf-segment aggregate calculators (activities/workflows) and schedules (every 5 min for leaf; every 10 min rollups) guarded by IS_DEV_ENV.
    • New rollup workflows to aggregate from subprojects to project and project-group segments using child workflows and segment hierarchy.
  • Data Access Layer:
    • Upsert behavior for insertMemberSegmentAggregates and new batch rollup functions: calculateMemberAggregatesForSegment, calculateOrganizationAggregatesForSegment.
    • Add test-only leaf aggregate calculators from activityRelations and getSegmentHierarchy utilities.
  • Search Sync (API/Worker/Lib):
    • Remove legacy indexing repo/indexed_entities usage and "withAggs" options; services now sync entities directly to OpenSearch.
    • Update routes, queue handlers, and CLI to new simplified sync signatures.
  • Script Executor Worker:
    • Remove batch sync utilities; add single syncMember activity and update bot-affiliation fix workflow to use it.
  • Tooling:
    • Add trigger-job:local script to cron_service.

Written by Cursor Bugbot for commit 26aa942. This will update automatically on new commits. Configure here.

@themarolt themarolt marked this pull request as ready for review December 15, 2025 10:42
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@themarolt themarolt requested a review from skwowet December 15, 2025 10:54
Copy link
Member

@skwowet skwowet left a comment

Choose a reason for hiding this comment

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

Overall, lgtm. Left a few minor comments/nitpicks.

@themarolt themarolt merged commit fd562fe into main Dec 18, 2025
15 checks passed
@themarolt themarolt deleted the optimize-aggregates-CM-750 branch December 18, 2025 19:16
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.

3 participants