stable

Clone or download

Read-only

feat: Introduce duck-typed field

How to test: - Enable the feature flag: tuleap config-set feature_flag_cross_tracker_search_duck_typed_fields 1 - When you type a field name that does not exist in any tracker, you will get an error telling you that we don't know what the name references. Previously, it resulted in error 500. - No other functional change. Notes: When building the SQL query, we will need to know the "type" of a given "duck-typed field" so that we are able to write the query for a given comparison. For example, given "initial_effort = 5", we need to know that "initial_effort" is a numeric like "int or float" so that we can query the corresponding tracker changeset value DB tables. Having an enum (instead of a class) will allow us to use a match expression on it. We did not have enums for the type of metadata, so we had to use a switch, but the goal is the same. Using DuckTypedField, I can build the "type" of a duck-typed field and it can be used both for raising errors to the end-user, and later to build the actual SQL query. part of story #10710 search on fields with duck typing Change-Id: I723615a027d6ad0f723823d07ec824eaaeaecbff

Modified Files

Name
M plugins/crosstracker/include/CrossTracker/REST/v1/CrossTrackerReportsResource.php +1 −1 Go to diff View file
A plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/DuckTypedField/DuckTypedField.php +60 −0 Go to diff View file
R plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/QueryValidation/Field/DuckTypedFieldType.php Go to diff View file
A plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/DuckTypedField/FieldNotFoundInAnyTrackerFault.php +36 −0 Go to diff View file
R plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/QueryValidation/Field/FieldTypeIsNotSupportedFault.php Go to diff View file
R plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/QueryValidation/Field/FieldTypesAreIncompatibleFault.php Go to diff View file
R plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/QueryValidation/Field/SearchFieldTypes.php Go to diff View file
R plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/QueryValidation/Field/TrackerFieldDao.php Go to diff View file
M plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/InvalidSearchableCollectorVisitor.php +3 −2 Go to diff View file
M plugins/crosstracker/include/CrossTracker/Report/Query/Advanced/QueryValidation/Field/FieldUsageChecker.php +3 −14 Go to diff View file
M plugins/crosstracker/include/crosstrackerPlugin.php +1 −1 Go to diff View file
R plugins/crosstracker/tests/integration/CrossTracker/Report/Query/Advanced/QueryValidation/Field/TrackerFieldDaoTest.php Go to diff View file
A plugins/crosstracker/tests/unit/CrossTracker/Report/Query/Advanced/DuckTypedField/DuckTypedFieldTest.php +79 −0 Go to diff View file
R plugins/crosstracker/tests/unit/CrossTracker/Report/Query/Advanced/QueryValidation/Field/DuckTypedFieldTypeTest.php Go to diff View file
M plugins/crosstracker/tests/unit/CrossTracker/Report/Query/Advanced/InvalidSearchableCollectorVisitorTest.php +74 −49 Go to diff View file
M plugins/crosstracker/tests/unit/CrossTracker/Report/Query/Advanced/QueryValidation/Field/FieldUsageCheckerTest.php +3 −0 Go to diff View file
M plugins/crosstracker/tests/unit/CrossTracker/Tests/Stub/SearchFieldTypesStub.php +7 −2 Go to diff View file