- Status changed to Active
almost 2 years ago 1:02pm 15 February 2023 - ๐ฎ๐ณIndia kunal.sachdev
kunal.sachdev โ made their first commit to this issueโs fork.
- Assigned to kunal.sachdev
- @kunalsachdev opened merge request.
- ๐ฎ๐ณIndia kunal.sachdev
So, I started to rename things from Stage/stage to StageManager/stage manager but in
\Drupal\package_manager\StatusCheckTrait
I refactored* @param \Drupal\package_manager\Stage $stage * The stage to run the status check for.
to
* @param \Drupal\package_manager\StageManager $stage_manager * The stage manager to run the status check for.
but it's sounding a little vague, there can be more such cases where stage manager wording is not suitable. So, should we think of another name?
- Issue was unassigned.
- Status changed to Postponed: needs info
almost 2 years ago 12:11pm 20 February 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Let's discuss with @tedbow & @phenaproxima tomorrow.
- Status changed to Needs work
almost 2 years ago 2:19pm 21 February 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Honestly...I like
StageManager
as a new name forStage
. I think it's not particularly verbose, and it's a lot clearer than stage. It inherently implies certain already-existing design decisions (namely, you have only one stage at any given time).I'm going to open an MR to rename it.
- Status changed to Needs review
over 1 year ago 5:02pm 10 March 2023 - Status changed to Needs work
over 1 year ago 12:36pm 13 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
WFM! But there's still some unaddressed problems then:
- Many comments no longer make sense โ see MR for details.
- We should rename
\Drupal\package_manager\StageManager::getStagingRoot()
to::getRoot()
- We should rename
\Drupal\package_manager\PathLocator::getStagingRoot()
to::getStageRoot()
- ๐บ๐ธUnited States phenaproxima Massachusetts
Many comments no longer make sense
Yeah, this is gonna be messy.
Agreed on the method renames, and implemented.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Yeah, this is gonna be messy.
Messy today, virtually impossible once it's in core! ๐ So it's the right kind of mess/pain ๐
- Assigned to wim leers
- Status changed to Needs review
over 1 year ago 9:20pm 16 March 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
I think I've fixed most instances of "stage" across Package Manager and Automatic Updates.
No doubt there are still some stragglers here and there which evaded my heuristics, but those should be easy to clean up later. I'm guessing they are all just in comments. This MR renames Stage to StageManager, and TestStage to TestStageManager.
- Assigned to phenaproxima
- Status changed to Needs work
over 1 year ago 12:15pm 17 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Checked it out locally and searched in PHPStorm for the
stage\W
regex to find remaining "stage" occurrences.99% of them made sense ๐
Stragglers:
StageManager $stage
should becomeStageManager $stage_manager
everywhere.-
* \Drupal\package_manager\Event\PreOperationStageEvent. All events have a * $stage property which allows access to the stage object itself.
โ this is where point 1 actually affects the public API in a perhaps unexpected way!
-
$stage = $this->updater;
$stage instanceof
i.e. whenever
$stage
is the variable/property name, but it's not "the stage", but instead "the stage manager". -
// We only want to do this check if the stage belongs to Automatic Updates.
โ similarly: stage manager, not stage. But this is the only such remaining comment reference I could find! ๐ (It occurs in three files though.)
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ Reviewed using
git diff 4ea1985d0beeb0d401bc1adefa7af1b459c9adfc HEAD
.It's thanks to the challenges I spotted during this review that I thought of an alternative approach:
- An abstract basic stage with no specializations:
Stage(Manager)
โabstract BasicStage
orSimpleStage
- Non-abstract specialized stages:
Updater
โUpdateStage
andCronUpdater
โCronUpdateStage
- Only
\Drupal\package_manager\PackageManagerUninstallValidator
and\Drupal\package_manager_test_api\ApiController::create()
instantiate aStage(Manager)
, we could easily provide an anonymous class in both places to overcome that challenge.
I think that'd actually be far closer to the reality we want? We would then:
- only ever use specialized "stages", except in one test and a very abstract/generic uninstallation validator
- still be able to keep all the existing docs about "The stage for which to fire an event" etc โ it'll just then be very clear that the PHP type declaration refers to the basic stage, but only a concrete/specalized stage can be passed in
๐ This is exactly what we have for
(Content)EntityBase
!Because
\Drupal\project_browser\ComposerInstaller\Installer
can then becomeInstallerStage
. - An abstract basic stage with no specializations:
- ๐บ๐ธUnited States tedbow Ithaca, NY, USA
- re #23 I am not opposed to making
\Drupal\package_manager\Stage
an abstract call and changingUpdater
โUpdateStage
andCronUpdater
โCronUpdateStage
it seems like a good thing to do. - Regarding the current use of Stage directly in
\Drupal\package_manager\PackageManagerUninstallValidator
. I think it would be better here to make a non-abstractAvailabilityCheckerStage
or something along those lines which would only allow callingisAvailable()
andisApply()
so that it would very clear how you can check these things if you wanted to stop other operations from happening while Package Manager was applying. I think us making a non-test anonymous class would set a bad example because someone could see that example and think "oh if I just want require a package real quick I could also just make anonymous class". So we would have to document why our use of anonymous class was ok but for other operations it is bad idea(assuming it is). I thinkAvailabilityCheckerStage
would be clearer - Just having the abstract
Stage
class though doesn't really solve the problems stated in the summary- "stage" is both a noun and a verb, but inconsistent with the above
- it's too closely aligned with "stage directory", "staging area", etc
I think maybe it just proves that
StageManager
is not that much better
I would suggest we create another issue to
Stage
abstract- create
AvailabilityCheckerStage
which would get rid of 1 non-test anonymous stage use. - rename
Updater
โUpdateStage
andCronUpdater
โCronUpdateStage
Then we just leave this issue open because I still think we have solved the naming problem of "stage" as described in the summary. Maybe as we get more fresh eyes in the this review process someone will come up with a more obvious name
- re #23 I am not opposed to making
- Assigned to tedbow
- Status changed to Needs review
over 1 year ago 5:55pm 29 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Then why not just change
class Stage
toabstract class StageBase
?Thatโs what I actually already proposed in my previous comment:
abstract class BasicStage
orabstract class SimpleStage
.All three of these choices make it clear itโs a noun and not a verb.
- Issue was unassigned.
- Status changed to Needs work
over 1 year ago 4:49pm 30 March 2023 - ๐บ๐ธUnited States tedbow Ithaca, NY, USA
Then why not just change class Stage to abstract class StageBase?
That sounds good to me plus a new
AvailabilityCheckerStage
forPackageManagerUninstallValidator
- Assigned to kunal.sachdev
- @kunalsachdev opened merge request.
- ๐ฎ๐ณIndia kunal.sachdev
In #3326486-24: Rename \Drupal\package_manager\Stage to StageManager for clarity and consistency โ .2 how we would allow it to only call isAvailable() and isApply().
- ๐ฎ๐ณIndia kunal.sachdev
Discussed with @tedbow and @phenaproxima about #24 ๐ Rename Stage to StageBase to clarify its relationship to its subclasses, and add "Stage" suffix to the Updater classes Fixed .2 and got to a conclusion that for now we can have anonymous class as suggested by @Wim Leers in #23 ๐ Rename Stage to StageBase to clarify its relationship to its subclasses, and add "Stage" suffix to the Updater classes Fixed .3
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ฅณ Glad to see this happening! ๐
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 6:19am 6 April 2023 - Assigned to yash.rode
- Assigned to kunal.sachdev
- Status changed to Needs work
over 1 year ago 9:37am 6 April 2023 - ๐ฎ๐ณIndia yash.rode pune
\Drupal\Tests\automatic_updates_extensions\Kernel\ExtensionUpdaterTest
\Drupal\Tests\package_manager\Unit\StageTest
\Drupal\Tests\package_manager\Kernel\StageTest
\Drupal\Tests\automatic_updates\Kernel\TestCronUpdater and \Drupal\Tests\automatic_updates\Kernel\CronUpdaterTest
should also be renamed. Other than that I can confirm all occurrences of
ExtensionUpdater are replaced with ExtensionUpdateStage,
Stage are replaced with StageBase,
Updater are replaced with UpdateStage and
CronUpdater are replaced with CronUpdateStage. - Assigned to yash.rode
- Status changed to Needs review
over 1 year ago 8:33am 10 April 2023 - Issue was unassigned.
- Assigned to phenaproxima
- ๐บ๐ธUnited States phenaproxima Massachusetts
Ooof, 74 files changed...! Self-assigning to review.
- Assigned to kunal.sachdev
- Status changed to Needs work
over 1 year ago 2:42pm 10 April 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
As I looked at this, I felt that the class renaming is so effective that, indeed, things like
ExtensionUpdateStage $extensionUpdateStage
are redundant! I think it would be clear to sayExtensionUpdateStage $stage
, and it'd be quite clear that this is a type of stage.But, just to sanity check myself, I proposed this to @tedbow as well in a Zoom conversation, and he agreed that the type hints are so much clearer that we can remove verbose, redundant variable and method names. So that's what I'm going to do in my review -- point out the places where we could rename these.
That said, this is great work and I think it's a good solution to this problem. Well done all!
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 11:28am 11 April 2023 - Assigned to kunal.sachdev
- Status changed to Needs work
over 1 year ago 12:19pm 11 April 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Looks great!
One or two small things, then this is good to go from a code perspective. Apart from that, this only needs the follow-up @tedbow requested in #24 to be filed, at which point this is RTBC.
- Assigned to phenaproxima
- Status changed to Needs review
over 1 year ago 1:28pm 11 April 2023 - Status changed to RTBC
over 1 year ago 1:39pm 11 April 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Love it.
RTBC once the follow-up is open.
- ๐บ๐ธUnited States phenaproxima Massachusetts
In discussion with @kunal.sachdev and @tedbow in Slack, we came to the conclusion that we don't need the follow-up to create AvailabilityCheckerStage, because it's probably overkill at the moment. The only place we need to generically check stage availability is in Package Manager's uninstall validator, and the anonymous class is fine for that right now.
-
phenaproxima โ
committed a90285a7 on 3.0.x authored by
kunal.sachdev โ
Issue #3326486 by kunal.sachdev, phenaproxima, Wim Leers, tedbow, yash....
-
phenaproxima โ
committed a90285a7 on 3.0.x authored by
kunal.sachdev โ
- Issue was unassigned.
- Status changed to Fixed
over 1 year ago 2:25pm 11 April 2023 Automatically closed - issue fixed for 2 weeks with no activity.