Skip to content
Snippets Groups Projects

Issue #3311472 Set minimum stability for form

1 unresolved thread

Closes #3311472

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Ted Bowman
  • Adam G-H
  • Adam G-H
  • Adam G-H
  • Ted Bowman added 2 commits

    added 2 commits

    Compare with previous version

  • Ted Bowman added 1 commit

    added 1 commit

    • 3152923d - only add rule when not cron, Probably not correct solution

    Compare with previous version

  • Ted Bowman
    Ted Bowman @tedbow started a thread on the diff
  • 84 85 $rules[] = ForbidDowngrade::class;
    85 86 // ...and in the same major version as the installed version...
    86 87 $rules[] = MajorVersionMatch::class;
    87 // ...and it must be a known, secure, installable release.
    88 // ...and it must be a known, secure, installable release...
    88 89 $rules[] = TargetVersionInstallable::class;
    90 if (!$stage instanceof ConsoleUpdateStage) {
    91 // ...and must be either a release candidate, or stable.
    92 $rules[] = TargetVersionNotPreRelease::class;
    93 }
    • Comment on lines +90 to +93
      Author Maintainer

      Surround this in an if gets the tests in \Drupal\Tests\automatic_updates\Kernel\StatusCheck\VersionPolicyValidatorTest::testCronPreCreate to pass but it raises some questions for me about how we set some of this up.

      In validateVersion() we only add cron specific rules if $stage instanceof ConsoleUpdateStage && $mode !== CronUpdateRunner::DISABLED. So this means if you call ConsoleUpdateStage::create() directly you won't get any of the cron specific rules. VersionPolicyValidatorTest::testCronPreCreate actually depends on this because we assert we don't get an error if you use the ConsoleUpdateStage, cron is disabled and the target is alpha. There may be reason we did this but it seems very strange now.

      1. ConsoleUpdateStage is not actually marked as internal so calling create directly is not obviously discouraged. I think we should probably mark this an internal. I guess you would want to check for it in a validator but you should never call any methods on it directly.
      2. In ConsoleUpdateStage::performUpdate() we do return early if cron is disabled so when used how intended you should never be able perform operations via this stage that don't have the cron specific rules applied even we don't enforce if cron is disabled.
      3. We could throw a logic exception in ConsoleUpdateStage::create() before we call the parent if cron is disabled. But we really only would have to do this we have UpdateStage::begin that call StageBase::create instead of just overriding create and adding the an extra optional(which would be enforced to have a value) $project_versions. Then instead of ConsoleUpdateStage::begin throwing a BadMethodCallException we could have ConsoleUpdateStage::create throw that exception.
    • Please register or sign in to reply
  • Author Maintainer

    Added a todo to https://www.drupal.org/project/automatic_updates/issues/3398782 I think we can leave the if in for now and remove it in the follow-up

  • Ted Bowman added 1 commit

    added 1 commit

    Compare with previous version

  • merged

  • Please register or sign in to reply
    Loading