-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve dependency resolution, XPath static analysis; support current()
in computations, repeat-based itemsets, relative body references
#166
Improve dependency resolution, XPath static analysis; support current()
in computations, repeat-based itemsets, relative body references
#166
Commits on Jul 22, 2024
-
Warn on missing repeats, add explicit creation when missing
Followup from [this discussion](#150 (comment)) The idea here is: 1. Explicit repeat creation in tests will improve test clarity 2. Introduce a clear way to make similar changes in JavaRosa as they come up 3. Detect missing repeats (with a still naive approach[^1], albeit now recursive) and **log with a stack trace** so explicit calls can be introduced (conditionally, with parameterization like many other cases where we make adjustments to the JavaRosa direct port) 4. Add a new proposed `Scenario` method which… - Makes clear where explicit repeat creation calls are added, in a way that can be traced directly in test source, whenever convenient - Assumes the call occurs in such a sub-suite parameterizing whether to explicitly add repeats as detected; adds repeats as explicitly specified in the true condition, suppresses logging in the false condition This approach already detected one test which would have passed if adding repeats had been explicit. The test is updated here to demonstrate that. Notice that the test’s **PORTING NOTES** have also been removed. This is because the notes were wrong! This is an excellent example of how misleading it is that tests fail for lack of this implicit behavior! The actual test logic is not substantially noisier or more complex as a result. This feels like a clear win to me. [^1]: Keeping this naive seems fine for the limited scope of usage. The reference expressions which reach this point are limited to `Scenario.answer` calls with an explicit reference. If we’re using references of arbitrary complexity in those calls, I think we’ve got much bigger problems than this functionality being so narrowly scoped.
Configuration menu - View commit details
-
Copy full SHA for d9f5783 - Browse repository at this point
Copy the full SHA d9f5783View commit details -
XPath static analysis overhaul: improved function call analysis, path…
… resolution, dependency identification Function call analysis is generalized and streamlined, and used to help various other aspects of path-related static analysis. Path resolution: - Accounts for arbitrary self/parent steps (of any number, at any depth in a path) - Resolves relative paths to arbitray Absolute and FilterExpr contexts - Resolves current() calls to either: - The step in a [partial] path expression where called in a predicate on that step - The context (typically parent) of an expression’s definition Dependency identification: - Benefits from all of the above path resolution improvements - Accurately contextualizes dependencies referencing current() (which will improve reactivity for a variety of form logic cases) - Accurately identifies and contextualizes arbitrary sub-expressions in predicates (which will improve reactivity for form logic cases with more complex logic)
Configuration menu - View commit details
-
Copy full SHA for 840937b - Browse repository at this point
Copy the full SHA 840937bView commit details -
Fix (alignment with Collect): handle relative nodeset references in f…
…orm definition (typically body) Note that this breaks up parsing of… - `<item><label ref>`, where arbitrary references may be contextualized to their parent nodeset - `<itemset><label ref>`, where a relative expression is intentionally kept unresolved (ensuring that evaluation of dynamic itemsets update correctly when the itemset nodeset expression is a form state reference (i.e. repeat-based itemsets)
Configuration menu - View commit details
-
Copy full SHA for 722d06d - Browse repository at this point
Copy the full SHA 722d06dView commit details -
Fix: ensure that itemset nodeset expression is resolved in select con…
…text This ensures that: - if relative, the nodeset expression itself is contextualized correctly - in any case, that any dependencies identified in the dynamic item expression are resolved to the correct context
Configuration menu - View commit details
-
Copy full SHA for f33e22a - Browse repository at this point
Copy the full SHA f33e22aView commit details -
Update all DependentExpressions to use improved dependency analysis l…
…ogic This wil improve a variety of edge cases, and will be most visible in the correct tracking of: - `current()` references in expressions - any references found in expressions’ predicates
Configuration menu - View commit details
-
Copy full SHA for 4b24332 - Browse repository at this point
Copy the full SHA 4b24332View commit details -
Configuration menu - View commit details
-
Copy full SHA for e41b24f - Browse repository at this point
Copy the full SHA e41b24fView commit details -
Update passing secondary-instances test
Test is fixed by stripping predicates in dependency analysis
Configuration menu - View commit details
-
Copy full SHA for fd82774 - Browse repository at this point
Copy the full SHA fd82774View commit details -
Scenario: implement
canCreateNewRepeat
This **will change** when we implement support for `jr:count` and `jr:noAddRemove`. The intent of implementing it now is to ensure, in subsequent commits, that adding explicit repeat creation does not cause false positives in new test passage
Configuration menu - View commit details
-
Copy full SHA for 746baf8 - Browse repository at this point
Copy the full SHA 746baf8View commit details -
Update now-passing test checking that creation of count-controlled re…
…peats will not be allowed Technically this is a bit of a fib! The engine/client API will still permit repeat creation calls. But its passing now will ensure we continue to keep it passing when we implement the pertinent functionality
Configuration menu - View commit details
-
Copy full SHA for c49bc82 - Browse repository at this point
Copy the full SHA c49bc82View commit details -
Configuration menu - View commit details
-
Copy full SHA for c83a049 - Browse repository at this point
Copy the full SHA c83a049View commit details -
Configuration menu - View commit details
-
Copy full SHA for 71250dc - Browse repository at this point
Copy the full SHA 71250dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 717ac4c - Browse repository at this point
Copy the full SHA 717ac4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7ef5ad5 - Browse repository at this point
Copy the full SHA 7ef5ad5View commit details -
Configuration menu - View commit details
-
Copy full SHA for d0dd2ec - Browse repository at this point
Copy the full SHA d0dd2ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for ce44512 - Browse repository at this point
Copy the full SHA ce44512View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c1534d - Browse repository at this point
Copy the full SHA 0c1534dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7cb2a5c - Browse repository at this point
Copy the full SHA 7cb2a5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d72a32 - Browse repository at this point
Copy the full SHA 9d72a32View commit details -
Remove
null
-as-keyword special caseAs discussed in review, it’s highly unlikely this is actually needed anymore! Brief backstory context in case we ever have reason to doubt this: 0. The WHO VA form, which I’ve used as a frame of reference for many things, uses two references to `null` that don’t resolve to anything. The inferred intent is to treat `null` as a keyword, just as it would be in languages with the Billion Dollar Mistake. 1. In early prototyping (pre Web Forms project), the WHO VA form’s references to `null` produced errors where there was assertion logic checking that expected dependencies were found. 2. Early Web Forms work produced the same, for a time at least producing errors in the console. This produced a lot of distracting noise that made it harder to identify actual implementation errors in dependency resolution. 3. Subsequent improvements to dependency resolution have been successful enough that we’ve even eschewed logging when a dependency lookup doesn’t resolve (though I sometimes add it in local dev for testing/validation), at least as of #67. 4. As of #135, dependency resolution was expanded to be form-wide and match all possible nodes; there’s no case where a `null` reference **should** match a node and won’t. I can imagine these potentially useful followup changes: 1. On parse, identify any path sub-expressions which **will never** resolve to any node in the form. 2. Short circuit lookup of such never-resolvable paths. There’s no sense walking the full form tree for something we know we won’t find! 3. Potentially warn when such never-resolvable paths are found. This wouldn’t be particularly useful for the `null` NameTest specifically (where the intent at least in WHO VA is clearly a null reference), but it could be useful for catching typos and other mistaken references like hierarchy confusion.
Configuration menu - View commit details
-
Copy full SHA for 413819d - Browse repository at this point
Copy the full SHA 413819dView commit details -
Split
resolveDependencyNodesets
set-like behavior tests- Cases which previously exercised set-like behvaior implicitly are broken into individual tests, e.g. demonstrating cases where `current()` and `.` are treated the same way - Adds an explicit set-like behavior test
Configuration menu - View commit details
-
Copy full SHA for c5b8ac7 - Browse repository at this point
Copy the full SHA c5b8ac7View commit details -
JSDoc todos on current/instance expression predicates reference grammar
This corrects the previous copypasta mistake, and makes the notes more general so they don’t overly influence reasoning about the gap in behavior
Configuration menu - View commit details
-
Copy full SHA for 1d4de28 - Browse repository at this point
Copy the full SHA 1d4de28View commit details
Commits on Jul 23, 2024
-
Add tests for @sadiqkhoja’s questions 1-5
Two of the tests are currently marked failing: 2. This question caught a bug! I’ll fix in a subsequent commit. 4. This question suggested a valuable enhancement! I’ll timebox a solution to this, and expect to also have a fix for it in a subsequent commit.
Configuration menu - View commit details
-
Copy full SHA for d415510 - Browse repository at this point
Copy the full SHA d415510View commit details -
Address @sadiqkhoja’s question 6
This further clarifies that the intent is to identify where an expression **is** a translation call, not where an expression may contain such a call as any arbitrary sub-expression. As mentioned in the added JSDoc todo, it is possible we may want this in some future change. I think we should know more about whether it’s an expected use case before implementing it (as if it’s not an expected use case, it could be an indication of a form design mistake).
Configuration menu - View commit details
-
Copy full SHA for 7c3f513 - Browse repository at this point
Copy the full SHA 7c3f513View commit details -
Configuration menu - View commit details
-
Copy full SHA for 918062d - Browse repository at this point
Copy the full SHA 918062dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 24a30ec - Browse repository at this point
Copy the full SHA 24a30ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 057748b - Browse repository at this point
Copy the full SHA 057748bView commit details -
Capture findings of timeboxed spike on
child::text()
…… and add several related tests around the general concept.
Configuration menu - View commit details
-
Copy full SHA for b58ac5b - Browse repository at this point
Copy the full SHA b58ac5bView commit details
Commits on Jul 25, 2024
-
Configuration menu - View commit details
-
Copy full SHA for fe91584 - Browse repository at this point
Copy the full SHA fe91584View commit details -
Configuration menu - View commit details
-
Copy full SHA for 47b4fbc - Browse repository at this point
Copy the full SHA 47b4fbcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 16719b4 - Browse repository at this point
Copy the full SHA 16719b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0c0adc4 - Browse repository at this point
Copy the full SHA 0c0adc4View commit details -
Configuration menu - View commit details
-
Copy full SHA for b07023e - Browse repository at this point
Copy the full SHA b07023eView commit details