Skip to content

AB#125619: Issue with automatic assignment deletion - #1265

Open
Joselgc1 wants to merge 1 commit into
nextfrom
AB#125619
Open

AB#125619: Issue with automatic assignment deletion#1265
Joselgc1 wants to merge 1 commit into
nextfrom
AB#125619

Conversation

@Joselgc1

@Joselgc1 Joselgc1 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Automatic assignment rules could appear deleted in the UI but reappear after navigating away and back.

The reason was that the frontend query-builder includes a transient inTheLast property in the deletion payload, while existing MongoDB rules may not contain it. Because MongoDB $pull requires an exact embedded-document match, the rule was not actually removed.

The backend now normalizes automatic-assignment rules before comparison, locates the matching stored rule, and removes that exact stored document. New rules are also normalized before persistence to prevent transient UI state from being stored. Also, automatically assigned users are derived from active rules, so once the rule is removed, users matching only that rule are no longer automatically assigned.

Useful links

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Added an integration test that persists an automatic-assignment rule without inTheLast, sends a deletion request containing the transient property, and verifies the rule is removed.
  • Ran linting and a TypeScript production build.

Commands run:

npx eslint src/schema/mutation/editRole.mutation.ts
npx eslint --no-ignore tests/unit-tests/schema/mutation/editRole.mutation.spec.ts
npm test -- --runInBand tests/unit-tests/schema/mutation/editRole.mutation.spec.ts
npm run build

Manual verification:

  1. Open Back Office and navigate to an application’s Roles page.
  2. Open a role, such as Guest.
  3. Go to Automatic assignment.
  4. Delete one rule while retaining another.
  5. Navigate to a different role, then return to the original role.
  6. Confirm the deleted rule does not reappear.
  7. Confirm users matching only the deleted rule are no longer automatically assigned to the role.

Screenshots

Not applicable. This is a backend-only fix with no visual changes.

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-backend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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