Skip to content

Conversation

@mjfwebb
Copy link
Contributor

@mjfwebb mjfwebb commented Mar 27, 2023

Description

This PR removes config.enableRegex as it has been replaced by MATCHES in features.filters.

Complexity

Low

@changeset-bot
Copy link

changeset-bot bot commented Mar 27, 2023

🦋 Changeset detected

Latest commit: 1223f8a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@neo4j/graphql Major
@neo4j/graphql-toolbox Patch
@neo4j/graphql-ogm Major
neo-place Patch
neo-push-server Patch
apollo-suscriptions-server Patch
yoga-subscriptions-server Patch
@neo4j/graphql-plugin-subscriptions-amqp Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/pull-requests.yml:code-scanning. As part of the setup process, we have scanned this repository and found 6 existing alerts. Please check the repository Security tab to see all alerts.

@neo4j-team-graphql
Copy link
Collaborator

neo4j-team-graphql commented Mar 27, 2023

Performance Report

No Performance Changes

Show Full Table
name dbHits old dbHits time (ms) old time (ms) maxRows
aggregations.TopLevelAggregate 3403 3403 39 37 1134
aggregations.NestedAggregation 14551 14551 67 99 2174
aggregations.AggregationWithWhere 11979 11979 44 71 2174
aggregations.AggregationWhereWithinNestedRelationships 22116987 22116987 3038 3093 2008534
aggregations.AggregationWhereWithinNestedConnections 22116987 22116987 2765 2678 2008534
aggregations.NestedCountFromMovieToActors 9734 9734 39 47 2174
aggregations.NestedCountFromActorsToMovie 9937 9937 45 58 2174
aggregations.DeeplyNestedCount 13070331 13070331 4537 4095 2008534
batch-create.BatchCreate 4200 4200 127 134 600
connect.createAndConnect 14424 14424 231 174 3003
connections.Connection 14082 14082 56 106 2174
connections.NestedConnection 41462 41464 125 154 4516
connections.ConnectionWithSort 2282 2282 62 81 1040
connections.ConnectionWithSortAndCypher 15323 15323 84 107 2174
create.SimpleMutation 7 7 51 61 1
cypher-directive.TopLevelMutationDirective 1135 1135 31 27 1134
delete.SimpleDelete 19401 19401 239 262 1040
delete.NestedDeleteInUpdate 18540 18540 164 198 1550
2925.SingleRelationshipFilter 6468 6468 33 56 1040
2925.NestedSingleRelationshipFilter 22900 22900 73 83 2174
2925.SingleRelationshipRequiredFilter 3450 3450 27 38 1134
2925.NestedSingleRelationshipRequiredFilter 9383 9383 49 51 1040
query.SimpleQuery 15160 15160 44 59 2174
query.QueryWhere 9704 9720 32 62 2164
query.SimpleQueryWithNestedWhere 9882 9898 47 73 2164
query.Nested 10092037 10092037 10652 10004 2008534
query.NestedWithFilter 40401 40401 87 111 4511
query.OrFilterOnRelationships 43271 42080 152 240 1839
query.OrFilterOnRelationshipsAndNested 36722 36017 177 267 1839
query.QueryWithNestedIn 14205 13321 53 71 1487
query.NestedConnectionWhere 9834 9834 48 64 2174
query.DeeplyNestedConnectionWhere 10054 10044 70 106 2174
query.DeeplyNestedWithRelationshipFilters 19260 19296 118 165 1640
query.NestedWithRelationshipSingleFilters 3024400 3024400 667 600 1003942
query.Fulltext 96 96 70 49 16
query.FulltextWithNestedQuery 587 587 56 58 84
sorting.SortMultipleTypes 2513 2513 89 68 1040
sorting.SortMultipleTypesWithCypherWithCypher 14490 14482 100 106 2174
sorting.SortOnNestedFields 14082 14082 47 57 2174
sorting.SortDeeplyNestedFields 42196 42196 84 100 4516
sorting.SortWithTopLevelCypher 15160 15160 47 63 2174
unions.SimpleUnionQuery 321 321 59 84 35
unions.SimpleUnionQueryWithMissingFields 293 293 61 79 35
unions.NestedUnion 410637 410637 295 312 33033
unions.NestedUnionWithMissingFields 384611 384611 307 309 33033
update.NestedUpdate 2119 2119 58 66 1040

Old Schema Generation: 28.692s
Schema Generation: 28.615s
Old Subgraph Schema Generation: 42.867s
Subgraph Schema Generation: 41.856s

Comment on lines -129 to -137
const matchesSetting: boolean | undefined = features?.filters?.[f.typeMeta.name]?.MATCHES;
if (matchesSetting !== undefined) {
if (matchesSetting === true) {
res[`${f.fieldName}_MATCHES`] = { type: "String", directives: deprecatedDirectives };
}
} else if (enableRegex) {
// TODO: This is deprecated. To be removed in 4.0.0.
res[`${f.fieldName}_MATCHES`] = { type: "String", directives: deprecatedDirectives };
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much tidier! 👏

Copy link
Member

@angrykoala angrykoala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one important comment that we should either tackle or discuss before merging

}

const stringWhereOperators = ["_CONTAINS", "_STARTS_WITH", "_ENDS_WITH"];
const stringWhereOperators: { comparator: string; typeName: string }[] = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, not important: For these complex object I find array types to be a bit more readable as

Array<{ comparator: string; typeName: string }>

if (filter === "MATCHES") {
return;
}
Object.entries(features?.filters?.[f.typeMeta.name] || {}).forEach(([filter, enabled]) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick Consider creating a varaible for f.typeMeta.name as it is used in several places and the extra context of a explicit name could help with readability here

if (filter === "MATCHES") {
return;
}
Object.entries(features?.filters?.[f.typeMeta.name] || {}).forEach(([filter, enabled]) => {
Copy link
Member

@angrykoala angrykoala Mar 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think we could really make use of a features helper here, as this seems like it is going to be the way forward for feature flags and we should make our lifes a bit easier on this.

I'm thinking something a bit like:

features(f.typeMeta.name).hasFilter("MATCHES");

This way we have a more unified way of accesing features that don't require concatenation of .? and default objects and we could encapsulate the logic of traversing the filters, avoiding this forEach on our schema generation logic.

Thoughts?

@mjfwebb mjfwebb merged commit 9f5a445 into neo4j:4.0.0 Mar 27, 2023
@mjfwebb mjfwebb deleted the remove-enableregex branch March 27, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants