-
Notifications
You must be signed in to change notification settings - Fork 2
Consolidate path traversal #170
Conversation
Causes minor behavior changes (see new @MetafixToDo annotations) Contains comments sketching possible ways to consolidate, basically on two levels: 1) implement transform/insert/remove in terms of find (find does all path traversal, then the result is changed / deleted) 2) move hash / array methods for each operation into hash / array Short-term next step I'd look into: remove / unify InsertMode usage (hence the somewhat odd null / default InsertMode in `insertInto`)
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.
I'm sorry but there's just too much going on here. c25ede3 breaks our Limetrans workflow in a bunch of different ways (see below) and I'm officially giving up. Also, there seem to be only a few To Dos resolved, but more added. Not really the outcome we were hoping for, is it? (Integration test results as of 6d74bca: 3 fixed, 2 broken.)
So here are just some preliminary remarks and questions, this is not the final assessment.
Behaviour changes observed in Limetrans Alma mapping:
- It's unclear where they're coming from but we get
null
values in records now:Error while executing Fix expression [...]: vacuum()
, caused byjava.lang.IllegalStateException: Expected Array or Hash or String, got null
. uniq()
does not work anymore due to the inclusion ofpath
inValue.equals()
.lookup()
behaviour seems to have changed unexpectedly (see also Adddelete:
-Attribute to lookup and change the default filter-modus to an optional configuration #149).- Entity boundaries are violated (probably due to some error/change w.r.t.
$append
).
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Jens Wille <[email protected]>
Thank you for your review and for helping me make sense of all of this @blackwinter! I've pushed my current state, which addresses many of the issues you brought up. I'll continue with the remaining ones ( |
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.
Okay, thanks for the update.
metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java
Outdated
Show resolved
Hide resolved
...egration/lookup/fromJson/toJson/lookupSimpleWithInternalMapDeleteNotMatchingLiteral/todo.txt
Outdated
Show resolved
Hide resolved
...e/metafix/integration/record/fromJson/toJson/move_fieldAppendObjectToArrayOfObjects/todo.txt
Outdated
Show resolved
Hide resolved
Co-authored-by: Jens Wille <[email protected]>
metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java
Outdated
Show resolved
Hide resolved
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Jens Wille <[email protected]>
metafix/src/test/java/org/metafacture/metafix/MetafixLookupTest.java
Outdated
Show resolved
Hide resolved
The behaviour has changed and that should be reflected in the test: 0dfcfb8.
No, both |
metafix/src/test/java/org/metafacture/metafix/MetafixScriptTest.java
Outdated
Show resolved
Hide resolved
To reliably reject string operations on non-string fields
metafix/src/test/java/org/metafacture/metafix/MetafixMethodTest.java
Outdated
Show resolved
Hide resolved
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.
The moment of truth, huh? 😟 😨 😰
(@MetafixToDo
: 23 -> 29, todo.txt
: 86 -> 72)
\o/
But we fixed the regressions, these are additional tests. More tests (even failing) are good, no? Looking at passing tests, I'm very happy: 353 -> 401 (unit), 141 -> 155 (integration). |
Yes, I was just tying into the previous remarks from way back when this discussion started ;) |
…cture-fix#170) Differences in reference files: - Various (inconsequential) order changes.
…c42874) IOW, don't split field names received from metadata stream (`Metafix.addValue()`).
Found another regression after all :( Tests and (partial) fix in 1ecbcdf. |
…cture-fix#170) Differences in reference files: - Various (inconsequential) order changes.
…cture-fix#170) Differences in reference files: - Various (inconsequential) order changes.
This is my suggestion to fix #102.
Based on the already merged extraction of FixPath (#133), here are some high-level changes:
insertInto
usagefindIn
andinsertInto
to resolve the main issue of Consolidate path traversal. #102findIn
path does not work withinsertInto
(liketitle-?
orsome.*.nested.*
), use a newValue#path
field containing the full path to each value (created byMetafix#flattener
)This fixes some things that didn't work before (and changes the behavior for some things that did not work before and still don't work). See tests diff and issues mentioned in the commit messages.
I think this is an improvement over the current master state, and a good foundation for moving forward. Depending on the current, concrete requirements from our projects, this could be:
new FixPath(field, hash).get()
)