Skip to content

fix: member attributes should have non empty values and a filled default#3449

Open
themarolt wants to merge 25 commits intomainfrom
member-attribute-fix-CM-705
Open

fix: member attributes should have non empty values and a filled default#3449
themarolt wants to merge 25 commits intomainfrom
member-attribute-fix-CM-705

Conversation

@themarolt
Copy link
Contributor

@themarolt themarolt commented Oct 4, 2025

Changes proposed ✍️

What

copilot:summary

copilot:poem

Why

How

copilot:walkthrough

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screenshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

Note

Medium Risk
Introduces a batch script that directly updates members.attributes in production and changes how attribute defaults are derived, which could affect large numbers of records if the selection/merge logic is wrong.

Overview
Fixes member attribute normalization so default values are only derived from non-empty per-platform values; attributes with no non-empty platform values are removed.

Adds a new fix-member-attributes worker script to backfill existing members whose attributes have empty default values despite having non-empty platform values, while preserving manually changed attribute keys and updating members in batches.

Tightens types and call signatures around member creation/updating by consistently passing PlatformType into MemberService/MemberAttributeService.validateAttributes (instead of a generic source string).

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

@themarolt themarolt requested a review from skwowet October 4, 2025 17:22
skwowet
skwowet previously approved these changes Oct 8, 2025
@joanagmaia
Copy link
Contributor

Hey @themarolt @skwowet. Shouldn't this be merged? If it was done 3 months ago, maybe the work has already been overridden? Or is this not needed anymore?

@skwowet
Copy link
Collaborator

skwowet commented Jan 14, 2026

@joanagmaia this should be merged, if I’m not mistaken.

I think it came from one of the support tickets (trying to remember which one..)

@joanagmaia
Copy link
Contributor

@themarolt pinging once again on this one, should this be merged or closed?

@themarolt
Copy link
Contributor Author

@themarolt pinging once again on this one, should this be merged or closed?

Oh damn - I totally forgot about this one - let me merge main and check if this is still relevant.

Copilot AI review requested due to automatic review settings March 23, 2026 20:46
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
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 aims to ensure member attribute “default” values are derived from a non-empty platform value (based on platform priority), and adjusts the data sink worker to pass PlatformType through the member/attribute validation pipeline. It also adds a one-off script to backfill/fix existing members with missing attribute defaults.

Changes:

  • Update shared setAttributesDefaultValues logic to ignore empty/blank platform values when choosing the default.
  • Reorder/propagate PlatformType through MemberAttributeService.validateAttributes and MemberService create/update flows.
  • Add a fix-member-attributes.ts script to patch existing DB records with empty default attribute values.

Reviewed changes

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

Show a summary per file
File Description
services/libs/common/src/member.ts Filters attribute platforms to non-empty values before selecting the default.
services/apps/data_sink_worker/src/service/memberAttribute.service.ts Reorders validateAttributes params to accept platform first.
services/apps/data_sink_worker/src/service/member.service.ts Changes create/update signatures and call sites to use PlatformType (instead of source: string).
services/apps/data_sink_worker/src/service/activity.service.ts Updates member creation call to satisfy new PlatformType signature (currently via cast).
services/apps/data_sink_worker/src/bin/fix-member-attributes.ts New batch script to find and fix members with empty attribute defaults.

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

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

1 similar comment
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

…utes

Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
Signed-off-by: Uroš Marolt <uros@marolt.me>
@themarolt themarolt force-pushed the member-attribute-fix-CM-705 branch from c65b63c to b444f81 Compare March 23, 2026 21:13
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

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.

Signed-off-by: Uroš Marolt <uros@marolt.me>
@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@github-actions
Copy link
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

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