Skip to content
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

!!! TASK: Node name consistency adjustments #5018

Merged
merged 21 commits into from
May 13, 2024
Merged

!!! TASK: Node name consistency adjustments #5018

merged 21 commits into from
May 13, 2024

Conversation

nezaniel
Copy link
Member

@nezaniel nezaniel commented Apr 28, 2024

draft until #4993 is merged

builds on #4993
resolves #4150

This improves node name handling consistency by adjusting behavior in certain locations.

Unique node names for children on aggregate level

Child node aggregates must no longer share a name, even if they don't share covered dimension space points.
This also means that ContentGraphInterface::findChildNodeAggregateByName now returns a single NodeAggregate, if any

Enforcement and respective tests have been adjusted

Node names are now stored in the contentgraph's node table

Changing the node name now trigger a copy on write

Manual structure adjustments regarding tethered nodes are now prohibited

Previously, it was possible to manually "fix" missing tethered nodes by renaming a node of the proper type or change the type of a node with the proper name. This is now no longer possible and instead to be performed globally via structure adjustments

Upgrade instructions

The method ContentGraphInterface::findChildNodeAggregateByName now returns a single NodeAggregate, if any and has been renamed:

- $contentGraph->findChildNodeAggregatesByName(...);
+ $contentGraph->findChildNodeAggregateByName(...);

./flow cr:setup and ./flow cr:replay contentgraph is required due to node names now being stored in the node instead of hierarchy relation table

Review instructions

coming soon

Checklist

  • Code follows the PSR-12 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the 9.0 branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

@github-actions github-actions bot added the 9.0 label Apr 28, 2024
@nezaniel nezaniel marked this pull request as draft April 28, 2024 12:26
@mhsdesign mhsdesign closed this May 2, 2024
@mhsdesign mhsdesign reopened this May 2, 2024
@mhsdesign mhsdesign changed the title Node name consistency adjustments TASK: Node name consistency adjustments May 2, 2024
@github-actions github-actions bot added the Task label May 2, 2024
@mhsdesign mhsdesign marked this pull request as ready for review May 2, 2024 10:57
@mhsdesign
Copy link
Member

Is this ready for review?

@nezaniel
Copy link
Member Author

nezaniel commented May 5, 2024

I'd like #5025 merged first, afterwards, yes, I think so

@nezaniel
Copy link
Member Author

nezaniel commented May 6, 2024

now open for review

@mhsdesign
Copy link
Member

Oh no. This turns out to be in MAJOR conflict with @kitsunet month old #5028 pr

  • Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphProjection.php
  • Neos.ContentGraph.DoctrineDbalAdapter/src/DoctrineDbalContentGraphSchemaBuilder.php
  • Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentGraph.php
  • Neos.ContentGraph.DoctrineDbalAdapter/src/Domain/Repository/ContentSubgraph.php
  • Neos.ContentGraph.PostgreSQLAdapter/src/Domain/Repository/ContentHypergraph.php
  • Neos.ContentRepository.Core/Classes/Feature/Common/ConstraintChecks.php
  • Neos.ContentRepository.Core/Classes/Feature/Common/TetheredNodeInternals.php
  • Neos.ContentRepository.Core/Classes/Feature/NodeCreation/NodeCreation.php
  • Neos.ContentRepository.Core/Classes/Feature/NodeDuplication/NodeDuplicationCommandHandler.php
  • Neos.ContentRepository.Core/Classes/Feature/NodeMove/NodeMove.php
  • Neos.ContentRepository.Core/Classes/Feature/NodeRenaming/NodeRenaming.php
  • Neos.ContentRepository.Core/Classes/Feature/NodeTypeChange/NodeTypeChange.php
  • Neos.ContentRepository.Core/Classes/Projection/ContentGraph/ContentGraphInterface.php
  • Neos.Neos/Classes/Controller/Module/Administration/SitesController.php
  • Neos.Neos/Classes/Domain/Service/SiteServiceInternals.php

As there are also refactorings made regarding query building and stuff im not sure how to continue.
Maybe a compromise would be to remove these NodeQueryBuilder optimisations from your pr @kitsunet?
This pr fundamentally changes that the name of a node is now stored in the node table and not the hierarchy relation table.

Maybe even merge this one first as this contains real sql changes while the other one cosmetic ones and THESE changes must not get lost....

@nezaniel
Copy link
Member Author

Wasn't that bad after all. I'd like #5040 merged first, though, to resolve the expected additional conflicts here

@mhsdesign mhsdesign self-requested a review May 11, 2024 12:03
Copy link
Member

@mhsdesign mhsdesign 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 already ;) Thanks for including the adjustments!

The Neos Ui e2e also pass without any adjustments
(as we want to release a new beta soon today tomorrow? i would not want to include it into that because of the replay, but it can be merged the second the beta was released)

Comment on lines -327 to -339
if (
$nodeName
&& $parentsNodeType->hasTetheredNode($nodeName)
&& !$this->getNodeTypeManager()->getTypeOfTetheredNode($parentsNodeType, $nodeName)->name->equals($nodeType->name)
) {
throw new NodeConstraintException(
'Node type "' . $nodeType->name->value . '" does not match configured "'
. $this->getNodeTypeManager()->getTypeOfTetheredNode($parentsNodeType, $nodeName)->name->value
. '" for auto created child nodes for parent type "' . $parentsNodeType->name->value
. '" with name "' . $nodeName->value . '"',
1707561404
);
}
Copy link
Member

Choose a reason for hiding this comment

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

why were these constraint checks removed? I came across those many times and last time i read them they seemed correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

They were replaced by an even stricter requireNodeTypeNotToDeclareTetheredChildNodeName (see above)

Copy link
Member

Choose a reason for hiding this comment

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

Okay i see but my feeling says requireNodeTypeNotToDeclareTetheredChildNodeName is not called often enough? Only once in the Move handling?

Copy link
Member Author

@nezaniel nezaniel May 12, 2024

Choose a reason for hiding this comment

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

It's called three times, at all relevant locations:

  • NodeCreation: You can't manually create a missing tethered node anymore
  • NodeMove: You can't move a node to a parent where a tethered child of the same name is missing
  • NodeRenamig: You can't assign the name of a missing tethered sibling to a node anymore

Copy link
Member

@mhsdesign mhsdesign May 13, 2024

Choose a reason for hiding this comment

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

Wait but what about handleCopyNodesRecursively and handleChangeNodeAggregateType? they had a call previously to requireConstraintsImposedByAncestorsAreMet but not to requireNodeTypeNotToDeclareTetheredChildNodeName?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I'll have to check what copy does with names.
Type change is unrelated though as it does not affect the name

@mhsdesign mhsdesign changed the title TASK: Node name consistency adjustments !!! TASK: Node name consistency adjustments May 12, 2024
@nezaniel
Copy link
Member Author

(as we want to release a new beta soon today tomorrow? i would not want to include it into that because of the replay, but it can be merged the second the beta was released)

Is there any particular reason why the replay should be in the next beta instead of this one?

@mhsdesign
Copy link
Member

idk but it seems no replay for this beta is not possible see: #5025 (comment)

was just thinking about keeping things simple when beta hopping and putting all migrate related stuff in one batch but youre rm as well so was just a slight thought

@nezaniel
Copy link
Member Author

As this has to be merged (rather sooner than later) anyway, I'd say we can do so already

Copy link
Member

@kitsunet kitsunet left a comment

Choose a reason for hiding this comment

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

👀

@kitsunet kitsunet merged commit b1a5abd into 9.0 May 13, 2024
12 checks passed
@kitsunet kitsunet deleted the 4150-copyOnRename branch May 13, 2024 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NodeAggregateNameWasChanged does not create copy on write
3 participants