Skip to content

Installer: Hyvä step stores the project key as the Composer username and picks the theme with an unordered LIKE #436

Backlog

Description

@DavidLambauer

Preconditions and environment

  • Mage-OS 4.0.0
  • bin/magento install, choosing the Hyvä theme with a Hyvä project key and API token

Steps to reproduce

  1. Run bin/magento install and pick Hyva as the theme.
  2. Enter the project key and API token from your hyva.io account.
  3. Finish the installation and check auth.json and the theme that is applied to the default scope.

Expected result

  • auth.json holds the credentials in the form Hyvä documents: composer config --auth http-basic.hyva-themes.repo.packagist.com token <license key>. That is, the username is the literal token and the password is the key.
  • The installer applies Hyva/default.

Actual result

Found by reading the 4.0.0 code and comparing it with Hyvä's installation docs. I haven't run it against Hyvä's repository.

  1. Credentials: ComposerAuthManager writes the project key as the username and the API token as the password (ComposerAuthManager.php#L44-L48). That differs from Hyvä's documented setup, where the username is token. If Private Packagist checks the username, composer require hyva-themes/magento2-default-theme fails with an authentication error and the wizard falls back to Luma.
  2. Theme selection: ThemeConfigurer looks the theme up with SELECT theme_id FROM theme WHERE area = 'frontend' AND theme_path LIKE '%hyva%' LIMIT 1, without ORDER BY (ThemeConfigurer.php#L102-L105). When more than one registered theme path contains hyva (for example a Hyvä child theme in app/design, Hyva/default-csp, or Hyva/reset on older Hyvä versions), the result is whichever row MySQL returns first.

Additional information

Possible fixes:

  • write 'username' => 'token', 'password' => $apiToken, and keep the project key only in the repository URL;
  • look the theme up by its exact path (Hyva/default, taken from the theme registry) instead of LIKE.

Found while documenting the installer for the devdocs (mage-os/devdocs#110).

Triage and priority

  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions