-
Notifications
You must be signed in to change notification settings - Fork 25
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
Never match existing asset-* entities when patch-existing=false #1395
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brookeswanson
approved these changes
Dec 8, 2023
egierach
approved these changes
Dec 8, 2023
marioaquino
approved these changes
Dec 8, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. The patch-existing
true case is covered by other tests.
@marioaquino yes, but they were created with the wrong assumptions (see PR description). I will need to review them ASAP. This case is just more urgent since no-one is patching yet. |
ISPHOST
pushed a commit
that referenced
this pull request
Dec 11, 2023
<!-- Specify linked issues and REMOVE THE UNUSED LINES --> This is the first of two fixes to this area of code. There are two modes for `POST /bundle/import`: `patch-existing={true,false}`. If true, then existing entities are supposed to be detected and patched. There is a bug where `asset_mappings` and `asset_properties` are erroneously mapped onto existing assets and essentially get merged when they should be created fresh. This PR fixes this behavior for `patch-existing=false`, since no-one is using `patch-existing=true` yet and everyone is using `patch-existing=false`. The merging code was made on the faulty assumption that there can only be one asset_mapping / asset_properties per asset. There is a red test that is fixed by commit [Revert "Revert "green""](79f4978). The previous commit fails with the wrong number of results: ``` FAIL in ctia.bundle.routes-test/ (bundle-asset-relationships-test) (routes_test.clj:1504) es-store relationships are created for asset mappings/properties ... expected: (= 4 (count (filter (comp #{"created"} :result) create-results2))) actual: (not (= 4 2)) FAIL in ctia.bundle.routes-test/ (bundle-asset-relationships-test) (routes_test.clj:1506) es-store relationships are created for asset mappings/properties ... expected: (= 1 (count (filter (comp #{"exists"} :result) create-results2))) actual: (not (= 1 3)) ``` <!-- Describe your PR for reviewers. Don't forget to set correct labels (User Facing / Beta / Feature Flag) If there is UI change please add a screen capture. --> <!-- UNCOMMENT THIS SECTION IF NEEDED <a name="iroh-services-clients">[§](#iroh-services-clients)</a> IROH Services Clients ===================================================================================== Put all informations that need to be communicated to IROH Services Clients. Typically IROH-UI, ATS Integration, Orbital, etc... --> <a name="qa">[§](#qa)</a> QA ============================ <!-- Describe the steps to test your PR. 1. 2. 3. Or if no QA is needed keep it as is. --> No QA is needed. <!-- UNCOMMENT THIS SECTION IF NEEDED <a name="ops">[§](#ops)</a> Ops =============================== Specify Ops related issues and documentation - Config change needed: threatgrid/tenzin# - Migration needed: threatgrid/tenzin# - How to enable/disable that feature: (ex remove service from `bootstrap.cfg`, add scope to org) --> <!-- UNCOMMENT THIS SECTION IF NEEDED <a name="documentation">[§](#documentation)</a> Documentation ============================================================= Public Facing documentation section; - Public documentation updated needed: threatgrid/iroh-ui# See internal [doc file](./services/iroh-auth/doc/public-doc.org) --> <a name="release-notes">[§](#release-notes)</a> Release Notes ============================================================= <!-- REMOVE UNUSED LINES --> ``` intern: Never match existing asset-* entities when patch-existing=false ``` <a name="squashed-commits">[§](#squashed-commits)</a> Squashed Commits ======================================================================
frenchy64
added a commit
that referenced
this pull request
Jan 10, 2024
Followup to #1395 We always want to create new asset properties and mappings entities, even if we're patching an existing asset. <!-- Describe your PR for reviewers. Don't forget to set correct labels (User Facing / Beta / Feature Flag) If there is UI change please add a screen capture. --> <!-- UNCOMMENT THIS SECTION IF NEEDED <a name="iroh-services-clients">[§](#iroh-services-clients)</a> IROH Services Clients ===================================================================================== Put all informations that need to be communicated to IROH Services Clients. Typically IROH-UI, ATS Integration, Orbital, etc... --> <a name="qa">[§](#qa)</a> QA ============================ <!-- Describe the steps to test your PR. 1. 2. 3. Or if no QA is needed keep it as is. --> No QA is needed. <!-- UNCOMMENT THIS SECTION IF NEEDED <a name="ops">[§](#ops)</a> Ops =============================== Specify Ops related issues and documentation - Config change needed: threatgrid/tenzin# - Migration needed: threatgrid/tenzin# - How to enable/disable that feature: (ex remove service from `bootstrap.cfg`, add scope to org) --> <!-- UNCOMMENT THIS SECTION IF NEEDED <a name="documentation">[§](#documentation)</a> Documentation ============================================================= Public Facing documentation section; - Public documentation updated needed: threatgrid/iroh-ui# See internal [doc file](./services/iroh-auth/doc/public-doc.org) --> <a name="release-notes">[§](#release-notes)</a> Release Notes ============================================================= <!-- REMOVE UNUSED LINES --> ``` intern: Remove asset properties/mapping merging ``` <a name="squashed-commits">[§](#squashed-commits)</a> Squashed Commits ======================================================================
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first of two fixes to this area of code.
There are two modes for
POST /bundle/import
:patch-existing={true,false}
. If true, then existing entities are supposed to be detected and patched.There is a bug where
asset_mappings
andasset_properties
are erroneously mapped onto existing assets and essentially get merged when they should be created fresh.This PR fixes this behavior for
patch-existing=false
, since no-one is usingpatch-existing=true
yet and everyone is usingpatch-existing=false
.The merging code was made on the faulty assumption that there can only be one asset_mapping / asset_properties per asset.
There is a red test that is fixed by commit Revert "Revert "green"". The previous commit fails with the wrong number of results:
§ QA
No QA is needed.
§ Release Notes
§ Squashed Commits