You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Konrad Windszus <kw...@apache.org> on 2022/12/16 10:56:27 UTC
RepoInit: Intended behaviour in case of failures and backwards-compatibility
Hi,
There are some issue with RepoInit with regards to failure behaviour like [1] and [2] and the discussion initially raised in JIRA and/or GitHub PR was a bit tough I try to summarise the issue and status quo here in order to get some more feedback.
Most repoinit statements lead to an exception and prevent the SlingRepository from getting up and running.
This has the advantage of assuring that the repo is in a certain state once the SlingRepository is up (although obviously the state might change afterwards).
The drawback is that it is hard to debug/fix issues when not even the SlingRepository is up. The drawback might not be that severe once there is a flag to toggle that behaviour as proposed in [3].
The discussions around the multiple open PRs in https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pulls kind of converged to:
It is good to stick to that initial design goal, but fixing existing issues must be strictly backwards-compatible (in my own words).
Please respond here if you have concerns with that approach. After we have some agreement let us also document the (intended) failure behaviour more clearly on https://sling.apache.org/documentation/bundles/repository-initialization.html and document where we deviate from that (for whatever reasons).
With regards to fixing existing issues without breaking compatibility the proposal was to introduce either new statements/or at least a new option in case the behaviour is changed to stick more to the “fail in case statements cannot be applied”. So I already made a proposal for [2] in [4], please comment directly in [4] to share your thoughts.
For [1] I have not a very good idea how the statement should look like, so I would appreciate some suggestions.
Thanks for your input,
Konrad
[1] - https://issues.apache.org/jira/browse/SLING-10281
[2] - https://issues.apache.org/jira/browse/SLING-11736
[3] - https://issues.apache.org/jira/browse/SLING-8843
[4] - https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
It is more about that this answers all the questions you had about the proposal because it is code (which says more than 1000 words).
Konrad
> On 16. Dec 2022, at 15:08, Bertrand Delacretaz <bd...@apache.org> wrote:
>
> Konrad Windszus <kw...@apache.org> wrote:
>> ...I would really appreciate direct feedback in the GH PR (where you are reviewer BTW ;-))...
>
> Sure, but I also want to see if others agree with the general
> principles proposed in this thread.
>
> -Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Bertrand Delacretaz <bd...@apache.org>.
Konrad Windszus <kw...@apache.org> wrote:
> ...I would really appreciate direct feedback in the GH PR (where you are reviewer BTW ;-))...
Sure, but I also want to see if others agree with the general
principles proposed in this thread.
-Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
> On 16. Dec 2022, at 14:58, Bertrand Delacretaz <bd...@apache.org> wrote:
>
> So (assumption A) for SLING-11736 you would add a completely new
> "create node" command, that has the exact same behavior as "create
> path" except for the behavior changes of SLING-11736 ?
Exactly, this is what is proposed in [4] and referenced from my initial mail.
I would really appreciate direct feedback in the GH PR (where you are reviewer BTW ;-))
Konrad
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Bertrand Delacretaz <bd...@apache.org>.
Konrad Windszus <ko...@gmx.de> wrote:
> ...I don’t like this for the reasons outlined at https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
>
> "From an end user perspective deprecating one statement and introducing a new one with a more concise name is better than just adding the option strict to existing statements with fuzzy names like “path”:...
So (assumption A) for SLING-11736 you would add a completely new
"create node" command, that has the exact same behavior as "create
path" except for the behavior changes of SLING-11736 ?
If that's correct, I prefer adding a [strict] option to activate this
new behavior, as that makes the language smaller overall, which is a
good thing in my book.
But that's just different styles in the end, if my assumption A is
correct I guess we'll need someone else to express their preference to
see where the majority is.
-Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Carsten Ziegeler <cz...@apache.org>.
Fair enough, apologies for not expressing myself here clearly. I
*suggested* something, this was neither a decision nor meant as a
dismission of something. However, I've seen too many cases where all
potential cases are considered first, leading then to a too complicated
solution that in the end is no one using - and that confuses users.
Regards
Carsten
Am 20.12.2022 um 20:31 schrieb Eric Norman:
> My reply was not intended as a personal accusation. I apologize if you
> took it that way.
>
> I was simply expecting a reasoned discussion based on facts rather than a
> dismissive reply that declared how it will be.
>
> Regards,
> Eric
>
> On Tue, Dec 20, 2022, 3:53 AM Konrad Windszus <kw...@apache.org> wrote:
>
>> Hi Eric,
>> Actually your concern/use case lead to a modified proposal (ensure nodes)
>> to allow for future other instructions (like update nodes).
>> But I agree with Carsten here (and I am not Adobe): personal accusations
>> don’t belong here and your are offending others with comments like these.
>>
>> Konrad
>>
>>> On 19. Dec 2022, at 20:02, Eric Norman <er...@gmail.com> wrote:
>>>
>>> It seems my opinions don't matter
>>> here as the Adobe voices have overwhelmed the discussion.
>>
>>
>
--
Carsten Ziegeler
Adobe
cziegeler@apache.org
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Eric Norman <er...@gmail.com>.
My reply was not intended as a personal accusation. I apologize if you
took it that way.
I was simply expecting a reasoned discussion based on facts rather than a
dismissive reply that declared how it will be.
Regards,
Eric
On Tue, Dec 20, 2022, 3:53 AM Konrad Windszus <kw...@apache.org> wrote:
> Hi Eric,
> Actually your concern/use case lead to a modified proposal (ensure nodes)
> to allow for future other instructions (like update nodes).
> But I agree with Carsten here (and I am not Adobe): personal accusations
> don’t belong here and your are offending others with comments like these.
>
> Konrad
>
> > On 19. Dec 2022, at 20:02, Eric Norman <er...@gmail.com> wrote:
> >
> > It seems my opinions don't matter
> > here as the Adobe voices have overwhelmed the discussion.
>
>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
Hi Eric,
Actually your concern/use case lead to a modified proposal (ensure nodes) to allow for future other instructions (like update nodes).
But I agree with Carsten here (and I am not Adobe): personal accusations don’t belong here and your are offending others with comments like these.
Konrad
> On 19. Dec 2022, at 20:02, Eric Norman <er...@gmail.com> wrote:
>
> It seems my opinions don't matter
> here as the Adobe voices have overwhelmed the discussion.
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
Eric Norman <er...@gmail.com> wrote:
> ...I apologise for trying to be proactive. It seems my opinions don't matter
> here...
They do matter, and I'm sorry if whatever I wrote made you feel otherwise.
The use case that you mentioned does not fit the way I use Sling:
> ...In other words, if someone else already created a path (with the
> wrong types) that you are not expecting to be there, then failing right
> away seems like a reasonable solution...
So I considered that having a variant of "set node" that fails if
paths already exist does not seem useful *at this point*. And it would
actually get in the way for my use cases - but I could of course
refrain from using it.
Not implementing that variant now does not prevent someone from
implementing it later. I don't think it's useful myself, and I might
have more (unwanted) weight in these discussions as I worked a lot on
repoinit in its beginnings. But don't let that stop you.
-Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Eric Norman <er...@gmail.com>.
>
> How about we go there when such a use case comes up in reality?
>
> Regards
> Carsten
>
I apologise for trying to be proactive. It seems my opinions don't matter
here as the Adobe voices have overwhelmed the discussion.
Have a good day.
-Eric
On Mon, Dec 19, 2022 at 4:16 AM Carsten Ziegeler <cz...@apache.org>
wrote:
> How about we go there when such a use case comes up in reality?
>
> Regards
> Carsten
>
>
> Am 19.12.2022 um 13:09 schrieb Konrad Windszus:
> > Please read the full mailing list thread.
> > This were the use cases brought up by Eric
> >
> > "I can envision a highly modular distribution in which two
> > modules (from different owners) may accidentally have paths that collide.
> > So I can see how a repoinit that would fail fast in that scenario could
> be
> > useful. In other words, if someone else already created a path (with the
> > wrong types) that you are not expecting to be there, then failing right
> > away seems like a reasonable solution.”
> >
> > Konrad
> >
> >
> >
> >> On 19. Dec 2022, at 12:50, Bertrand Delacretaz <bd...@apache.org>
> wrote:
> >>
> >> Hi,
> >>
> >> I agree with deprecating "create path" and implementing new
> instructions.
> >>
> >> But I'm not sure why you would need two new instructions:
> >>
> >> Konrad Windszus <ko...@gmx.de> wrote:
> >> ...
> >>> a) ensure node (for creating or updating node(s) with primary and
> mixin type)
> >>> b) update node (for just updating existing node(s) with primary and
> mixin type).
> >> ...
> >>
> >> In both cases, you want the specified nodes to be exactly as described
> >> in the statement, so why two instructions?
> >>
> >> What would "update node" do if not all nodes exist yet, fail? Do
> >> nothing? Both are not good IMO.
> >>
> >> Whoever writes the repoinit script specifies an end state, I don't
> >> think they care about the previous state, so I think just "create
> >> node" is sufficient and simpler to implement.
> >>
> >> But it's actually not a single node that's being created or updated,
> >> it's the whole subtree, when you write something like
> >>
> >> create node (nt:folder) /one(mixin nt:art)/step(mixin
> nt:dance)/two/steps
> >>
> >> You're actually touching up to 4 nodes...I think "create nodes" or
> >> "set nodes" is a better name for this new instruction.
> >>
> >> -Bertrand
> >
> >
>
> --
> Carsten Ziegeler
> Adobe
> cziegeler@apache.org
>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
> On 19. Dec 2022, at 14:45, Bertrand Delacretaz <bd...@apache.org> wrote:
>
> So my preference goes to "set nodes ...", but if the majority prefers
> "ensure nodes" that also works.
Sounds better to me as well.
Konrad
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
Konrad Windszus <kw...@apache.org> wrote:
> ...So I will for now only update https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27 <https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27> with
>
> Instruction "ensure node" (for creating or updating node(s) with primary and mixin type)....
works for me but I think it should be "nodes" and not "node" as a
typical instruction will touch multiple nodes.
Also, I would prefer "set" over "ensure" as we already have "set
properties" with a similar behavior in the language.
So my preference goes to "set nodes ...", but if the majority prefers
"ensure nodes" that also works.
-Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
I think it is fine to leave out "update node" for now (but you have to keep it in mind for naming the other new instruction to allow for such semantics later on).
So I will for now only update https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27 <https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27> with
Instruction "ensure node" (for creating or updating node(s) with primary and mixin type).
WDYT?
Konrad
> On 19. Dec 2022, at 13:16, Carsten Ziegeler <cz...@apache.org> wrote:
>
> How about we go there when such a use case comes up in reality?
>
> Regards
> Carsten
>
>
> Am 19.12.2022 um 13:09 schrieb Konrad Windszus:
>> Please read the full mailing list thread.
>> This were the use cases brought up by Eric
>> "I can envision a highly modular distribution in which two
>> modules (from different owners) may accidentally have paths that collide.
>> So I can see how a repoinit that would fail fast in that scenario could be
>> useful. In other words, if someone else already created a path (with the
>> wrong types) that you are not expecting to be there, then failing right
>> away seems like a reasonable solution.”
>> Konrad
>>> On 19. Dec 2022, at 12:50, Bertrand Delacretaz <bd...@apache.org> wrote:
>>>
>>> Hi,
>>>
>>> I agree with deprecating "create path" and implementing new instructions.
>>>
>>> But I'm not sure why you would need two new instructions:
>>>
>>> Konrad Windszus <ko...@gmx.de> wrote:
>>> ...
>>>> a) ensure node (for creating or updating node(s) with primary and mixin type)
>>>> b) update node (for just updating existing node(s) with primary and mixin type).
>>> ...
>>>
>>> In both cases, you want the specified nodes to be exactly as described
>>> in the statement, so why two instructions?
>>>
>>> What would "update node" do if not all nodes exist yet, fail? Do
>>> nothing? Both are not good IMO.
>>>
>>> Whoever writes the repoinit script specifies an end state, I don't
>>> think they care about the previous state, so I think just "create
>>> node" is sufficient and simpler to implement.
>>>
>>> But it's actually not a single node that's being created or updated,
>>> it's the whole subtree, when you write something like
>>>
>>> create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
>>>
>>> You're actually touching up to 4 nodes...I think "create nodes" or
>>> "set nodes" is a better name for this new instruction.
>>>
>>> -Bertrand
>
> --
> Carsten Ziegeler
> Adobe
> cziegeler@apache.org
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Carsten Ziegeler <cz...@apache.org>.
How about we go there when such a use case comes up in reality?
Regards
Carsten
Am 19.12.2022 um 13:09 schrieb Konrad Windszus:
> Please read the full mailing list thread.
> This were the use cases brought up by Eric
>
> "I can envision a highly modular distribution in which two
> modules (from different owners) may accidentally have paths that collide.
> So I can see how a repoinit that would fail fast in that scenario could be
> useful. In other words, if someone else already created a path (with the
> wrong types) that you are not expecting to be there, then failing right
> away seems like a reasonable solution.”
>
> Konrad
>
>
>
>> On 19. Dec 2022, at 12:50, Bertrand Delacretaz <bd...@apache.org> wrote:
>>
>> Hi,
>>
>> I agree with deprecating "create path" and implementing new instructions.
>>
>> But I'm not sure why you would need two new instructions:
>>
>> Konrad Windszus <ko...@gmx.de> wrote:
>> ...
>>> a) ensure node (for creating or updating node(s) with primary and mixin type)
>>> b) update node (for just updating existing node(s) with primary and mixin type).
>> ...
>>
>> In both cases, you want the specified nodes to be exactly as described
>> in the statement, so why two instructions?
>>
>> What would "update node" do if not all nodes exist yet, fail? Do
>> nothing? Both are not good IMO.
>>
>> Whoever writes the repoinit script specifies an end state, I don't
>> think they care about the previous state, so I think just "create
>> node" is sufficient and simpler to implement.
>>
>> But it's actually not a single node that's being created or updated,
>> it's the whole subtree, when you write something like
>>
>> create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
>>
>> You're actually touching up to 4 nodes...I think "create nodes" or
>> "set nodes" is a better name for this new instruction.
>>
>> -Bertrand
>
>
--
Carsten Ziegeler
Adobe
cziegeler@apache.org
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
Please read the full mailing list thread.
This were the use cases brought up by Eric
"I can envision a highly modular distribution in which two
modules (from different owners) may accidentally have paths that collide.
So I can see how a repoinit that would fail fast in that scenario could be
useful. In other words, if someone else already created a path (with the
wrong types) that you are not expecting to be there, then failing right
away seems like a reasonable solution.”
Konrad
> On 19. Dec 2022, at 12:50, Bertrand Delacretaz <bd...@apache.org> wrote:
>
> Hi,
>
> I agree with deprecating "create path" and implementing new instructions.
>
> But I'm not sure why you would need two new instructions:
>
> Konrad Windszus <ko...@gmx.de> wrote:
> ...
>> a) ensure node (for creating or updating node(s) with primary and mixin type)
>> b) update node (for just updating existing node(s) with primary and mixin type).
> ...
>
> In both cases, you want the specified nodes to be exactly as described
> in the statement, so why two instructions?
>
> What would "update node" do if not all nodes exist yet, fail? Do
> nothing? Both are not good IMO.
>
> Whoever writes the repoinit script specifies an end state, I don't
> think they care about the previous state, so I think just "create
> node" is sufficient and simpler to implement.
>
> But it's actually not a single node that's being created or updated,
> it's the whole subtree, when you write something like
>
> create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
>
> You're actually touching up to 4 nodes...I think "create nodes" or
> "set nodes" is a better name for this new instruction.
>
> -Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
I agree with deprecating "create path" and implementing new instructions.
But I'm not sure why you would need two new instructions:
Konrad Windszus <ko...@gmx.de> wrote:
...
> a) ensure node (for creating or updating node(s) with primary and mixin type)
> b) update node (for just updating existing node(s) with primary and mixin type).
...
In both cases, you want the specified nodes to be exactly as described
in the statement, so why two instructions?
What would "update node" do if not all nodes exist yet, fail? Do
nothing? Both are not good IMO.
Whoever writes the repoinit script specifies an end state, I don't
think they care about the previous state, so I think just "create
node" is sufficient and simpler to implement.
But it's actually not a single node that's being created or updated,
it's the whole subtree, when you write something like
create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
You're actually touching up to 4 nodes...I think "create nodes" or
"set nodes" is a better name for this new instruction.
-Bertrand
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <ko...@gmx.de>.
Sounds good to me, so that would leave us with two new statements:
a) ensure node (for creating or updating node(s) with primary and mixin type)
b) update node (for just updating existing node(s) with primary and mixin type).
I will update my PR at https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27 <https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/27> accordingly.
Konrad
> On 19. Dec 2022, at 11:44, Julian Sedding <js...@gmail.com> wrote:
>
> How about "ensure node"? It's shorter than "updateOrCreate node",
> which to me seems likely the most common case.
>
> Regards
> Julian
>
> PS: my preference is also with deprecating "create path" in favour of
> a new clearly defined instruction.
>
> On Mon, Dec 19, 2022 at 7:21 AM Konrad Windszus <ko...@gmx.de> wrote:
>>
>> Thanks for the use cases. But then „create node“ according to your proposal would only work exactly once. A restart of the runtime or just the sling jcr bundle would automatically fail because then the node would already be there when the statement is executed again….
>> So IMHO only update and updateOrCreate are useful.
>> WDYT,
>> Konrad
>>
>>
>>> Am 16.12.2022 um 20:42 schrieb Eric Norman <en...@apache.org>:
>>>
>>> Also, another use case I was thinking of for the "update node" scenario is
>>> if you want to add a mixin to a node that was expected to be already
>>> created elsewhere, if the node doesn't exist yet then your mixin won't get
>>> assigned and you could have indeterminate behavior later. So failing fast
>>> would quickly tell you something is wrong.
>>>
>>> Regards,
>>> -Eric
>>>
>>>> On Fri, Dec 16, 2022 at 11:19 AM Eric Norman <en...@apache.org> wrote:
>>>>
>>>> TBH I don’t yet see use cases for failing when the node does already
>>>>> exist (create node in your proposal) nor for failing when the node does
>>>>> not exist (update node)
>>>>>
>>>>
>>>> Yes, that is kind of the point. You can't possibly conceive every
>>>> possible use case, so just make the language generic enough to satisfy a
>>>> broad set of use cases. I can envision a highly modular distribution in
>>>> which two modules (from different owners) may accidentally have paths that
>>>> collide. So I can see how a repoinit that would fail fast in that scenario
>>>> could be useful. In other words, if someone else already created a path
>>>> (with the wrong types) that you are not expecting to be there, then failing
>>>> right away seems like a reasonable solution.
>>>>
>>>> (We also don’t have anything like that for set properties AFAIK)
>>>>>
>>>>
>>>> I think the "[set|default] propertyName ..." syntax is conceptually
>>>> similar. In that, the "default" operator would only modify the value if it
>>>> does not already have a non-default value.
>>>>
>>>> Regards,
>>>> -Eric
>>>>
>>>>> On Fri, Dec 16, 2022 at 11:04 AM Konrad Windszus <kw...@apache.org> wrote:
>>>>>
>>>>> TBH I don’t yet see use cases for failing when the node does already
>>>>> exist (create node in your proposal) nor for failing when the node does
>>>>> not exist (update node)
>>>>> Can you share some examples you have in mind which would benefit from
>>>>> that functionality?
>>>>> (We also don’t have anything like that for set properties AFAIK)
>>>>>
>>>>> Thanks,
>>>>> Konrad
>>>>>
>>>>>
>>>>>> On 16. Dec 2022, at 19:59, Eric Norman <en...@apache.org> wrote:
>>>>>>
>>>>>> For me the proposed "strict" modifier doesn't seem obvious what it is
>>>>> going
>>>>>> to do.
>>>>>>
>>>>>> I would prefer a more verbose language with several options and let me
>>>>>> choose which one to use. In other words, deprecate the original
>>>>>> (ambiguous) "create path" syntax and replace it with a new
>>>>>> "[create|update|createOrUpdate] node" syntax that is more clear what is
>>>>>> expected to happen.
>>>>>>
>>>>>> For example:
>>>>>>
>>>>>> # the original syntax (leave as is for backward compatibility).
>>>>>> # This would be similar to the "createOrUpdate" use case without any
>>>>>> # attempts to change the primaryNodeType and mixinTypes of already
>>>>>> existing nodes
>>>>>> create path (nt:folder) /one(mixin nt:art)/step(mixin
>>>>> nt:dance)/two/steps
>>>>>>
>>>>>> #
>>>>>>
>>>>> ----------------------------------------------------------------------------------------
>>>>>> # ----------------- New replacement
>>>>>> syntax -----------------------------------------------
>>>>>> #
>>>>>>
>>>>> ----------------------------------------------------------------------------------------
>>>>>>
>>>>>> # new syntax that will fail if any of the paths already exist
>>>>>> create node (nt:folder) /one(mixin nt:art)/step(mixin
>>>>> nt:dance)/two/steps
>>>>>>
>>>>>> # new syntax that will fail if any of the affected paths do not already
>>>>>> exist
>>>>>> # and would attempt to change the primaryNodeType and mixinTypes where
>>>>>> specified
>>>>>> update node (nt:folder) /one(mixin nt:art)/step(mixin
>>>>> nt:dance)/two/steps
>>>>>>
>>>>>> # new syntax that will create nodes that do not yet exist and update
>>>>> nodes
>>>>>> that do already exist
>>>>>> # by attempting to change the primaryNodeType and mixinTypes where
>>>>>> specified
>>>>>> createOrUpdate node (nt:folder) /one(mixin
>>>>>> nt:art)/step(mixin nt:dance)/two/steps
>>>>>>
>>>>>>
>>>>>>
>>>>>> Regards,
>>>>>> -Eric
>>>>>>
>>>>>> On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
>>>>>> wrote:
>>>>>>
>>>>>>> On 16.12.2022 14:38, Konrad Windszus wrote:
>>>>>>>>
>>>>>>>>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <
>>>>> bdelacretaz@apache.org>
>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> So in the case of SLING-11736 I have proposed adding a [strict]
>>>>> option
>>>>>>>>> to "create path", exemple:
>>>>>>>>>
>>>>>>>>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
>>>>>>>>> nt:dance)/two/steps
>>>>>>>>>
>>>>>>>>> which activates the improved behavior proposed in that ticket
>>>>>>>>> (adjusting primary + mixin types of existing nodes if needed),
>>>>> without
>>>>>>>>> changing the behavior for existing code.
>>>>>>>>>
>>>>>>>>> I think that's inline with the above principles, WDYT?
>>>>>>>>>
>>>>>>>>> -Bertrand
>>>>>>>>
>>>>>>>>
>>>>>>>> I don’t like this for the reasons outlined at
>>>>>>>
>>>>> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
>>>>>>>>
>>>>>>>> "From an end user perspective deprecating one statement and
>>>>> introducing
>>>>>>> a new one with a more concise name is better than just adding the
>>>>> option
>>>>>>> strict to existing statements with fuzzy names like “path”:
>>>>>>>>
>>>>>>>> Also I consider the statement name “create path” very inconcise as
>>>>>>> adding properties in JCR is also creating a “path”.
>>>>>>>> Since for backwards compatibility reasons users of the existing
>>>>> “create
>>>>>>> path” which want to leverage the stricter handling in any way have to
>>>>>>> update the statement they should rather replace “create path” by
>>>>> “create
>>>>>>> node” instead of adding a new option “strict”. IMHO that makes the
>>>>>>> statement also easier to read/understand.
>>>>>>>
>>>>>>> Feedback from an innocent bystander: if the command already has a
>>>>> poorly
>>>>>>> chosen name, it really makes sense to add a new command with precisely
>>>>>>> defined semantics and a clear failure mode.
>>>>>>>
>>>>>>> (so, no to adding "strict" here)
>>>>>>>
>>>>>>> Best regards, Julian
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Julian Sedding <js...@gmail.com>.
How about "ensure node"? It's shorter than "updateOrCreate node",
which to me seems likely the most common case.
Regards
Julian
PS: my preference is also with deprecating "create path" in favour of
a new clearly defined instruction.
On Mon, Dec 19, 2022 at 7:21 AM Konrad Windszus <ko...@gmx.de> wrote:
>
> Thanks for the use cases. But then „create node“ according to your proposal would only work exactly once. A restart of the runtime or just the sling jcr bundle would automatically fail because then the node would already be there when the statement is executed again….
> So IMHO only update and updateOrCreate are useful.
> WDYT,
> Konrad
>
>
> > Am 16.12.2022 um 20:42 schrieb Eric Norman <en...@apache.org>:
> >
> > Also, another use case I was thinking of for the "update node" scenario is
> > if you want to add a mixin to a node that was expected to be already
> > created elsewhere, if the node doesn't exist yet then your mixin won't get
> > assigned and you could have indeterminate behavior later. So failing fast
> > would quickly tell you something is wrong.
> >
> > Regards,
> > -Eric
> >
> >> On Fri, Dec 16, 2022 at 11:19 AM Eric Norman <en...@apache.org> wrote:
> >>
> >> TBH I don’t yet see use cases for failing when the node does already
> >>> exist (create node in your proposal) nor for failing when the node does
> >>> not exist (update node)
> >>>
> >>
> >> Yes, that is kind of the point. You can't possibly conceive every
> >> possible use case, so just make the language generic enough to satisfy a
> >> broad set of use cases. I can envision a highly modular distribution in
> >> which two modules (from different owners) may accidentally have paths that
> >> collide. So I can see how a repoinit that would fail fast in that scenario
> >> could be useful. In other words, if someone else already created a path
> >> (with the wrong types) that you are not expecting to be there, then failing
> >> right away seems like a reasonable solution.
> >>
> >> (We also don’t have anything like that for set properties AFAIK)
> >>>
> >>
> >> I think the "[set|default] propertyName ..." syntax is conceptually
> >> similar. In that, the "default" operator would only modify the value if it
> >> does not already have a non-default value.
> >>
> >> Regards,
> >> -Eric
> >>
> >>> On Fri, Dec 16, 2022 at 11:04 AM Konrad Windszus <kw...@apache.org> wrote:
> >>>
> >>> TBH I don’t yet see use cases for failing when the node does already
> >>> exist (create node in your proposal) nor for failing when the node does
> >>> not exist (update node)
> >>> Can you share some examples you have in mind which would benefit from
> >>> that functionality?
> >>> (We also don’t have anything like that for set properties AFAIK)
> >>>
> >>> Thanks,
> >>> Konrad
> >>>
> >>>
> >>>> On 16. Dec 2022, at 19:59, Eric Norman <en...@apache.org> wrote:
> >>>>
> >>>> For me the proposed "strict" modifier doesn't seem obvious what it is
> >>> going
> >>>> to do.
> >>>>
> >>>> I would prefer a more verbose language with several options and let me
> >>>> choose which one to use. In other words, deprecate the original
> >>>> (ambiguous) "create path" syntax and replace it with a new
> >>>> "[create|update|createOrUpdate] node" syntax that is more clear what is
> >>>> expected to happen.
> >>>>
> >>>> For example:
> >>>>
> >>>> # the original syntax (leave as is for backward compatibility).
> >>>> # This would be similar to the "createOrUpdate" use case without any
> >>>> # attempts to change the primaryNodeType and mixinTypes of already
> >>>> existing nodes
> >>>> create path (nt:folder) /one(mixin nt:art)/step(mixin
> >>> nt:dance)/two/steps
> >>>>
> >>>> #
> >>>>
> >>> ----------------------------------------------------------------------------------------
> >>>> # ----------------- New replacement
> >>>> syntax -----------------------------------------------
> >>>> #
> >>>>
> >>> ----------------------------------------------------------------------------------------
> >>>>
> >>>> # new syntax that will fail if any of the paths already exist
> >>>> create node (nt:folder) /one(mixin nt:art)/step(mixin
> >>> nt:dance)/two/steps
> >>>>
> >>>> # new syntax that will fail if any of the affected paths do not already
> >>>> exist
> >>>> # and would attempt to change the primaryNodeType and mixinTypes where
> >>>> specified
> >>>> update node (nt:folder) /one(mixin nt:art)/step(mixin
> >>> nt:dance)/two/steps
> >>>>
> >>>> # new syntax that will create nodes that do not yet exist and update
> >>> nodes
> >>>> that do already exist
> >>>> # by attempting to change the primaryNodeType and mixinTypes where
> >>>> specified
> >>>> createOrUpdate node (nt:folder) /one(mixin
> >>>> nt:art)/step(mixin nt:dance)/two/steps
> >>>>
> >>>>
> >>>>
> >>>> Regards,
> >>>> -Eric
> >>>>
> >>>> On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
> >>>> wrote:
> >>>>
> >>>>> On 16.12.2022 14:38, Konrad Windszus wrote:
> >>>>>>
> >>>>>>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <
> >>> bdelacretaz@apache.org>
> >>>>> wrote:
> >>>>>>>
> >>>>>>> So in the case of SLING-11736 I have proposed adding a [strict]
> >>> option
> >>>>>>> to "create path", exemple:
> >>>>>>>
> >>>>>>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
> >>>>>>> nt:dance)/two/steps
> >>>>>>>
> >>>>>>> which activates the improved behavior proposed in that ticket
> >>>>>>> (adjusting primary + mixin types of existing nodes if needed),
> >>> without
> >>>>>>> changing the behavior for existing code.
> >>>>>>>
> >>>>>>> I think that's inline with the above principles, WDYT?
> >>>>>>>
> >>>>>>> -Bertrand
> >>>>>>
> >>>>>>
> >>>>>> I don’t like this for the reasons outlined at
> >>>>>
> >>> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
> >>>>>>
> >>>>>> "From an end user perspective deprecating one statement and
> >>> introducing
> >>>>> a new one with a more concise name is better than just adding the
> >>> option
> >>>>> strict to existing statements with fuzzy names like “path”:
> >>>>>>
> >>>>>> Also I consider the statement name “create path” very inconcise as
> >>>>> adding properties in JCR is also creating a “path”.
> >>>>>> Since for backwards compatibility reasons users of the existing
> >>> “create
> >>>>> path” which want to leverage the stricter handling in any way have to
> >>>>> update the statement they should rather replace “create path” by
> >>> “create
> >>>>> node” instead of adding a new option “strict”. IMHO that makes the
> >>>>> statement also easier to read/understand.
> >>>>>
> >>>>> Feedback from an innocent bystander: if the command already has a
> >>> poorly
> >>>>> chosen name, it really makes sense to add a new command with precisely
> >>>>> defined semantics and a clear failure mode.
> >>>>>
> >>>>> (so, no to adding "strict" here)
> >>>>>
> >>>>> Best regards, Julian
> >>>>>
> >>>>>
> >>>
> >>>
>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <ko...@gmx.de>.
Thanks for the use cases. But then „create node“ according to your proposal would only work exactly once. A restart of the runtime or just the sling jcr bundle would automatically fail because then the node would already be there when the statement is executed again….
So IMHO only update and updateOrCreate are useful.
WDYT,
Konrad
> Am 16.12.2022 um 20:42 schrieb Eric Norman <en...@apache.org>:
>
> Also, another use case I was thinking of for the "update node" scenario is
> if you want to add a mixin to a node that was expected to be already
> created elsewhere, if the node doesn't exist yet then your mixin won't get
> assigned and you could have indeterminate behavior later. So failing fast
> would quickly tell you something is wrong.
>
> Regards,
> -Eric
>
>> On Fri, Dec 16, 2022 at 11:19 AM Eric Norman <en...@apache.org> wrote:
>>
>> TBH I don’t yet see use cases for failing when the node does already
>>> exist (create node in your proposal) nor for failing when the node does
>>> not exist (update node)
>>>
>>
>> Yes, that is kind of the point. You can't possibly conceive every
>> possible use case, so just make the language generic enough to satisfy a
>> broad set of use cases. I can envision a highly modular distribution in
>> which two modules (from different owners) may accidentally have paths that
>> collide. So I can see how a repoinit that would fail fast in that scenario
>> could be useful. In other words, if someone else already created a path
>> (with the wrong types) that you are not expecting to be there, then failing
>> right away seems like a reasonable solution.
>>
>> (We also don’t have anything like that for set properties AFAIK)
>>>
>>
>> I think the "[set|default] propertyName ..." syntax is conceptually
>> similar. In that, the "default" operator would only modify the value if it
>> does not already have a non-default value.
>>
>> Regards,
>> -Eric
>>
>>> On Fri, Dec 16, 2022 at 11:04 AM Konrad Windszus <kw...@apache.org> wrote:
>>>
>>> TBH I don’t yet see use cases for failing when the node does already
>>> exist (create node in your proposal) nor for failing when the node does
>>> not exist (update node)
>>> Can you share some examples you have in mind which would benefit from
>>> that functionality?
>>> (We also don’t have anything like that for set properties AFAIK)
>>>
>>> Thanks,
>>> Konrad
>>>
>>>
>>>> On 16. Dec 2022, at 19:59, Eric Norman <en...@apache.org> wrote:
>>>>
>>>> For me the proposed "strict" modifier doesn't seem obvious what it is
>>> going
>>>> to do.
>>>>
>>>> I would prefer a more verbose language with several options and let me
>>>> choose which one to use. In other words, deprecate the original
>>>> (ambiguous) "create path" syntax and replace it with a new
>>>> "[create|update|createOrUpdate] node" syntax that is more clear what is
>>>> expected to happen.
>>>>
>>>> For example:
>>>>
>>>> # the original syntax (leave as is for backward compatibility).
>>>> # This would be similar to the "createOrUpdate" use case without any
>>>> # attempts to change the primaryNodeType and mixinTypes of already
>>>> existing nodes
>>>> create path (nt:folder) /one(mixin nt:art)/step(mixin
>>> nt:dance)/two/steps
>>>>
>>>> #
>>>>
>>> ----------------------------------------------------------------------------------------
>>>> # ----------------- New replacement
>>>> syntax -----------------------------------------------
>>>> #
>>>>
>>> ----------------------------------------------------------------------------------------
>>>>
>>>> # new syntax that will fail if any of the paths already exist
>>>> create node (nt:folder) /one(mixin nt:art)/step(mixin
>>> nt:dance)/two/steps
>>>>
>>>> # new syntax that will fail if any of the affected paths do not already
>>>> exist
>>>> # and would attempt to change the primaryNodeType and mixinTypes where
>>>> specified
>>>> update node (nt:folder) /one(mixin nt:art)/step(mixin
>>> nt:dance)/two/steps
>>>>
>>>> # new syntax that will create nodes that do not yet exist and update
>>> nodes
>>>> that do already exist
>>>> # by attempting to change the primaryNodeType and mixinTypes where
>>>> specified
>>>> createOrUpdate node (nt:folder) /one(mixin
>>>> nt:art)/step(mixin nt:dance)/two/steps
>>>>
>>>>
>>>>
>>>> Regards,
>>>> -Eric
>>>>
>>>> On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
>>>> wrote:
>>>>
>>>>> On 16.12.2022 14:38, Konrad Windszus wrote:
>>>>>>
>>>>>>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <
>>> bdelacretaz@apache.org>
>>>>> wrote:
>>>>>>>
>>>>>>> So in the case of SLING-11736 I have proposed adding a [strict]
>>> option
>>>>>>> to "create path", exemple:
>>>>>>>
>>>>>>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
>>>>>>> nt:dance)/two/steps
>>>>>>>
>>>>>>> which activates the improved behavior proposed in that ticket
>>>>>>> (adjusting primary + mixin types of existing nodes if needed),
>>> without
>>>>>>> changing the behavior for existing code.
>>>>>>>
>>>>>>> I think that's inline with the above principles, WDYT?
>>>>>>>
>>>>>>> -Bertrand
>>>>>>
>>>>>>
>>>>>> I don’t like this for the reasons outlined at
>>>>>
>>> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
>>>>>>
>>>>>> "From an end user perspective deprecating one statement and
>>> introducing
>>>>> a new one with a more concise name is better than just adding the
>>> option
>>>>> strict to existing statements with fuzzy names like “path”:
>>>>>>
>>>>>> Also I consider the statement name “create path” very inconcise as
>>>>> adding properties in JCR is also creating a “path”.
>>>>>> Since for backwards compatibility reasons users of the existing
>>> “create
>>>>> path” which want to leverage the stricter handling in any way have to
>>>>> update the statement they should rather replace “create path” by
>>> “create
>>>>> node” instead of adding a new option “strict”. IMHO that makes the
>>>>> statement also easier to read/understand.
>>>>>
>>>>> Feedback from an innocent bystander: if the command already has a
>>> poorly
>>>>> chosen name, it really makes sense to add a new command with precisely
>>>>> defined semantics and a clear failure mode.
>>>>>
>>>>> (so, no to adding "strict" here)
>>>>>
>>>>> Best regards, Julian
>>>>>
>>>>>
>>>
>>>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Eric Norman <en...@apache.org>.
Also, another use case I was thinking of for the "update node" scenario is
if you want to add a mixin to a node that was expected to be already
created elsewhere, if the node doesn't exist yet then your mixin won't get
assigned and you could have indeterminate behavior later. So failing fast
would quickly tell you something is wrong.
Regards,
-Eric
On Fri, Dec 16, 2022 at 11:19 AM Eric Norman <en...@apache.org> wrote:
> TBH I don’t yet see use cases for failing when the node does already
>> exist (create node in your proposal) nor for failing when the node does
>> not exist (update node)
>>
>
> Yes, that is kind of the point. You can't possibly conceive every
> possible use case, so just make the language generic enough to satisfy a
> broad set of use cases. I can envision a highly modular distribution in
> which two modules (from different owners) may accidentally have paths that
> collide. So I can see how a repoinit that would fail fast in that scenario
> could be useful. In other words, if someone else already created a path
> (with the wrong types) that you are not expecting to be there, then failing
> right away seems like a reasonable solution.
>
> (We also don’t have anything like that for set properties AFAIK)
>>
>
> I think the "[set|default] propertyName ..." syntax is conceptually
> similar. In that, the "default" operator would only modify the value if it
> does not already have a non-default value.
>
> Regards,
> -Eric
>
> On Fri, Dec 16, 2022 at 11:04 AM Konrad Windszus <kw...@apache.org> wrote:
>
>> TBH I don’t yet see use cases for failing when the node does already
>> exist (create node in your proposal) nor for failing when the node does
>> not exist (update node)
>> Can you share some examples you have in mind which would benefit from
>> that functionality?
>> (We also don’t have anything like that for set properties AFAIK)
>>
>> Thanks,
>> Konrad
>>
>>
>> > On 16. Dec 2022, at 19:59, Eric Norman <en...@apache.org> wrote:
>> >
>> > For me the proposed "strict" modifier doesn't seem obvious what it is
>> going
>> > to do.
>> >
>> > I would prefer a more verbose language with several options and let me
>> > choose which one to use. In other words, deprecate the original
>> > (ambiguous) "create path" syntax and replace it with a new
>> > "[create|update|createOrUpdate] node" syntax that is more clear what is
>> > expected to happen.
>> >
>> > For example:
>> >
>> > # the original syntax (leave as is for backward compatibility).
>> > # This would be similar to the "createOrUpdate" use case without any
>> > # attempts to change the primaryNodeType and mixinTypes of already
>> > existing nodes
>> > create path (nt:folder) /one(mixin nt:art)/step(mixin
>> nt:dance)/two/steps
>> >
>> > #
>> >
>> ----------------------------------------------------------------------------------------
>> > # ----------------- New replacement
>> > syntax -----------------------------------------------
>> > #
>> >
>> ----------------------------------------------------------------------------------------
>> >
>> > # new syntax that will fail if any of the paths already exist
>> > create node (nt:folder) /one(mixin nt:art)/step(mixin
>> nt:dance)/two/steps
>> >
>> > # new syntax that will fail if any of the affected paths do not already
>> > exist
>> > # and would attempt to change the primaryNodeType and mixinTypes where
>> > specified
>> > update node (nt:folder) /one(mixin nt:art)/step(mixin
>> nt:dance)/two/steps
>> >
>> > # new syntax that will create nodes that do not yet exist and update
>> nodes
>> > that do already exist
>> > # by attempting to change the primaryNodeType and mixinTypes where
>> > specified
>> > createOrUpdate node (nt:folder) /one(mixin
>> > nt:art)/step(mixin nt:dance)/two/steps
>> >
>> >
>> >
>> > Regards,
>> > -Eric
>> >
>> > On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
>> > wrote:
>> >
>> >> On 16.12.2022 14:38, Konrad Windszus wrote:
>> >>>
>> >>>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <
>> bdelacretaz@apache.org>
>> >> wrote:
>> >>>>
>> >>>> So in the case of SLING-11736 I have proposed adding a [strict]
>> option
>> >>>> to "create path", exemple:
>> >>>>
>> >>>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
>> >>>> nt:dance)/two/steps
>> >>>>
>> >>>> which activates the improved behavior proposed in that ticket
>> >>>> (adjusting primary + mixin types of existing nodes if needed),
>> without
>> >>>> changing the behavior for existing code.
>> >>>>
>> >>>> I think that's inline with the above principles, WDYT?
>> >>>>
>> >>>> -Bertrand
>> >>>
>> >>>
>> >>> I don’t like this for the reasons outlined at
>> >>
>> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
>> >>>
>> >>> "From an end user perspective deprecating one statement and
>> introducing
>> >> a new one with a more concise name is better than just adding the
>> option
>> >> strict to existing statements with fuzzy names like “path”:
>> >>>
>> >>> Also I consider the statement name “create path” very inconcise as
>> >> adding properties in JCR is also creating a “path”.
>> >>> Since for backwards compatibility reasons users of the existing
>> “create
>> >> path” which want to leverage the stricter handling in any way have to
>> >> update the statement they should rather replace “create path” by
>> “create
>> >> node” instead of adding a new option “strict”. IMHO that makes the
>> >> statement also easier to read/understand.
>> >>
>> >> Feedback from an innocent bystander: if the command already has a
>> poorly
>> >> chosen name, it really makes sense to add a new command with precisely
>> >> defined semantics and a clear failure mode.
>> >>
>> >> (so, no to adding "strict" here)
>> >>
>> >> Best regards, Julian
>> >>
>> >>
>>
>>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Eric Norman <en...@apache.org>.
>
> TBH I don’t yet see use cases for failing when the node does already
> exist (create node in your proposal) nor for failing when the node does
> not exist (update node)
>
Yes, that is kind of the point. You can't possibly conceive every possible
use case, so just make the language generic enough to satisfy a broad set
of use cases. I can envision a highly modular distribution in which two
modules (from different owners) may accidentally have paths that collide.
So I can see how a repoinit that would fail fast in that scenario could be
useful. In other words, if someone else already created a path (with the
wrong types) that you are not expecting to be there, then failing right
away seems like a reasonable solution.
(We also don’t have anything like that for set properties AFAIK)
>
I think the "[set|default] propertyName ..." syntax is conceptually
similar. In that, the "default" operator would only modify the value if it
does not already have a non-default value.
Regards,
-Eric
On Fri, Dec 16, 2022 at 11:04 AM Konrad Windszus <kw...@apache.org> wrote:
> TBH I don’t yet see use cases for failing when the node does already
> exist (create node in your proposal) nor for failing when the node does
> not exist (update node)
> Can you share some examples you have in mind which would benefit from that
> functionality?
> (We also don’t have anything like that for set properties AFAIK)
>
> Thanks,
> Konrad
>
>
> > On 16. Dec 2022, at 19:59, Eric Norman <en...@apache.org> wrote:
> >
> > For me the proposed "strict" modifier doesn't seem obvious what it is
> going
> > to do.
> >
> > I would prefer a more verbose language with several options and let me
> > choose which one to use. In other words, deprecate the original
> > (ambiguous) "create path" syntax and replace it with a new
> > "[create|update|createOrUpdate] node" syntax that is more clear what is
> > expected to happen.
> >
> > For example:
> >
> > # the original syntax (leave as is for backward compatibility).
> > # This would be similar to the "createOrUpdate" use case without any
> > # attempts to change the primaryNodeType and mixinTypes of already
> > existing nodes
> > create path (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
> >
> > #
> >
> ----------------------------------------------------------------------------------------
> > # ----------------- New replacement
> > syntax -----------------------------------------------
> > #
> >
> ----------------------------------------------------------------------------------------
> >
> > # new syntax that will fail if any of the paths already exist
> > create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
> >
> > # new syntax that will fail if any of the affected paths do not already
> > exist
> > # and would attempt to change the primaryNodeType and mixinTypes where
> > specified
> > update node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
> >
> > # new syntax that will create nodes that do not yet exist and update
> nodes
> > that do already exist
> > # by attempting to change the primaryNodeType and mixinTypes where
> > specified
> > createOrUpdate node (nt:folder) /one(mixin
> > nt:art)/step(mixin nt:dance)/two/steps
> >
> >
> >
> > Regards,
> > -Eric
> >
> > On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
> > wrote:
> >
> >> On 16.12.2022 14:38, Konrad Windszus wrote:
> >>>
> >>>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <
> bdelacretaz@apache.org>
> >> wrote:
> >>>>
> >>>> So in the case of SLING-11736 I have proposed adding a [strict] option
> >>>> to "create path", exemple:
> >>>>
> >>>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
> >>>> nt:dance)/two/steps
> >>>>
> >>>> which activates the improved behavior proposed in that ticket
> >>>> (adjusting primary + mixin types of existing nodes if needed), without
> >>>> changing the behavior for existing code.
> >>>>
> >>>> I think that's inline with the above principles, WDYT?
> >>>>
> >>>> -Bertrand
> >>>
> >>>
> >>> I don’t like this for the reasons outlined at
> >>
> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
> >>>
> >>> "From an end user perspective deprecating one statement and introducing
> >> a new one with a more concise name is better than just adding the option
> >> strict to existing statements with fuzzy names like “path”:
> >>>
> >>> Also I consider the statement name “create path” very inconcise as
> >> adding properties in JCR is also creating a “path”.
> >>> Since for backwards compatibility reasons users of the existing “create
> >> path” which want to leverage the stricter handling in any way have to
> >> update the statement they should rather replace “create path” by “create
> >> node” instead of adding a new option “strict”. IMHO that makes the
> >> statement also easier to read/understand.
> >>
> >> Feedback from an innocent bystander: if the command already has a poorly
> >> chosen name, it really makes sense to add a new command with precisely
> >> defined semantics and a clear failure mode.
> >>
> >> (so, no to adding "strict" here)
> >>
> >> Best regards, Julian
> >>
> >>
>
>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <kw...@apache.org>.
TBH I don’t yet see use cases for failing when the node does already exist (create node in your proposal) nor for failing when the node does not exist (update node)
Can you share some examples you have in mind which would benefit from that functionality?
(We also don’t have anything like that for set properties AFAIK)
Thanks,
Konrad
> On 16. Dec 2022, at 19:59, Eric Norman <en...@apache.org> wrote:
>
> For me the proposed "strict" modifier doesn't seem obvious what it is going
> to do.
>
> I would prefer a more verbose language with several options and let me
> choose which one to use. In other words, deprecate the original
> (ambiguous) "create path" syntax and replace it with a new
> "[create|update|createOrUpdate] node" syntax that is more clear what is
> expected to happen.
>
> For example:
>
> # the original syntax (leave as is for backward compatibility).
> # This would be similar to the "createOrUpdate" use case without any
> # attempts to change the primaryNodeType and mixinTypes of already
> existing nodes
> create path (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
>
> #
> ----------------------------------------------------------------------------------------
> # ----------------- New replacement
> syntax -----------------------------------------------
> #
> ----------------------------------------------------------------------------------------
>
> # new syntax that will fail if any of the paths already exist
> create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
>
> # new syntax that will fail if any of the affected paths do not already
> exist
> # and would attempt to change the primaryNodeType and mixinTypes where
> specified
> update node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
>
> # new syntax that will create nodes that do not yet exist and update nodes
> that do already exist
> # by attempting to change the primaryNodeType and mixinTypes where
> specified
> createOrUpdate node (nt:folder) /one(mixin
> nt:art)/step(mixin nt:dance)/two/steps
>
>
>
> Regards,
> -Eric
>
> On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
> wrote:
>
>> On 16.12.2022 14:38, Konrad Windszus wrote:
>>>
>>>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <bd...@apache.org>
>> wrote:
>>>>
>>>> So in the case of SLING-11736 I have proposed adding a [strict] option
>>>> to "create path", exemple:
>>>>
>>>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
>>>> nt:dance)/two/steps
>>>>
>>>> which activates the improved behavior proposed in that ticket
>>>> (adjusting primary + mixin types of existing nodes if needed), without
>>>> changing the behavior for existing code.
>>>>
>>>> I think that's inline with the above principles, WDYT?
>>>>
>>>> -Bertrand
>>>
>>>
>>> I don’t like this for the reasons outlined at
>> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
>>>
>>> "From an end user perspective deprecating one statement and introducing
>> a new one with a more concise name is better than just adding the option
>> strict to existing statements with fuzzy names like “path”:
>>>
>>> Also I consider the statement name “create path” very inconcise as
>> adding properties in JCR is also creating a “path”.
>>> Since for backwards compatibility reasons users of the existing “create
>> path” which want to leverage the stricter handling in any way have to
>> update the statement they should rather replace “create path” by “create
>> node” instead of adding a new option “strict”. IMHO that makes the
>> statement also easier to read/understand.
>>
>> Feedback from an innocent bystander: if the command already has a poorly
>> chosen name, it really makes sense to add a new command with precisely
>> defined semantics and a clear failure mode.
>>
>> (so, no to adding "strict" here)
>>
>> Best regards, Julian
>>
>>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Eric Norman <en...@apache.org>.
For me the proposed "strict" modifier doesn't seem obvious what it is going
to do.
I would prefer a more verbose language with several options and let me
choose which one to use. In other words, deprecate the original
(ambiguous) "create path" syntax and replace it with a new
"[create|update|createOrUpdate] node" syntax that is more clear what is
expected to happen.
For example:
# the original syntax (leave as is for backward compatibility).
# This would be similar to the "createOrUpdate" use case without any
# attempts to change the primaryNodeType and mixinTypes of already
existing nodes
create path (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
#
----------------------------------------------------------------------------------------
# ----------------- New replacement
syntax -----------------------------------------------
#
----------------------------------------------------------------------------------------
# new syntax that will fail if any of the paths already exist
create node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
# new syntax that will fail if any of the affected paths do not already
exist
# and would attempt to change the primaryNodeType and mixinTypes where
specified
update node (nt:folder) /one(mixin nt:art)/step(mixin nt:dance)/two/steps
# new syntax that will create nodes that do not yet exist and update nodes
that do already exist
# by attempting to change the primaryNodeType and mixinTypes where
specified
createOrUpdate node (nt:folder) /one(mixin
nt:art)/step(mixin nt:dance)/two/steps
Regards,
-Eric
On Fri, Dec 16, 2022 at 6:53 AM Julian Reschke <ju...@gmx.de>
wrote:
> On 16.12.2022 14:38, Konrad Windszus wrote:
> >
> >> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <bd...@apache.org>
> wrote:
> >>
> >> So in the case of SLING-11736 I have proposed adding a [strict] option
> >> to "create path", exemple:
> >>
> >> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
> >> nt:dance)/two/steps
> >>
> >> which activates the improved behavior proposed in that ticket
> >> (adjusting primary + mixin types of existing nodes if needed), without
> >> changing the behavior for existing code.
> >>
> >> I think that's inline with the above principles, WDYT?
> >>
> >> -Bertrand
> >
> >
> > I don’t like this for the reasons outlined at
> https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
> >
> > "From an end user perspective deprecating one statement and introducing
> a new one with a more concise name is better than just adding the option
> strict to existing statements with fuzzy names like “path”:
> >
> > Also I consider the statement name “create path” very inconcise as
> adding properties in JCR is also creating a “path”.
> > Since for backwards compatibility reasons users of the existing “create
> path” which want to leverage the stricter handling in any way have to
> update the statement they should rather replace “create path” by “create
> node” instead of adding a new option “strict”. IMHO that makes the
> statement also easier to read/understand.
>
> Feedback from an innocent bystander: if the command already has a poorly
> chosen name, it really makes sense to add a new command with precisely
> defined semantics and a clear failure mode.
>
> (so, no to adding "strict" here)
>
> Best regards, Julian
>
>
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Julian Reschke <ju...@gmx.de>.
On 16.12.2022 14:38, Konrad Windszus wrote:
>
>> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <bd...@apache.org> wrote:
>>
>> So in the case of SLING-11736 I have proposed adding a [strict] option
>> to "create path", exemple:
>>
>> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
>> nt:dance)/two/steps
>>
>> which activates the improved behavior proposed in that ticket
>> (adjusting primary + mixin types of existing nodes if needed), without
>> changing the behavior for existing code.
>>
>> I think that's inline with the above principles, WDYT?
>>
>> -Bertrand
>
>
> I don’t like this for the reasons outlined at https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
>
> "From an end user perspective deprecating one statement and introducing a new one with a more concise name is better than just adding the option strict to existing statements with fuzzy names like “path”:
>
> Also I consider the statement name “create path” very inconcise as adding properties in JCR is also creating a “path”.
> Since for backwards compatibility reasons users of the existing “create path” which want to leverage the stricter handling in any way have to update the statement they should rather replace “create path” by “create node” instead of adding a new option “strict”. IMHO that makes the statement also easier to read/understand.
Feedback from an innocent bystander: if the command already has a poorly
chosen name, it really makes sense to add a new command with precisely
defined semantics and a clear failure mode.
(so, no to adding "strict" here)
Best regards, Julian
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Konrad Windszus <ko...@gmx.de>.
> On 16. Dec 2022, at 14:31, Bertrand Delacretaz <bd...@apache.org> wrote:
>
> So in the case of SLING-11736 I have proposed adding a [strict] option
> to "create path", exemple:
>
> create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
> nt:dance)/two/steps
>
> which activates the improved behavior proposed in that ticket
> (adjusting primary + mixin types of existing nodes if needed), without
> changing the behavior for existing code.
>
> I think that's inline with the above principles, WDYT?
>
> -Bertrand
I don’t like this for the reasons outlined at https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/41#issuecomment-1354488929
"From an end user perspective deprecating one statement and introducing a new one with a more concise name is better than just adding the option strict to existing statements with fuzzy names like “path”:
Also I consider the statement name “create path” very inconcise as adding properties in JCR is also creating a “path”.
Since for backwards compatibility reasons users of the existing “create path” which want to leverage the stricter handling in any way have to update the statement they should rather replace “create path” by “create node” instead of adding a new option “strict”. IMHO that makes the statement also easier to read/understand.
Konrad
Re: RepoInit: Intended behaviour in case of failures and backwards-compatibility
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
Konrad Windszus wrote:
> ...There are some issues with RepoInit with regards to failure behaviour like [1] and [2]...
I think we should keep the existing principles in repoinit, and as you
say clarify them in the documentation:
- repoinit is strictly backwards compatible, we try very hard to avoid
any changes in its behavior for existing scripts
- failing statements prevent the content repository from starting, to
avoid exposing potentially harmful states
- the language can evolve in a backwards compatible way to improve or
clarify the repoinit behavior
- we strive to keep the language evolutions minimalistic, clean and
independent of implementation details
So in the case of SLING-11736 I have proposed adding a [strict] option
to "create path", exemple:
create path [strict] (nt:folder) /one(mixin nt:art)/step(mixin
nt:dance)/two/steps
which activates the improved behavior proposed in that ticket
(adjusting primary + mixin types of existing nodes if needed), without
changing the behavior for existing code.
I think that's inline with the above principles, WDYT?
-Bertrand