The first issue was whether the royal prerogative in respect of immigration control had been ousted by the Immigration Act, 1971. That Act seems to be expressed in permissive terms. It allows, but does not require, the Home Secretary to formulate guidelines relating to immigration. Moreover, in s. 33(5) of the Act, Parliament provides that the prerogative in respect of aliens is not affected.
However, in the first case, Munir,  UKSC 32, Lord Dyson held that given the huge body of rules that has grown upon the statutory authorization of the 1971 Act, the prerogative has now been ousted: "the purpose of the 1971 Act was to replace earlier laws with a single code of legislation on immigration control" (at para. 26). Thus the Home Secretary was under a duty to promulgate rules.
A good thing rules were actually promulgated: otherwise, the prerogative would have been displaced and nothing would have been available to fill the void, a strange outcome (to say the least). That difficulty did not arise on the facts, though, so Lord Dyson was able to confidently conclude that "it is the 1971 Act itself which is the source of the Secretary of State’s power to grant leave to enter or remain outside the immigration rules" (at para. 44).
Incidentally, Lords Hope and Walker would have gone further: they held that the prerogative had been entirely displaced, even in respect of aliens, notwithstanding Parliament`s apparent attempt to preserve that particular aspect of the prerogative (at paras. 26-33 and 109 of Alvi).
The second issue arose in Alvi  UKSC 33 (as did the comments of Lords Hope and Walker). Section 3(2) of the Act requires that immigration rules be laid before Parliament. Guidance that does not rise to the status of "rules", however, need not be. The purpose of the provision is plain: Parliament must retain some oversight over the development and application of immigration policy (see para. 54).
At issue here were Occupation Codes of Practice relied upon by the Home Secretary in determining whether an applicant for a work permit had accumulated sufficient points. Mr. Alvi's job (assistant physiotherapist) was on the relevant list, but was not classified as skilled. The issue was whether the Occupation Codes of Practice, which had never been laid before Parliament, were "rules" within the meaning of s. 3(2), or alternatively whether they functioned merely as guidance to visa officers.
Put slightly differently, the issue was whether the Codes of Practice were of sufficient importance to require Parliamentary oversight. Now, there was certainly reference in the material laid before Parliament to the development of a "list of skilled occupations" (para. 15), but the Codes themselves had never passed under Parliament's eye.
Distinguishing rules from guidance is difficult, as Lord Walker observed:
114. I do not find it particularly helpful to engage on the exercise of construing the word “rules” in section 3(2). That there is a difference in the general sense conveyed by “rules” (on the one hand) and “guidance” (on the other hand) is obvious. The general sense of “rules” is prescriptive and mandatory; that of “guidance” more open-textured and advisory. But there is no clear dividing-line between them. Lawyers and judges are very familiar with rules of all sorts – immigration rules, prison rules, civil procedure rules, insolvency rules, to mention but a few. Such rules may provide for the exercise of discretion, either generally or in exceptional cases. They may contain mandatory or non-mandatory procedural requirements or recommendations.Where called upon to do so courts have great difficulty in dealing with this distinction. It more commonly arises in cases where an applicant alleges that a decision-maker has fettered its discretion. Then, the reviewing court must assess whether the policy at issue is a guideline (which is permissible) or a binding rule (which may not be). Here, of course, the distinction arose within the legislation itself.
In the end, the court coalesced around the following definition of a rule, for the purposes of s. 3(2): “all those provisions which set out criteria which are or may be determinative of an application for leave to enter or remain” (at para. 97, per Lord Dyson).
Here, the precise level at which the position of assistant physiotherapist would be classified was determinative of Mr. Alvi's application and thus a rule. To hold otherwise would, Lord Hope observed, "[leave] it open to the Secretary of State to vary the level at which the occupation will satisfy the requirement, and to vary the descriptions of the jobs that are to be taken to be above or below that level, without disclosing those changes to Parliament" (at para. 61).
A majority of the court leaned towards the position that, if the rule laid before Parliament had expressly provided that the list of skilled occupations was subject to change, the Home Secretary would have been in the clear, as long as the changes were constrained by general, or objective, standards (see variously paras. 60 (Lord Hope), 118 (Lord Walker) and 125 (Lord Clarke)).
In passsing, I query the cogency of the court's test. What about procedural rules which govern, say, the gathering, production and investigation of relevant evidence? While these would not be dispositive of the outcome of an application, and would thus not satisfy the court's definition of rules, they are surely of great importance. It is not a great leap to suggest that they would fall within the purpose of s. 3(2).