Problem/Motivation

VersionPolicyValidator uses Stage::getActiveComposer(), which returns a ComposerUtility. #3316368: Remove our runtime dependency on composer/composer: remove ComposerUtility is removing that.

Proposed resolution

Refactor it to use ComposerInspector instead.

Remaining tasks

Do it!

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon 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

Wim Leers created an issue. See original summary.

tedbow made their first commit to this issue’s fork.

tedbow’s picture

Just gave this a start. Not assigning to myself

tedbow’s picture

Status: Active » Postponed

I think this is blocked on #3345754: Updater should use ComposerInspector instead of ComposerUtility because it need to ask the update which versions it is going update to.

wim leers’s picture

Title: VersionPolicyValidator should use ComposerInspector instead of ComposerUtility » [PP-1] VersionPolicyValidator should use ComposerInspector instead of ComposerUtility
Related issues: +#3345754: Updater should use ComposerInspector instead of ComposerUtility
phenaproxima’s picture

Title: [PP-1] VersionPolicyValidator should use ComposerInspector instead of ComposerUtility » VersionPolicyValidator should use ComposerInspector instead of ComposerUtility
Status: Postponed » Needs work

Blocker is in!

wim leers’s picture

Assigned: Unassigned » wim leers

#3338789: Random failure: "PHP temp directory (/tmp) does not exist or is not writable to Composer." struck again! Re-testing. Although I can reproduce

Testing Drupal\Tests\automatic_updates\Kernel\StatusCheck\VersionPolicyValidatorTest
.....................F                                            22 / 22 (100%)

Time: 01:15.505, Memory: 6.00 MB

There was 1 failure:

1) Drupal\Tests\automatic_updates\Kernel\StatusCheck\VersionPolicyValidatorTest::testNoCorePackagesInstalled
Failed asserting that exception of type "Drupal\package_manager\Exception\StageException" is thrown.

locally…

wim leers’s picture

Status: Needs work » Needs review

That failure was caused by \Drupal\Tests\automatic_updates\Kernel\StatusCheck\VersionPolicyValidatorTest::testNoCorePackagesInstalled()'s reliance on modifying Composer's installed.json manually, which no longer has any effect. Plus by a tiny bug in ::getCorePackageName().

wim leers’s picture

Assigned: wim leers » Unassigned
wim leers’s picture

Status: Needs review » Reviewed & tested by the community

I only got it to green, others did 90% of the work.

  • tedbow committed 92c1d085 on 3.0.x
    Issue #3345771 by Wim Leers, tedbow, phenaproxima:...
tedbow’s picture

Assigned: Unassigned » wim leers
Status: Reviewed & tested by the community » Fixed
Issue tags: +Needs follow-up

🎉

@Wim Leers and/or @phenaproxima what do you think of my follow-up suggestion?

wim leers’s picture

Assigned: wim leers » tedbow
Status: Fixed » Patch (to be ported)
Related issues:

I had never heard of drupal/core-dev-pinned before today!

You propose \Drupal\package_manager\InstalledPackage to gain a public readonly bool $isDev property — great — but just yesterday that was being worked on in #3345754: Updater should use ComposerInspector instead of ComposerUtility and was removed in favor of ComposerInspector::getRootPackageInfo() returning a devRequires flag for each installed package.

That is what @phenaproxima settled on and you RTBC'd, @tedbow. I was not involved in that pretty significant shift.

So I think the sensible thing to do next is for you to open that follow-up as you envision it, @tedbow 😊

phenaproxima’s picture

You propose \Drupal\package_manager\InstalledPackage to gain a public readonly bool $isDev property — great — but just yesterday that was being worked on in #3345754: Updater should use ComposerInspector instead of ComposerUtility and was removed in favor of ComposerInspector::getRootPackageInfo() returning a devRequires flag for each installed package.

Not quite.

The property that was originally implemented in that issue, and removed by me, was a change in behavior. Updater needs to see what the dev requirements are, not what the dev packages are. So the implementation was wrong, and was therefore removed.

wim leers’s picture

Status: Patch (to be ported) » Needs work

The follow-up doesn't exist yet — clarifying status.

tedbow’s picture

Assigned: tedbow » Unassigned
Status: Needs work » Fixed
Issue tags: -Needs follow-up

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.