- πΊπΈUnited States smustgrave
If still a valid task wonder if the issue summary could be updated please.
- Status changed to Needs review
about 1 year ago 12:40pm 4 September 2023 - last update
about 1 year ago 30,340 pass, 1 fail - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
I stumbled upon this from another issue.
This issue exists to address @effulgentsia's feedback at #1845546-121: Implement validation for the TypedData API β and @fago argued at #1845546-122: Implement validation for the TypedData API β it should be done in a follow-up. This is that follow-up.
But this issue predates us having solid strategies for making changes like that happen.
So β¦ this must do a deprecation. Although AFAICT nothing in core is even using this anymore, with the exception of
\Drupal\KernelTests\Core\Entity\BundleConstraintValidatorTest::assertValidation()
. Not even\Drupal\Tests\Core\Plugin\Context\EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedByPassBundledEntity()
. Let's find out! The last submitted patch, 16: 1905620-16.patch, failed testing. View results β
- Assigned to fago
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
We could totally continue with #16 here.
But as I wrote at #3382581-12: Add new `EntityBundleExists` constraint β :
- I did a review in which I tried to RTBC this. And in doing so, I discovered the existence of
\Drupal\Core\Entity\Plugin\Validation\Constraint\BundleConstraint
(introduced in #1845546: Implement validation for the TypedData API β , with a follow-up that I just pushed forward after >10 years of silence: π Enforce the bundle constraint option to be always an array Needs work ).I think we should document what the difference is between the (existing)
Bundle
and (new)BundleExists
.AFAICT
BundleConstraint
should never have existed β¦ it should just have used theChoice
constraint instead?! It has existed since 2010, so it's not like it wasn't available π - β¦
β¦ maybe the correct course of action here is to:
- Deprecate
Bundle
altogether and switch toChoice
- Alternatively, make
Bundle
an alias ofChoice
.
Note that
Choice
was explicitly added to Drupal core in β¨ Add a `langcode` data type to config schema Fixed β lots of things in Drupal core already use it! - I did a review in which I tried to RTBC this. And in doing so, I discovered the existence of
- π«π·France andypost
Curious how it will affect existing code which is using
Bundle
in block annotations - Status changed to Needs work
about 1 year ago 5:54pm 27 September 2023 - πΊπΈUnited States smustgrave
Of the 2 options
1. Deprecate Bundle altogether and switch to Choice
2. Alternatively, make Bundle an alias of Choice.Think 1 makes the most sense.
Making an alias even though it should cover backwards compatibility, think the idea of having 2 constraints around that do the same could be confusing to some.
- last update
about 1 year ago Custom Commands Failed - Assigned to wim leers
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
π Add new `EntityBundleExists` constraint Fixed landed!
#20: I agree. Except that the validation error message for
Bundle
kinda makes more sense. Still, let's find out how much change it would cause if we actually removed this constraint. - Issue was unassigned.
- Status changed to Needs review
10 months ago 1:18pm 31 January 2024 - π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
In trying to do #21, I discovered I was wrong in #18.
Choice
works at the (property) value level.Bundle
works at the entity object (EntityAdapter
to be exact) level.Change record created for just this tiny deprecation.
P.S.: @effulgentsia wrote #1845546-121: Implement validation for the TypedData API β .1 (which triggered this issue) exactly 11 years ago today.
- Status changed to RTBC
9 months ago 8:41pm 6 February 2024 - πΊπΈUnited States smustgrave
Ran test-only feature and got a failure, see https://git.drupalcode.org/issue/drupal-1905620/-/jobs/723178
Updated the CR slightly to include an example, for visual people like myself.
Code looks good to me.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Thanks! The changes to the change record weren't quite accurate though, so fixed that. Please check it again and see if you like it? :)
- Status changed to Needs review
9 months ago 11:17am 9 February 2024 - π¬π§United Kingdom catch
I think the deprecation here should probably be for 12.0.0 now unless we really need to drop it in 11.x per discussion in π± Defer disruptive 10.3 deprecations for removal until 12.0 Active .
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Is this truly disruptive? It's a trivial change that modules can make today and it'd work fine all the way back to Drupal 8? π€
P.S.: following that issue now β very interesting!
- π§πͺBelgium borisson_ Mechelen, π§πͺ
I would like to move this back to RTBC and say this isn't truly disruptive, but I actually think it is, we don't know how custom entities look and for them they it would be a change.
Should be simple enough to just update the number in the deprecation
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Should be simple enough to just update the number in the deprecation
π Let's do that.
- Status changed to Needs work
9 months ago 2:39pm 9 February 2024 - πΊπΈUnited States smustgrave
Probably fine to self RTBC after that update.
- π¬π§United Kingdom catch
It's a trivial change that modules can make today and it'd work fine all the way back to Drupal 8?
This is very true, but if they're minimally/under-maintained and already have Drupal 11 compatible releases (or if they don't need any other changes other than .info.yml so far), then it's disruptive for sites trying to update to Drupal 11 and finding out modules aren't compatible. You only need one or two modules not ready to delay a site update, and those modules only need one or two small deprecations preventing a fully 11.x-compatible release to be the ones that cause the delay - so lots of small core deprecations can add up.
For internal stuff where the bc we add is 'best effort' anyway like constructor changes, we definitely shouldn't apply this, especially because multiple changes to the same constructor gets cumulatively harder to account for. But public API breaks where the bc layer is easy, I think it's nicer to do this for the few months before the major release - if it's likely to cause pain, we can always decide the other way.
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
π Thanks for that extra context, @catch!
- First commit to issue fork.
- Status changed to Needs review
2 months ago 10:04am 7 September 2024 - π¬π§United Kingdom longwave UK
I don't get why we need to do this. DX is slightly nicer if developers can pass a string in the simple case or an array of strings otherwise. Given it's been over 10 years since this was proposed are there better things to work on?
- Status changed to RTBC
about 2 months ago 1:57pm 17 September 2024 - πΊπΈUnited States smustgrave
Regarding #35 believe that should be answered by committer team?
But looking at the MR believe all feedback has been addressed.
- π³πΏNew Zealand quietone
There is one question remaining, which is whether to do this or not. See the remaining tasks in the issue summary.
- π¬π§United Kingdom catch
Agreed with #35, I think we should mark this 'by design' and just support a single bundle or an array. There's no justification given in the issue summary or in @effulgentsia's original comment which is just one sentence of a larger review.