Project

General

Profile

Actions

Defect #3009

closed

Contract slice synchronization doesn't fill validTill inside slice

Added by Ondřej Kopr over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Roman Kučera
Category:
Synchronization
Target version:
Start date:
11/30/2021
Due date:
% Done:

100%

Estimated time:
Owner:

Description

Contract slice synchronization and inner slice behavior must process new slices and old one with process that fill valid till for contract slice:

One of our project has contract slice synchronization that execute all crud operation (important is delete).

When inside one sznchronization is processed create and delete for one exactly same contract slice tha valid till isn't filled and SelectCurrentContractSliceTaskExecutor every day process same two slices for one user.

Result of these operation is that one day is user valid and second one will be blocked including role remove.

This behavior was explored by transaction log and audit analyzing. We have more cases and more data for debug the process.

Simulation on clear product version is also very easy.
  1. create user contract-slice-test without contract,
  2. create contract slice synchronization from CSV is enough,
  3. set up reconciliation including HR process and all another,
  4. set up source data:
    id;identity;contract;valid-from-slice;valid-from;valid-till
    100;contract-slice-test;contract-one;2018-09-01;2018-09-01;2019-03-31
    200;contract-slice-test;contract-one;2019-04-01;2019-04-01;9999-12-31
    
  5. run synchronzation, after this run is everything OK,
  6. update source data
    id;identity;contract;valid-from-slice;valid-from;valid-till
    100;contract-slice-test;contract-one;2018-09-01;2018-09-01;2019-03-31
    300;contract-slice-test;contract-one;2019-04-01;2019-04-01;2022-01-31
    
  7. run synchronization.

After this run missing valid till appears :( like upper image.


Files

valid_till.png (8.28 KB) valid_till.png Ondřej Kopr, 11/30/2021 07:09 PM
missing_date.png (37.8 KB) missing_date.png Ondřej Kopr, 11/30/2021 07:09 PM
Actions #1

Updated by Ondřej Kopr over 2 years ago

Now doesn't exists simple workarround. Fix already existing issue is only about move date valid from on one of wrong created slices. Thats all.

Existing issues can be founded by sql (tested on local environment):

select * from idm_contract_slice s where s.valid_till is null and (select count(*) from idm_contract_slice s2 where s2.parent_contract_id = s.parent_contract_id and s2.valid_till is null) >= 2;

Actions #2

Updated by Ondřej Kopr over 2 years ago

  • Priority changed from High to Urgent

This issue probably appears after any reconciliation that execute contract slice delete.

It can't be solved by split reconciliation into two different transaction :(

Actions #3

Updated by Roman Kučera over 2 years ago

  • Assignee changed from Franta Vomáčka to Roman Kučera
Actions #4

Updated by Roman Kučera over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

After consultation with Ondra. I replicate this issue on my local env.
Tried simple fix in DefaultContractSliceManager and this specific use case seems OK now.
I need to rerun tests and do more tests to be sure.

Actions #5

Updated by Roman Kučera over 2 years ago

  • % Done changed from 10 to 40

Fix in branch https://github.com/bcvsolutions/CzechIdMng/tree/3009-contract-slice-valid-till
I run all tests in ContractSliceManagerTest without error.

@kopro if you want you can test it on your virtual env.

Actions #6

Updated by Roman Kučera over 2 years ago

I run all test in core-impl and it seems OK.
(Thera are 17 failed test but as it looks it has nothing to do with contract slice and the same test failed even before the fix on my local env)

Actions #7

Updated by Roman Kučera over 2 years ago

  • Affected versions 11.0.0, 11.1.0, 11.1.2, 11.1.1, 11.2.0, 11.2.1, 11.2.2, 11.2.3, 12.0.0 added
Actions #8

Updated by Roman Kučera over 2 years ago

  • % Done changed from 40 to 70
I'll test following cases (I'll update this note with additional one and with results):
  • new slice with different ID and same valid from, remove previous (this tiket) - OK
  • new slice with same ID and same valid from - OK
  • new slice from yesterday to different end date - OK
  • new slice in future - OK
  • change validity of current slice to past and add new slice for current date - OK
  • new slice in past - OK
  • deleting all slices except for one in past, add new current - OK
Actions #9

Updated by Roman Kučera over 2 years ago

  • Status changed from In Progress to Needs feedback
  • Assignee changed from Roman Kučera to Peter Štrunc
  • Target version set to 12.0.1
  • % Done changed from 70 to 90

I added test for this new use case.
Before fix -> fail
After fix -> success

Actions #10

Updated by Roman Kučera over 2 years ago

Build on CI where successful and sonar is OK to.

Actions #11

Updated by Peter Štrunc over 2 years ago

  • Status changed from Needs feedback to Resolved
  • % Done changed from 90 to 100

LGTM. thanks for the fix. Please just mention the fact, that we do not support having two concurrent contract slices starting at the same time, in the documentation.

Actions #12

Updated by Roman Kučera over 2 years ago

  • Status changed from Resolved to Closed

Released

Actions #13

Updated by Roman Kučera over 2 years ago

  • Assignee changed from Peter Štrunc to Roman Kučera
Actions

Also available in: Atom PDF