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

ref(backup): Do deepcopy before validation #53346

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

azaslavsky
Copy link
Contributor

Previously, all validation mutated the inputs in-place. This was performant (no need to make deep copies of two potentially large JSON blobs), but potentially bug prone if not held carefully, since the validation itself mutated the inputs via JSONScrubbingComparators. This means that the post-comparison input objects MUST NOT be re-used, since they are meaningfully different from the inputs that were declared valid.

Instead, we now do deepcopies under the hood, leaving the originally passed-in inputs untouched.

Issue: getsentry/team-ospo#156

Previously, all validation mutated the inputs in-place. This was
performant (no need to make deep copies of two potentially large JSON
blobs), but potentially bug prone if not held carefully, since the
validation itself mutated the inputs via JSONScrubbingComparators. This
means that the post-comparison input objects MUST NOT be re-used, since
they are meaningfully different from the inputs that were declared
valid.

Instead, we now do deepcopies under the hood, leaving the originally
passed-in inputs untouched.

Issue: getsentry/team-ospo#156
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 21, 2023
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #53346 (23b89ec) into master (3c5159d) will decrease coverage by 3.21%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #53346      +/-   ##
==========================================
- Coverage   79.53%   76.33%   -3.21%     
==========================================
  Files        4939     4912      -27     
  Lines      208100   207759     -341     
  Branches    35479    35436      -43     
==========================================
- Hits       165513   158586    -6927     
- Misses      37553    44028    +6475     
- Partials     5034     5145     +111     

see 489 files with indirect coverage changes

@azaslavsky azaslavsky merged commit 4c71260 into master Jul 21, 2023
@azaslavsky azaslavsky deleted the azaslavsky/backup/in_place2 branch July 21, 2023 17:10
armenzg pushed a commit that referenced this pull request Jul 24, 2023
Previously, all validation mutated the inputs in-place. This was
performant (no need to make deep copies of two potentially large JSON
blobs), but potentially bug prone if not held carefully, since the
validation itself mutated the inputs via JSONScrubbingComparators. This
means that the post-comparison input objects MUST NOT be re-used, since
they are meaningfully different from the inputs that were declared
valid.

Instead, we now do deepcopies under the hood, leaving the originally
passed-in inputs untouched.

Issue: getsentry/team-ospo#156
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants