'Unable to install dev-master version of package from Satis repository

I'm developing a couple of composer packages (mainly related to the Yii2 framework) served by private Satis repository. Most of them is at the very beginning of development process, so they should be available as dev-master version due to master branch location within GIT repository.

The problem occurs when I'm trying to install dev-master of any package, i.e. foo/my-package:

./composer.phar require foo/my-package

Problem 1
    - The requested package foo/my-package dev-master exists as foo/my-package[dev-master] but these are rejected by your constraint.

so, if dev-master exists, please install this version for me anyway:

./composer.phar require foo/my-package dev-master

[InvalidArgumentException]
    Could not find package foo/my-package in a version matching dev-master

Now i'm confused. I've tried to install @dev version of foo/my-package and magically everything works, dev-master (!) version has been installed:

./composer.phar require foo/my-package @dev

Package operations: 6 installs, 0 updates, 0 removals
  - Installing yiisoft/yii2-composer (dev-master 0933fd9): Downloading (100%)
  - Installing yidas/yii2-bower-asset (2.0.12): Downloading (100%)
  - Installing cebe/markdown (1.1.2): Downloading (100%)
  - Installing ezyang/htmlpurifier (v4.14.0): Downloading (100%)
  - Installing yiisoft/yii2 (2.0.12.2): Downloading (100%)
  - Installing foo/my-package (dev-master ce0ac57): Cloning ce0ac5752b from cache

What is the main problem? my-package GIT repository have also feature/#1234 branch. When Satis repository generator is configured to serve all versions of all packages ({"require-all": true}) instead of configuration shown below, using @dev as package version during composer require operation will cause installation of source code from feature/#1234 branch (no matter if it's HEAD points to patch newer or older than masters' branch HEAD). I would like to setup Satis with require-all as true and install packages as dev-master in this case (but dev-feature/#1234 in other project); but first of all I need to understand why it's behave that way.

Composer version 1.10.25 2022-01-21 10:02:15 (it's required to use version prior to v2)

Satis configuration (main.json)

{
    "name": "foo/bar",
    "description": "foo",
    "homepage": "https://foo.bar",
    "repositories": [
        {
            "type": "git",
            "url": "ssh://user@domain/path/foo-my-package.git"
        },
        ...
    ],
    "require": {
        "foo/my-package": "dev-master",
        ...
    }
    "archive": {
        "directory": "dist",
        "format": "tar",
        "checksum": true
    }
}

foo/my-package composer file (composer.json)

{
    "name": "foo/my-package",
    "description": "description",
    "type": "yii2-extension",
    "license": "proprietary",
    "keywords": [
        "yii2",
        "extension",
    ],
    "minimum-stability": "dev",
    "require": {
        "php": ">=7.1.0",
        "yidas/yii2-bower-asset": "*",
        "yiisoft/yii2": "~2.0.12.2"
    },
    "autoload": {
        "psr-4": {
            "foo\\mypackage\\": "src"
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://foo.bar"
        }
    ],
    "config": {
        "preferred-install": {
            "foo/*": "source",
            "*": "dist"
        }
    }
}

Sandbox project configuration where I'm trying to install foo/my-package, in state before installing @dev version of the package (composer.json)

{
    "name": "composer/sandbox",
    "description": "description",
    "keywords": [],
    "type": "project",
    "license": "proprietary",
    "support": {},
    "minimum-stability": "dev",
    "require": {},
    "require-dev": {},
    "config": {
        "process-timeout": 1800,
        "allow-plugins": {
            "yiisoft/yii2-composer": true
        },
        "preferred-install": {
            "foo/*": "source",
            "*": "dist"
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://foo.bar"
        }
    ]
}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source