How do we know if a contract is against PUBLIC POLICY?

It is an all too familiar rule; we all know it. Parties in a contract may stipulate any term or condition and such contract would have the force and effect of law between the contracting parties. However, these contractual stipulations are only valid if not contrary to law, morals, good customs, public order and public policy.

What is public policy? Public policy is the principled guide to action taken by the administrative executive branches of the state with regard to a class of issues, in a manner consistent with law and institutional customs. (https://en.wikipedia.org/wiki/Public_policy)

In the Philippines, we sources of public policy are (1) whereas clauses of laws providing the policy of the state; (2) the Constitution, especially Article II on Declaration of State Polities; and (3) institutionalized traditions and processes in government which are believed to be for the benefit of the people.
The above explanation seems to be more instructive than the Supreme Court's very old attempt to define public policy in the case of Ollendorff vs. Abrahamson (G.R. No. 13228; September 13, 1918):

"We are of the opinion that the contract was not void as constituting an unreasonable restraint of trade. We have been cited to no statutory expression of the legislative will to which such an agreement is directly obnoxious. The rule in this jurisdiction is that the obligations created by contracts have the force of law between the contracting parties and must be enforce in accordance with their tenor. (Civil Code, art 1091.) The only limitation upon the freedom of contractual agreement is that the pacts established shall not be contrary to "law, morals or public order." (Civil Code, Art. 1255.) The industry of counsel has failed to discover any direct expression of the legislative will which prohibits such a contract as that before us. It certainly is not contrary to any recognized moral precept, and it therefore only remains to consider whether it is contrary to "public order." This term, as correctly stated by Manresa (Commentaries, vol. 8, p. 606) "does not mean, as here used, the actual keeping of the public peace, but signifies the public weal . . . that which is permanent, and essential in institutions . . . ." It is the equivalent, as here used and as defined by Manresa, of the term "public policy" as used in the law of the United States. Public policy has been defined as being that principle under which freedom of contract or private dealing is restricted for the freedom of contract or private dealing is restricted for the good of the community. (People's Bank vs. Dalton, 2 Okla., 476.) It is upon this theory that contracts between private individuals which result in an unreasonable restraint of trade have frequently being recognized by article 1255 of our Civil Code, the court of these Islands are vested with like authority."