-
-
Notifications
You must be signed in to change notification settings - Fork 222
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: Serializable Commands #5348
Conversation
Neos.ContentRepository.Core/Classes/Feature/RebaseableCommand.php
Outdated
Show resolved
Hide resolved
With the current WIP tests will fail because of the TransformationsFactory working on the But basically the PoC works with Neos |
Thanks, the idea is also that we centralise
|
Interesting idea, probably the right direction. i am not madly in love with the way the interfaces interact though... This is really .... something:
But I have no great alternative atm... |
maybe using |
I agree, it's at least uncommon. But it just affects very few very internal parts of the code – does it really matter? |
There are 5 NodeMigration implementations that use In any case: If we need to keep it like that but want to make |
by only using "official" commands
...oralTests/Tests/Behavior/Features/EventSourced/Migration/AddNewProperty_NoDimensions.feature
Show resolved
Hide resolved
…therWorkspaceInterface` directly
Neos.ContentRepository.Core/Classes/CommandHandler/SerializedCommandInterface.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/Feature/Common/RebasableToOtherWorkspaceInterface.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/Feature/WorkspaceRebase/CommandThatFailedDuringRebase.php
Outdated
Show resolved
Hide resolved
@mhsdesign @kitsunet Thanks a lot for your continuous efforts! RecapDuring a rebase (i.e when I sync changes from a target workspace with new changes to my workspace that also has pending changes) we currently re-apply the original commands to find out wether my pending changes are in conflict with the synced changes. But because there are some non-idempotent commands we introduced lower-level commands for those that contain "serialized" information about the state of the system at the time of the initial command handling in order to make it (more) idempotent (e.g.: the BlockerThe main issue with that is: Now users can send those low-level commands directly to the CR, skipping some constraint checks (and making the API more complex than it'd need to be). That is the issue, this PR tries to solve by making the low-level commands an internal concept. DiscussionsI'm happy to fine-tune the namings & types of course, but personally I don't care about those (now called) serialized commands because they are now just an internal thing and nobody should have to deal with them (apart from the core) – or am I missing something here? Further thoughtsSome more ideas that should not distract us from the important issues, but maybe help to find better in-between-solutions: I looked at the events and realized that we store the FQN of the And, a little more controversial maybe: The information for the "command" is mostly already contained in the corresponding event. So I wonder why we decided to store information about the command in the metadata. As a result we would completely get rid of the command metadata hack and instead re-apply events + checking (some) constraints. |
TASK: Remove `SerializedCommandInterface` again and use `RebasableToO…
As discussed with @mhsdesign and @kitsunet A result of this PR is that the "lowlevel commands" are now completely internal and should not be exposed to the userland at all (that's a good thing IMO). As a result, we need to tweak the
final readonly class CommandThatFailedDuringRebase
{
public function __construct(
public CommandInterface $command,
public \Throwable $exception,
private SequenceNumber $sequenceNumber,
) {
}
public function getSequenceNumber(): SequenceNumber;
} to final readonly class CommandThatFailedDuringRebase
{
public function __construct(
private EventInterface $event,
private \Throwable $exception,
private SequenceNumber $sequenceNumber,
) {
}
/** @internal **/
public function getEvent(): EventInterface;
public function getException(): \Throwable;
public function getSequenceNumber(): SequenceNumber;
} ...and change the UI code accordingly |
@@ -64,7 +66,7 @@ Feature: Add New Property | |||
- | |||
type: 'AddNewProperty' | |||
settings: | |||
newPropertyName: 'aDateOutsideSchema' |
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.
@skurfuerst you had originally introduced this test case with 0f88ed6 but in our opinion node migrations should not be allowed to set properties that are not allowed according to the node type schema. Do you agree to that assumption?
This is an implementation detail, and we might change this concept and rather do constraint checks for events on the read model and then publish those.
because events dont fail usually :D
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.
Thank you both for polishing this so well :)
I'm happy with this one now, but I can't +1 it. @mhsdesign @kitsunet shall we merge this? |
@bwaidelich please have a look how i handled things in the Neos ui now neos/neos-ui#3881 |
Chances that its okay to just be interested in the first dsp are low :D
# Conflicts: # Neos.ContentRepository.BehavioralTests/Tests/Behavior/Features/W6-WorkspaceRebasing/02-RebasingWithAutoCreatedNodes.feature # Neos.ContentRepository.Core/Classes/CommandHandler/CommandInterface.php # Neos.ContentRepository.Core/Classes/Feature/NodeModification/Command/SetNodeProperties.php # Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/GenericCommandExecutionAndEventPublication.php
…neos-development-collection into task/serializable-commands
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.
we discussed that for the case we would want to replay events actually that also a succeeding event might appear here. Currently only the initial event will be available via $event, but we could still later decide to add an additional events list here.
If we were to replay events we can not allow only one to pass. All correlated must pass i assume (as otherwise tethered nodes could be missing), so the first event - if really the part of the conflict or not - will always be $event.
Turns the low-level commands
CreateNodeAggregateWithNodeAndSerializedProperties
,SetSerializedNodeProperties
andSetSerializedNodeReferences
into implementations of a newSerializedCommandInterface
in order to prevent them from being dispatched "from the outside".This is a breaking change in case that someone instantiated and sent one of those lowlevel (and
@internal
) commands toContentRepository::handle()
. In that case the corresponding high level command should be used instead.Related: #5353
Neos ui neos/neos-ui#3881