-
-
Notifications
You must be signed in to change notification settings - Fork 224
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: Throw exceptions in unnecessary rebase and publish cases #5337
Conversation
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.
You're a workhorse, thanks for taking care.
+1 by reading
It was @kitsunet work i downloaded the patch as i thought it would go to waste :D |
you are both work horses 🐴 🐴 |
...ContentRepository.Core/Classes/Feature/WorkspacePublication/Exception/NoChangesException.php
Outdated
Show resolved
Hide resolved
8848678
to
8117aeb
Compare
Okay well its not thaaaat easy ... Following case have to be thought out:
|
I think we could/should prevent this in the command?! If we want to throw we can decide further up front (aka UI).
IMHO that is a fair possibility that can happen with race conditions on shared workspaces for example, so I would handle it gracefully and accept this as no-op. BUT given next point I probably opt for exception and graceful handling further up the chain.
Yeah this is the tricky case compared to the above, IF you had a race condition and send identifiers to a partial publish that are no longer changed this is similar to starting a full publish if there are no pending changes (anymore).
Same as above I guess. If we start to throw.
Probably again same as above. For all of this though we should make sure there is a way out even for unexpected situations. Which could e.g. be the rebase or discard even if things look unchanged. |
Todo rebase on #5385 As the $nodeIdsToPublish is rather to be seen as filter than as expectation - imagine you enter a non-existing node aggregate id - id say that its okay if this is then a noop? one cannot be mad if a filter doesnt match anything? Also what if one of the nodes in the filter is unmatched but there is one node found to be published? If we throw it would only be consistent to make it required that all node ids specified MUST translate to a change. That is somehow not really the behaviour a filter is made for. Thought especially throwing would at least give feed back to users in the Ui instead that the publish button keeps being orange like shown here: #4614 |
Todo: Also other noops like in change base workspace are not desired and have to be prevented in |
by enforcing this via "non-empty-array" we can better catch runtime type errors beforehand via phpstan. As otherwise the event store will fail with > Writable events must contain at least one event Some internal utility methods previously also returned possibly empty "Events" instances which were then transformed via iterator_to_array back to arrays and merged. This was not simplified to just work with arrays directly to denote that they might be empty. In cases were we work with fully sure filled intermediate event arrays we use non-empty-array. With this now fine-grained type checking aside from the original found set properties error following cases will also break with 0 events: - handleSetSerializedNodeProperties (known) - handleSetSerializedNodeReferences - handlePublishWorkspace and handlePublishIndividualNodesFromWorkspace if there were no applied events that implement PublishableToWorkspaceInterface -> goes into direction of neos#5337 - structure adjustment TETHERED_NODE_WRONGLY_ORDERED
by enforcing this via "non-empty-array" we can better catch runtime type errors beforehand via phpstan. As otherwise the event store will fail with > Writable events must contain at least one event Some internal utility methods previously also returned possibly empty "Events" instances which were then transformed via iterator_to_array back to arrays and merged. This was not simplified to just work with arrays directly to denote that they might be empty. In cases were we work with fully sure filled intermediate event arrays we use non-empty-array. With this now fine-grained type checking aside from the original found set properties error following cases will also break with 0 events: - handleSetSerializedNodeProperties (known) - handleSetSerializedNodeReferences - handlePublishWorkspace and handlePublishIndividualNodesFromWorkspace if there were no applied events that implement PublishableToWorkspaceInterface -> goes into direction of neos#5337 - structure adjustment TETHERED_NODE_WRONGLY_ORDERED
8117aeb
to
a134031
Compare
Okay i polished the change and adjusted the tests. Also i checked in the command handling neos-development-collection/Neos.ContentRepository.Core/Classes/ContentRepository.php Line 110 in 47fc20b
yield that we never return and no-op without issuing any events. This is basically the followup of the philosophy from #5357 and #5396 to ensure that each command maps to at least one event.
|
… conflict resolution Attempting to publish 0 changes after the adjustments in the core neos/neos-development-collection#5337 will throw an error and is also needless: > The command "PublishIndividualNodesFromWorkspace" for workspace admin-admington must contain nodes to publish To avoid unnecessary interaction - which is also tested by this test: > Publish + Syncing: Create a conflict state between two editors, then try to publish and choose "Drop conflicting changes" as a resolution strategy during automatic rebase We dont continue publishing if the publish button is not orange basically ;) In the future i think this should be improved that another phase and screen is added so this is done more transparently.
The behavior test errors are valid as the expectation changed now (we gracefully handled the empty rebase before). Unlike what I wrote in December, I am pretty convinced now that we are making a mistake with all this, but as I wrote in another place, we can revert from this stance easier than the other way around so I am ok with merging it given the majority seems to be in favor of doing it this way. |
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.
Looks fine, test error still left to fix but that should be easy enough.
Fyi i also followed your idea to have one exception for these things instead of the |
…angeBaseWorkspace
…PublishingService
separate more complex discard commands into own tests as attempting to discard 0 nodes fails now and its harder to test that way in batches.
Instead of keeping it specific to publishing and naming it `NoPublishableChanges` we use it as generic no-op exception for workspace commands. Especially because `becauseWorkspaceToRebaseIsNotOutdated` already deviates from the 'PublishableChanges' kind.
7cf488a
to
6bd31ee
Compare
by enforcing this via "non-empty-array" we can better catch runtime type errors beforehand via phpstan. As otherwise the event store will fail with > Writable events must contain at least one event Some internal utility methods previously also returned possibly empty "Events" instances which were then transformed via iterator_to_array back to arrays and merged. This was not simplified to just work with arrays directly to denote that they might be empty. In cases were we work with fully sure filled intermediate event arrays we use non-empty-array. With this now fine-grained type checking aside from the original found set properties error following cases will also break with 0 events: - handleSetSerializedNodeProperties (known) - handleSetSerializedNodeReferences - handlePublishWorkspace and handlePublishIndividualNodesFromWorkspace if there were no applied events that implement PublishableToWorkspaceInterface -> goes into direction of neos/neos-development-collection#5337 - structure adjustment TETHERED_NODE_WRONGLY_ORDERED
based on #5396
new
WorkspaceCommandSkipped
exception:Exception to denote that the workspace operation was skipped. No events were published.
Workspace publishing/discarding
Command skipped if there are no (selected) publishable changes.
To avoid this exception being thrown into the outer world it should be caught and logged or the case were its
likely that the operation might be a noop can easily be determined beforehand via
Workspace::hasPublishableChanges()
:Workspace rebase
Command skipped if the workspace is not outdated.
Workspace base change
Command skipped when attempting to change the base workspace to the currently set base workspace.
Note:
The case is not handled gracefully with a no-op as there would be no traces (emitted events) of the handled command,
and the original content stream id is kept (for publish operations).
This exception denoting the operation is obsolete should harden the interaction and make behaviour more explicit.
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions