This is our plan to move the code in the `sdc` module to the core namespace while maintaining backwards compatibility with the experimental module.
Merge Request Strategy
We have this META issue to move all the core from the current location in the experimental module into the Drupal\Core namespace. This meta issue will have a **draft** MR associated against HEAD (currently 11.x).
We will break tasks to move the code into smaller issues which will contain any potential discussion on the implementation. This will allow us to make more sense of the conversations, and to parallelize tasks with other contributors. Each one of these smaller issues will contain an MR against the branch for the META issue. As we merge these MRs for the smaller issues, the bigger diff will start to build up in the draft MR associated to the META issue.
Once we have all the smaller issues merged, we will work to clear the release manager and commit manager tags from the big MR, in order to get it merged. We also plan on requesting validation from core committers in these smaller issues, in order to raise any concerns early on.
Backwards Compatibility
The `sdc.module` file contains the following:
// Set class aliases for the classes that will go into core.
// See the experimental modules policy https://www.drupal.org/core/experimental
// @todo: remove class aliases in #3354389
@class_alias('Drupal\sdc\Element\ComponentElement', 'Drupal\Core\Render\Element\ComponentElement');
@class_alias('Drupal\sdc\Exception\ComponentNotFoundException', 'Drupal\Core\Render\Component\Exception\ComponentNotFoundException');
@class_alias('Drupal\sdc\Exception\IncompatibleComponentSchema', 'Drupal\Core\Render\Component\Exception\IncompatibleComponentSchema');
@class_alias('Drupal\sdc\Exception\InvalidComponentDataException', 'Drupal\Core\Render\Component\Exception\InvalidComponentDataException');
@class_alias('Drupal\sdc\Exception\InvalidComponentException', 'Drupal\Core\Render\Component\Exception\InvalidComponentException');
All classes in sdc are marked as @internal. We understand that the Drupal core backwards compatibility policy includes classes and services marked internal. All classes in sdc are also final (with the exception of Drupal\sdc\Element\ComponentElement) which will make it impossible to extend them. However, we acknowledge that manual instantiation and execution of static public methods still require backwards compatibility.
In order to provide backwards compatibility, we propose to use class_alias. This will handle the namepace changes. A deprecation notice will be thrown because the module itself is deprecated. In order to clear the deprecation the user will need to change their use statements using the list of class_alias in sdc.module as a reference.
Additional Considerations
We will not merge this until feedback from experimental users is done in regards to the other issues in our roadmap to stability. Therefore, we will keep this updated during the process and then merge as a last step.
Remove deprecated twig functions declared in #3409456: Remove SDC deprecated code before 11.0.0
Issues
- Component\ComponentMetadata.php
- #3365467: Move SDC Component namespace to Core namespace
- Component\ComponentValidator.php
- #3365467: Move SDC Component namespace to Core namespace
- Component\SchemaCompatibilityChecker.php
- #3365467: Move SDC Component namespace to Core namespace
- ComponentNegotiator.php
- #3365686: Move SDC ComponentNegotiator to Core namespace
- ComponentPluginManager.php
- #3365690: Move SDC ComponentPluginManager namespace to Core namespace
- Element\ComponentElement.php
- #3365693: Move SDC Element\ComponentElement to Core namespace
- Exception\ComponentNotFoundException.php
- #3365468: Move SDC Exceptions to Core namespace
- Exception\IncompatibleComponentSchema.php
- #3365468: Move SDC Exceptions to Core namespace
- Exception\InvalidComponentDataException.php
- #3365468: Move SDC Exceptions to Core namespace
- Exception\InvalidComponentException.php
- #3365468: Move SDC Exceptions to Core namespace
- ExtensionType.php
- #3365695: Move SDC ExtensionType to Core namespace
- Plugin\Component.php
- #3365699: Move SDC Component to Core namespace
- Plugin\Discovery\DirectoryWithMetadataDiscovery.php
- #3365700: Move SDC Discovery namespace to Core namespace
- Plugin\Discovery\DirectoryWithMetadataPluginDiscovery.php
- #3365700: Move SDC Discovery namespace to Core namespace
- Plugin\Discovery\RegexRecursiveFilterIterator.php
- #3365700: Move SDC Discovery namespace to Core namespace
- Twig\ComponentNodeVisitor.php
- #3365702: Move SDC Drupal\sdc\Twig to Core namespace
- Twig\TwigComponentLoader.php
- #3365702: Move SDC Drupal\sdc\Twig to Core namespace
- Twig\TwigExtension.php
- #3365702: Move SDC Drupal\sdc\Twig to Core namespace
- Utilities.php
- #3352858: Move isRenderArray from SDC to Drupal\Core\Render\Element
- metadata-full.schema.json
- #3365711: Move SDC *.schema.json to Core namespace
- metadata.schema.json
- #3365711: Move SDC *.schema.json to Core namespace
- sdc.module
- #3365714: Move SDC sdc.module functions to Core namespace
- sdc.services.yml
- No issue necessary, it will be handled in the issues moving each of the service classes.
- tests/*
- #3406356: Move SDC tests/* to Core namespace
Release notes
The single directory components module is now deprecated. The functionality has been moved to Drupal core.
| Comment | File | Size | Author |
|---|---|---|---|
| #108 | 3352256-nr-bot.txt | 90 bytes | needs-review-queue-bot |
| #101 | 3352256-nr-bot.txt | 90 bytes | needs-review-queue-bot |
| #68 | 3352256-nr-bot.txt | 90 bytes | needs-review-queue-bot |
Issue fork drupal-3352256
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
e0ipsoComment #4
e0ipsoComment #5
bbralaLets add a todo list of the stuff that needs moving.
Comment #6
bbralaComment #7
bbralaComment #8
bbralaIt doesnt like wide table, sorry.
Comment #9
bbralaComment #10
bbralaComment #11
bbralaComment #12
dwwThanks for organizing all this as a meta issue!
From reading some of the child issues, it seems like the idea is that each issue will open MRs vs this one branch, not against core itself? So someone will decide to merge MRs into here and then the final commit to core will be a monolithic, giant commit? It’d be great to be clear in this parent meta issue so everyone working on this knows what to expect.
Also, not clear what we need a table for here. 😅 seems like a
<dl>would be easier to work with and make more semantic sense. 🤓 Unless there are going to be more columns that don’t yet exist for other things?Thanks again!
-Derek
Comment #13
bbralaYeah we merge against this feature branch. I will open the branches and mr's to this branch today so we dont need to figure that out later.
THere were more columns in my original table, but that broke the layout of the issue. I will convert it to a definition list when i arrive in the contrib rooms in pittsburgh.
Comment #14
e0ipsoWe will also need a plan to move
sdc_library_info_buildto the corresponding location. Likely close to the code that is firinghook_library_info_build.Comment #15
bbralaComment #16
bbralaComment #17
bbralaComment #18
bbralaComment #19
e0ipsoUpdated issue summary.
Comment #20
bbralaComment #21
bbralaComment #22
bbralaComment #23
bbralaComment #24
bbralaComment #25
bbralaComment #26
bbralaComment #27
bbralaComment #28
dwwFantastic, thanks! That's much more clear. 😅
Today is packed, then I travel tomorrow, but hopefully I can spare some cycles on some of the child issues next week... 🤞 Following them all now, at least. 😉
Cheers,
-Derek
Comment #30
bbralaI've also opened a draft merge request to this issue for each child issue. Mostly because we don't use the default workflow since we are merging those issues towards this issue branch instead of main itself.
#3365714: Move SDC sdc.module functions to Core namespace might need splitting, because it is about 2 functions in the module file.
Also i didnt open an issue for the tests, they would also need updating in eather the issues that change them, or centrally. But i think there will be less discussion on those, since they might live in places based on the results of the child issues.
Comment #31
bbralaCurrently the MR in this issue is not mergable, but that should resolve itself when code has actually changed in the branch. Which is hasn't right now.
Comment #32
dwwWhoops. I was trying to help move #3352858: Move isRenderArray from SDC to Drupal\Core\Render\Element forward, cherry-pick'ed my commit into this branch and pushed. I now realize I believe y'all wanted that in MR form, not a direct push. 😬 Should I revert, or do y'all wanna just leave it? It was already RTBC when it was a stand-alone commit. Sorry!
Comment #33
e0ipso@dww I think all is fine. As you say, code was already RTBC. First one is in! Thanks for moving it! Let's keep rolling them in.
Comment #34
dieterholvoet commentedComment #35
e0ipsoComment #37
e0ipso#3365711: Move SDC *.schema.json to Core namespace was merged. Creditting @plopesc for that part.
Comment #38
e0ipso#3365467: Move SDC Component namespace to Core namespace is merged.
Comment #39
e0ipso#3365686: Move SDC ComponentNegotiator to Core namespace is also done. Thanks to @plopesc again!
Comment #42
e0ipsoI just re-rolled 11.x. Likely we won't need to do this again since this issue is the last blocker for stable.
Comment #44
e0ipso#3365468: Move SDC Exceptions to Core namespace made it to this branch.
Comment #45
e0ipso#3365700: Move SDC Discovery namespace to Core namespace was pretty uncontroversial.
Comment #46
e0ipsoComment #47
e0ipsoWe have #3365693: Move SDC Element\ComponentElement to Core namespace now!
Comment #48
e0ipsoMerged #3365714: Move SDC sdc.module functions to Core namespace. One step closer.
Comment #49
e0ipso#3406223: [SDC] Catch missing imports and deprecation messages was the next in line to complete.
Comment #50
plopescAdded reference to #3409456: Remove SDC deprecated code before 11.0.0
Comment #51
e0ipso#3365702: Move SDC Drupal\sdc\Twig to Core namespace is in! So close!
Comment #52
e0ipso#3365699: Move SDC Component to Core namespace is now merged here.
Comment #53
e0ipsoOnly tests are missing now.
Comment #54
e0ipsoComment #57
e0ipsoTests are green and all the initial tasks are done. I think it's time for a review.
Comment #58
e0ipsoComment #59
e0ipsoI scaffolded https://www.drupal.org/node/3410260 so we can have a URL to reference in the deprecation messages.
Comment #60
catch@e0ipso if the entire module is deprecated, then the code doesn't need to be deprecated too as such - people will know they need to uninstall it.
Comment #61
e0ipsoI think I got the class_alias wrong. I believe I need to change the alias direction.
Comment #62
e0ipsoI also see this error:
Comment #63
e0ipsoComment #64
e0ipsoSome tests are failing. Investigating.
Comment #65
e0ipsoI forgot to remove the dependency of Umami on SDC. Let's see if tests pass now.
Comment #66
e0ipsoTests are green now. This is finally ready for review.
Comment #67
e0ipsoComment #68
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #69
e0ipsoMerged 11.x into this branch.
Comment #70
e0ipsoComment #71
catchComment #72
quietone commentedThe IS has this
But what is 'the big MR'?
Comment #73
e0ipso@quietone we created a feature branch for this issue. We then opened MRs to this issue's branch to start contributing code in smaller bits. This allowed us to have a more manageable scope for peer review and for comments. All the code accumulated in this branch, as soon as we thought it was ready.
Now this issue's branch contains all the code, it is the big MR against 11.x.
I hope that makes sense.
Comment #74
plopescGiven that Mateu, Stephen and myself have been reviewing all the individual parts that make up this MR, I feel confident in setting this to RTBC.
Thank you!
Comment #75
catchThe MR pipeline failed three weeks ago, I just re-ran it and it failed again.
Comment #76
e0ipsoI just re-rolled it. Let's see if that fixes it.
Comment #77
e0ipsoThis commit above adapts some of the code after #3414807: \Drupal\Core\Asset\LibraryDiscoveryParser should use FileCache to cache the parsed YAML.
Let's see if we get a green.
Comment #78
plopescOnce the MR has been rebased and the merge conflicts solved, I think it is OK to move it back to RTBC.
Thank you!
Comment #79
longwaveAfter applying the MR there are a number of references to
sdcremaining, added some comments to see if we can reduce/remove these.Comment #80
e0ipso@longwave I addressed your comments in the MR.
Comment #81
e0ipso@longwave are you good to move it back to RTBC?
Comment #82
longwaveAdded another round of questions/feedback to the MR.
Comment #83
e0ipso@longwave most of those comments belong to code that has been moved, rather than changed. This MR is scoped only to moving the code that was approved in the experimental module to its final home. There will be minor changes in code to ensure BC, and some new code in the LibraryDiscoveryParser, but that should be it.
Even if the diff is very big, the changes are not that big.
That being said, I am interested in pursuing the conversations you started but I fear that might derail the scope of this big-enough MR. What do you thing is the best way to address your concerns? Would a follow up issue be a good place for it, or would you rather do it all here?
Comment #84
longwaveAs mentioned in Slack the only
twothree things I am really concerned about here are:I think the others can wait for followups.
Comment #85
longwaveOh, would also be interested in your thoughts on service naming as well, because all other core services have friendly string names instead of just class names.
Comment #86
e0ipsoYes. This is how we tried to handle it. This section of the code generates the libraries with the old names for backwards compatibility reasons.
I see that there is a small error with the wording of the deprecation message that I will fix right away.
The relevant conversations can be found in #3365714: Move SDC sdc.module functions to Core namespace and in its corresponding MR.
Comment #87
e0ipsoYeah. We touched on that during our conversations while moving it. This is the comment from @plopesc:
Do you think that reverting the changes to
TwigExtensionand moving the SDC Twig extension toDrupal\Core\Template\ComponentsTwigExtensionis a better approach? I felt good about both options back in the day, so I'll be happy to implement it.The relevant conversations can be found in #3365702: Move SDC Drupal\sdc\Twig to Core namespace, and its corresponding MR.
Comment #88
e0ipsoYou are correct, I will push a fix right away.
Comment #89
e0ipso@longwave thank you so much for your rounds of review. I know this is a big MR, with lots of context, and most of it is hidden behind children issues. I tried to organize it in sub-issues to facilitate development and review, it turns out it's been more difficult for everyone involved. Sorry.
Comment #90
e0ipsoThrowing something at the CI before logging off. I will finish applying the feedback in the morning.
Comment #91
e0ipsoThis is something suggested by @larowlan in the MR that got SDC in core as experimental.
Comment #92
e0ipsoSetting back to Needs Review.
Comment #93
longwaveThanks for fixing the BC layer in the constructor.
I added a question about the library BC layer - not sure
strtr()does what you expect here, as it replaces bytes in a string?Going to ask the framework managers for input on:
Comment #94
e0ipso@longwave I fixed the library bc layer and added a test for it.
Comment #95
longwaveTagging for the framework managers to answer #93 but other than that I think we are done here, thank you for all your work on getting this in!
Comment #96
catchEventually we're likely to remove service aliases for things where we don't expect anyone to interact with the service name, but not sure why we're setting a precedent here. On the other hand, is it worth adding the aliases only to remove them later. Don't feel strongly about this to be honest.
I'm confused about what's going on with the TwigExtension - it looks like there's now a dedicated component twig extension, but there are still two additional arguments for the main twig extension, was the separate twig extension already created and those are just cruft, or am I missing something? Looking at the long list of arguments to TwigExtension, I think keeping two separate classes makes sense, but then why would we be adding extra dependencies to the main one?
Comment #97
longwaveMany tests are failing.
Comment #98
e0ipsoSorry @longwave it seems the suppression file had a syntax issue. It is fixed now.
Comment #99
e0ipso@catch you are correct, that is some cruft from the other day when I split that service in two. I will fix now.
Comment #100
nod_Just wanted to raise a point for Framework Managers about the $schema URL in the components definition.
What we expect folks to add to their metadata yml file is
$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/v1/metadata.schema.jsonfor better DX so that IDEs can provide autocompletion.I'm not sure pointing to the repo HEAD is the best thing. We can change the schema version by adding a
v2folder and updating the URL, keeping all the versions all the time in the repo.what I'm not sure is if this URL is going to last 10 years, and if having all the different versions in HEAD is what we want, sounds like it could be somewhere else and not tied to the source of Drupal. Then again it makes sense to have it in the source since that's where all the stuff is defined to begin with.
I don't have a good answer, just questions but I don't think they should hold up this patch.
Comment #101
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #102
nod_I committed a couple of umami components, please update their $schema url as part of this MR :)
#3365497: Create new SDC component for Umami Banner
#3404302: Create header component for Umami, with JS
Comment #103
e0ipsoPipeline is back to green.
I resolved merge conflicts and addressed @nod_'s request in #102.
Comment #104
plopescFeedback has been addressed and tests are green.
I think we can move it back to RTBC.
Comment #105
longwaveAdded some questions about the schema URLs.
Comment #106
e0ipsoYeah. I have addressed that. Sorry for the hasty change, I keep finding myself out of context for this issue every time I work on it. Thanks for catching it. Schema URLs are not super important but we got to get them right.
Comment #107
longwaveI've read over the MR multiple times now and there are only really minor nits remaining that ultimately don't matter and could be fixed in followups if needed, so this looks ready to go to me now.
Comment #108
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #109
nod_merged and tests still passing
Comment #110
larowlanNice work folks, left a couple of items on the MR, mostly minor stuff
Comment #111
e0ipsoReview feedback implemented. Everything is back to green. Setting back to NR.
Comment #112
e0ipsoOh no, I might have been looking at the wrong thing. I see an issue about deprecation messages. Investigating.
Comment #113
e0ipsoReview feedback implemented. Everything is back to green. Setting back to NR.
[déjà vu]
Comment #114
longwaveI retitled the CR as it sounded previously like we were deprecating SDC if you did not read it carefully. All the recent changes look good so back to RTBC.
Comment #115
e0ipsoResolved merge conflicts and fixed an issue number to point the the CR.
Comment #116
larowlanLooks like one item still open in the MR
Comment #117
e0ipsoMoving back to RTBC.
Comment #121
larowlanCommitted to 11.x and backported to 10.3.x
Published change record
🎉 Congratulations - huge effort
Added a release note snippet