Problem/Motivation
$ git lg package_manager/package_manager.api.php
* 115bcad - Hotfix spelling error in Package Manager API documentation. (9 months ago) <Phéna Proxima>
* ec507ef - Issue #3248976 by phenaproxima: Add API documentation for Package Manager (9 months ago) <phenaproxima>
yet:
$ git lg --since "9 months ago" -- package_manager | wc -l
156
It looks like package_manager.api.php is so general that it is not wrong, but it certainly is incomplete. For example, there's no mention of ReadinessCheckEvent nor StatusCheckEvent.
And a few days ago, #3304365: Do not check excluded folders for symlinks landed which deprecated PreCreateEvent::excludePath(), but it's still mentioned in package_manager.api.php as the official API.
This is necessary to meet the documentation gate: https://www.drupal.org/about/core/policies/core-change-policies/core-gat....
Steps to reproduce
N/A
Proposed resolution
Particular items that need documenting
- re #3328978: Do we want to Throw an Exception if a git directory unknown to composer is added in Stage? we should clearly document package manager expects the stage to be only operated on via composer stager, i.e. if you run other file operations on the stage that are not composer operations you are on your own and it is not how the system is intended to work.
COMMIT NOTE:
Please remember to omit credit for #4, which did not make any change to the documentation (or code).
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | 3318306-26.patch | 7.51 KB | wim leers |
Issue fork automatic_updates-3318306
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 #2
wim leersComment #3
rohit.rawat619 commentedComment #4
rohit.rawat619 commentedComment #5
wim leersThere's nothing to review in #4? 😅
No new documentation at all. Only out-of-scope changes.
Comment #6
wim leersThis touches on a crucial other subject too: not only is the documentation incomplete, it's also unclear what actually is part of the Package Manager API and what is not.
At #3323003-3: Mark FailureMarker @internal and document ComposerUtility, PathLocator and ValidationResult, I proposed closing that issue in favor of this one.
Comment #7
tedbowComment #8
phenaproximaAdjusting credits. The patch in #4 didn't seem to add anything useful so I don't think it should get credit.
Comment #9
phenaproximaComment #10
tedbowre #3328978: Do we want to Throw an Exception if a git directory unknown to composer is added in Stage? we should clearly document package manager expects the stage to be only operated on via composer stager, i.e. if you run other file operations on the stage that are not composer operations you are on your own and it is not how the system is intended to work.
Comment #11
wim leersQuoting #3331168-10: Limit trusted Composer plugins to a known list, allow user to add more:
Comment #12
wim leersComment #13
tedbowComment #14
tedbowcreate #3336243: Update Package Manager event documentation in package_manager.api.php as a child issue so we can tackle a small part of this
Comment #15
wim leers👍 Let's avoid conflicting with that issue! 😄
Comment #16
wim leers#3336243: Update Package Manager event documentation in package_manager.api.php landed, this is now unblocked 👍
Comment #17
wim leersGiven #3341469-2: Create StageBase::stageDirectoryExists() for improved DX to see if stage directory exists., I'll take this on.
Comment #18
phenaproximaComment #19
tedbowComment #20
wim leersWaiting for #3323003: Mark FailureMarker @internal and document ComposerUtility, PathLocator and ValidationResult to land first…
Comment #21
phenaproximaBlocker is in!
Comment #22
phenaproximaTrying to adjust credit given that the patch in #4 makes no actual changes to the documentation.
Comment #23
phenaproximaComment #24
phenaproximaComment #25
phenaproximaComment #26
wim leersMirrored the structure of
core/modules/ckeditor5/ckeditor5.api.php, the corresponding output of which can be seen at https://api.drupal.org/api/drupal/core%21modules%21ckeditor5%21ckeditor5....Comment #27
wim leersSelf-review for context
These are arguably the most contentious bits.
See #3341469-7: Create StageBase::stageDirectoryExists() for improved DX to see if stage directory exists. and preceding discussion.
I tried to clarify here what I thought in #3341469-2: Create StageBase::stageDirectoryExists() for improved DX to see if stage directory exists. to be wrong, which @phenaproxima said at #3341469-4: Create StageBase::stageDirectoryExists() for improved DX to see if stage directory exists. to be correct, but then my detailed investigation at #3341469-7: Create StageBase::stageDirectoryExists() for improved DX to see if stage directory exists. showed that it was actually wrong, just in a pretty subtle way.
I tried to make this clear once and for all by documenting it like this — hope y'all like it 😊
Comment #28
phenaproximaThis looks pretty good to me, but I'm not sure I should give the final sign-off. For the simple reason that I'm too close to this code. I've been living and breathing Package Manager for over a year. Almost any explanation of its internals will make sense to me, because my mind will automatically fill in the gaps.
I think I want this to be reviewed by someone with much less familiarity with the internals before I commit it.
Comment #29
wim leersLooks like I missed my opportunity to get
lorem ipsumcommitted as official docs 🤣🤣🤣I'm glad that at least you found nothing wrong! 🥳
But if you can't commit it, then only @tedbow can IMHO. Given his role on this project, I think that probably makes sense anyway 👍
Comment #30
phenaproximaDon't get me wrong: I'm happy to commit it. I did read the diff and the changes made sense.
I merely want a second pair of eyes to review it first, a set of eyes that hasn't had my level of exposure to Package Manager.
Comment #31
chrisfromredfinHi all, just chiming in here. I downloaded 3.0.x, applied the patch, and just read package_manager.api.php from top to bottom.
Overall, this absolutely gives me an understanding of how Package Manager works. I had only three things come to mind as I read it:
Comment #32
phenaproximaThis is great feedback.
I believe you're referring to:
I can see why this would seem odd, and maybe we can clarify it. What it comes down to is that, for Package Manager, "ownership" consists of two things -- a random token, and the fully qualified name of the Stage that you called create() on. You need both of these things in order to reclaim the stage in subsequent requests and do things to it.
Yeah, we would expect code that integrates with Package Manager (a custom validator or event subscriber) to stop propagation if they encounter some catastrophic condition that's going to break any further subscribers. Symfony Event objects have a stopPropagation() method we would expect them to call, so let's add a reference to that.
And while we're at it, let's fix the longer-than-80-characters lines. :)
Comment #33
wim leersAddressing the feedback, and adding the docs that #3334994: Add new InstalledPackagesList which does not rely on Composer API to get package info should've added.
Comment #34
wim leersAlso removing the docs that #3344039 should have removed (see #3344039-20: Add a validate() method to ComposerInspector to ensure that Composer is usable).
Comment #35
wim leersNow waiting for #3312960: Create an API for base requirement validators which run before other validators and stop event propagation if they fail to land, because that is changing this file too.
Comment #36
wim leersAdam said he'd take this on! 🥳
Comment #38
phenaproximaWent over this from top to bottom and I reorganized and pushed and pulled until I think it's both accurate and comprehensive.
I'd like review from Wim, since he's great at clarity and accuracy...and I'd also like a review from a consumer of Package Manager (that means @bnjmnm or @chrisfromredfin) before we commit.
Comment #39
phenaproximaComment #40
wim leersReview posted.
I don't think we need +1s from Package Manager consumers because this clearly is a massive leap forward. Any further improvements can happen at a later time — this is actively blocking the core alpha-experimental MR!
Comment #41
phenaproxima🏓
Comment #42
wim leersA huge leap forward, go for launch! 🚀
Comment #43
phenaproximaComment #45
phenaproximaWhew!