Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] dereference combine sources recursively #560

Merged
merged 5 commits into from
Oct 13, 2020

Conversation

BenoitZugmeyer
Copy link
Member

Motivation

Follow up of #551 (comment)
We figured that our combine implementation was not de-referencing all sub values. This could lead to unexpected behavior when some context is stored in an event to be pushed in the future (like: pre-init addUserAction or log) and a context sub-value is mutated in the meantime.

Changes

  • Change the deepMerge (and combine) implementation to always dereference their arguments
  • Introduce a deepClone function to explicitly dereference a value.

Testing

Some unit tests have been added


I have gone over the contributing documentation.

@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner October 12, 2020 17:13
@BenoitZugmeyer BenoitZugmeyer changed the title Benoit/deep clone [Core] dereference combine arguments recursively Oct 12, 2020
@BenoitZugmeyer BenoitZugmeyer changed the title [Core] dereference combine arguments recursively [Core] dereference combine sources recursively Oct 12, 2020
packages/core/test/utils.spec.ts Outdated Show resolved Hide resolved
packages/core/test/utils.spec.ts Outdated Show resolved Hide resolved
packages/core/test/utils.spec.ts Outdated Show resolved Hide resolved
packages/core/test/utils.spec.ts Show resolved Hide resolved
* rename a few tests
* test references with `.not.toBe`
@codecov-io
Copy link

Codecov Report

Merging #560 into master will increase coverage by 0.29%.
The diff coverage is 96.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #560      +/-   ##
==========================================
+ Coverage   88.23%   88.52%   +0.29%     
==========================================
  Files          39       39              
  Lines        2260     2275      +15     
  Branches      472      476       +4     
==========================================
+ Hits         1994     2014      +20     
+ Misses        266      261       -5     
Impacted Files Coverage Δ
packages/logs/src/logs.ts 74.19% <ø> (ø)
packages/rum/src/userActionCollection.ts 98.00% <ø> (ø)
packages/core/src/utils.ts 88.14% <95.83%> (+0.43%) ⬆️
packages/logs/src/logger.ts 95.91% <100.00%> (ø)
packages/rum/src/rum.entry.ts 94.00% <100.00%> (ø)
packages/rum/src/parentContexts.ts 98.24% <0.00%> (-1.76%) ⬇️
packages/rum/src/performanceCollection.ts 68.57% <0.00%> (+1.42%) ⬆️
packages/rum/src/rum.ts 82.19% <0.00%> (+4.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e78b6fe...1bb5d20. Read the comment docs.

@BenoitZugmeyer BenoitZugmeyer merged commit f8b36a6 into master Oct 13, 2020
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/deep-clone branch October 13, 2020 12:37
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.

3 participants