Skip to content

fix: prevent invalid member organization date ranges (DE-931)#4065

Open
skwowet wants to merge 6 commits intomainfrom
bugfix/DE-931
Open

fix: prevent invalid member organization date ranges (DE-931)#4065
skwowet wants to merge 6 commits intomainfrom
bugfix/DE-931

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented Apr 28, 2026

Summary

  • Add a shared helper to sanitize/validate member organization date ranges.
  • Sanitize enrichment work experience dates before persistence.
  • Validate work experience date ranges at API/service boundaries, including partial updates.

Note

Medium Risk
Touches multiple write paths (public API, core member-org service, enrichment worker) and changes date nullability/validation behavior, which could affect existing clients and deduplication/unique-conflict behavior if assumptions about date formats differ.

Overview
Prevents invalid member work-experience date ranges from being persisted by introducing a shared sanitizeMemberOrganizationDateRange helper and wiring it into create/update flows.

Public work-experience create/update endpoints now validate/sanitize startDate/endDate and return 400 BadRequest on invalid ranges, and the member org service layer applies the same validation (including for partial updates) while recalculating affiliations for both the old and new org when the org changes.

The enrichment worker now normalizes incoming work-experience dates (invalid ranges become null), updates enrichment organization types to allow null dates, and related types/data-access code are adjusted to accept nullable dateStart/dateEnd plus a new fetchMemberOrganizationById helper for safer updates.

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

skwowet added 2 commits April 29, 2026 01:20
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Apr 28, 2026
Copilot AI review requested due to automatic review settings April 28, 2026 20:20
@skwowet skwowet marked this pull request as ready for review April 29, 2026 07:35
Comment thread services/libs/common/src/member.ts
skwowet added 2 commits April 29, 2026 14:40
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit 01b646b. Configure here.

Comment thread backend/src/services/member/memberOrganizationsService.ts
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
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.

1 participant