Repository navigation
fix: never let the 1970 placeholder win a member merge joinedAt - #5351
Conversation
Member merges kept the earlier joinedAt through getEarliestValidDate, which accepted an incoming 1970-01-01 placeholder (activities without a date, such as Slack channel members) and kept it as the earliest. The merge now uses the same rule as data-sink-worker, moved to @crowd/common_services as getEarliestMemberJoinedAt, and getEarliestValidDate is removed. Closes linuxfoundation/lfx-cdp-insights-ops#966 Signed-off-by: Uroš Marolt <uros@marolt.me>
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 23b0c77. Bugbot is set up for automated code reviews on this repo. Configure here. |
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryThe PR shares
Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the joined-date merge changes.
No open issues 🎉
What changed in this PR
This PR prevents epoch-placeholder dates from replacing a real member joinedAt during merges, aligning shared merge behavior with the data-sink worker.
Changes:
- Moves the existing joined-date helper unchanged into
@crowd/common_services. - Uses the helper during member merges, converting inputs to
Dateto support string values. - Updates worker imports and removes the obsolete
getEarliestValidDatehelper.
| File | Description |
|---|---|
services/libs/common/src/timing.ts |
Removes the obsolete date helper and its Moment import. |
services/libs/common_services/src/services/common.member.service.ts |
Hosts the shared helper and applies it to merged joinedAt values. |
services/apps/data_sink_worker/src/service/member.service.ts |
Imports the shared helper instead of defining it locally. |
services/apps/data_sink_worker/src/service/activity.service.ts |
Imports the helper from @crowd/common_services. |
Review effort: Balanced
…joinedat-placeholder Signed-off-by: Uroš Marolt <uros@marolt.me>
Summary
Merging two members could set the survivor's
joinedAtto1970-01-01, the placeholder integrations use for activities without a date (for example Slack channel members).membersMergekept the earlier date throughgetEarliestValidDate, which skipped an old placeholder but accepted an incoming one and kept it as the earliest. The merge now uses the rule data-sink-worker already uses (#5157): a date within five days of the epoch, or an invalid one, never wins.Changes
getEarliestMemberJoinedAtmoves fromdata_sink_worker/src/service/member.service.tsto@crowd/common_services(common.member.service.ts) unchanged.CommonMemberService.membersMergeuses it forjoinedAt. Values are wrapped inDate, because the backend passes strings.member.service.tsandactivity.service.tsimport it from@crowd/common_services.getEarliestValidDateis removed from@crowd/common; nothing else used it.Checked by calling
membersMergewith:Deploy: data-sink-worker plus the services that merge members through
CommonMemberService(backendapi, entity-merging-worker, and the other workers that use@crowd/common_services).Type of change
Related issue
Closes linuxfoundation/lfx-cdp-insights-ops#966