"Flag State" and "Port State" inspections are completely different. Flag state is the country whose flag the ship wears, and that administration inspects ships which are registered in that country. Of course, countries "delegate" inspections to Classification societies, who have Surveyors world wide. These surveyors board the ship to sign off the Certificates which must be carried aboard. Class societies are hired by shipowners to carry out this service, and should Class get too pernickety on standards, the shipowner will fire that Class and hire another, who isn't so pernickety. In my experience of 30-odd years at sea trading world wide, if the captain has a supply of Johnny Walker and Marlborough, there's no problem getting Certificates signed off.
Port State Inspections are carried out by Marine Safety Inspectors on foreign vessels visiting the country. These have no legal teeth to enforce them, but states have signed various Memoranda of Understanding to carry out inspections on visiting ships. Canada is party to the Paris MOU for east coast shipping and Tokyo MOU for the west. An inspection carried out under either in Canada is good for both.
Should a ship undergo a Port State inspection with no deficiencies, there is no charge for the inspection. The results are uploaded to Paris MOU HQ in Versailles, France, and kept in a database which can be accessed here
http://www.parismou.org
Tokyo MOU is here
http://www.tokyo-mou.org
Any deficiency is logged and entered and when the ship visit's the next port, in a state party to the MOU, the report is examined and a charge of $400 is levied against the ship for an Inspector's visit to verify that the deficiency is corrected. The database is also consulted by Charterers, P&I Clubs and Insurance underwriters. A vessel with deficiencies against it will earn lower charter rates and higher P&I and Insurance premiums.
Port State Control has been very effective in raising the standards of ships, the ISM Code, which is mandatory, even more effective. On tankers, for example, oil companies have got out of the tanker business, after the Exxon Valdez, to avoid liability for cleaning up spills. Chartered tankers are inspected by Vetting Inspectors for the oil company whose cargo is being carried, and the tanker better be good! Otherwise, no charter.
Flag State, as far as Canada is concerned, has responsibility for all inspections delegated to the shipowner, who hires a Class society to carry them out. TC is not involved with delegated vessels, apart from handing them over to Class. Section 106 of the Canada Shipping Act 2001 states that the shipowner is responsible, TC is not. I may add that if Port State Inspection standards were to be applied to domestic shipping in Canada, most of the fleet would be tied up, detained. Canadian ships which do trade internationally are detained and accumulate deficiencies regularly, contributing to Canada's "Grey List" status in Paris MOU.