President Xi Jinping's visit to Mar-a-Lago to meet President Donald Trump early in the US President's term was carefully choreographed to be a triumph of mature responsible diplomacy by China.
The Chinese leader, five years into his term, was giving the new President the courtesy of calling on him, in an informal way, underlining that this was a business-like relationship of equals.
The Chinese would have calculated that the new President needed a composed reassuring outcome on the US/China relationship, after Trump's blustering, confusing, Twitted commentary on relations with China before and after his election, and subsequently with the chaos inside Trump's inner circle of family and advisers.
For Xi, it would have been seen as all upside. Platitudes about a new great power relationship, moderate statements on their trade and economic frictions, understandings on North Korea and the South China Sea, and, most importantly, reassurance that the two leaders had come to know each other and could work together cooperatively.
China is particularly good at these times, with its highly disciplined and organised approach to the management of its foreign relations. The Chinese Embassy would have worked meticulously with all of Trump's advisers, even if they did not know who had the President's ear and wielded power. The inner circle was in a state of flux, even by the time President Xi arrived.
The Chinese Ambassador to Washington, Cui Tiankai, would have been at his wits end. For a Chinese Ambassador, nothing unexpected can happen during a President's visit to their diplomatic territory. Cui is a highly professional, urbane, sophisticated diplomat. He once was in charge of relations with Australia, but was most comfortable as Ambassador to Tokyo where, despite the tensions in the relationship, nothing unpredictable was allowed to happen by the Japanese.
This is how Chinese diplomats like things to be. The sacking of Prime Minister Kevin Rudd during then-vice-President Xi Jinping's visit to Australia in 2010 is etched on the Foreign Ministry's collective memory as a career-limiting experience. China's Ambassador to Australia at the time, the affable Zhang Zhunsai, was heavily criticised for not alerting the leadership to Rudd's imminent demise, even if most members of the Australian Cabinet also had no idea that a train wreck was about to happen.
Xi's visit to Mar-a-Lago began well enough, with the usual cordial meet-and-greet photo opportunities. But then everything changed. In response to television reports that the Assad regime had used chemical weapons against its own civilians, Trump back-flipped on his long-standing public view of no further escalation of US military involvement in Syria and ordered a cruise missile attack on the Syrian air base believed to be the staging point for the chemical weapons' assault.
Fifty-nine Tomahawk missiles later, Xi's visit was a footnote to global news. The best- laid plans of the Chinese Foreign Ministry lay in tatters. It took China's state- controlled news agencies 24 hours to start to report the attack. However they presented it, no one in China could miss the fact that in Xi's presence Trump had decisively demonstrated US military power. Xi would have been deeply humiliated and furious about this affront to his carefully crafted image of the China "Dream" as an equivalent Great Power with the US.
Expecting the unexpected
It is unlikely that any of this was thought through in advance by the Trump administration, and even less likely, once the decision was taken to attack the air base, that anyone considered the impact on China.
Trump, by luck or design, has wrong-footed China twice since becoming President. The first was when he spoke with Taiwan's leader, Cai, after her election. It was a clever way to re-set relations with China after the inconsistency of Obama's management of the relationship. He then overreached by momentarily toying with the idea of reviewing the One China Policy. This was quickly retracted, which seemed to be to Beijing's advantage and opened the way for Xi's visit.
Now, in Xi's presence on American soil, Trump has again taken the advantage. The issue is not, however, Syria, in which China has little strategic interest, other than superficial support for Russia's involvement, but rather a core strategic interest of China, North Korea.
China has now had the benefit of witnessing first hand that the unilateral exercise of US military power has turned around a dire domestic political narrative about Trump and gained widespread international support.
Since Trump's election, Chinese officials have said they were preparing for the unexpected. But in view of Trump's long-standing position to avoid US military interventions, the attack on Syria would not have been anticipated. Now, the question all the officials on Xi's flight back to Beijing would have been discussing is might he do the same with North Korea.
Trump is already on record as saying that if he does not get cooperation from China in stopping North Korea's nuclear missile program the US would act unilaterally. Beijing is now unlikely to be in any doubt about this. The dispatch of the US Carl Vinson Carrier Strike Group, to complement the substantial military assets the US already has in the area, will serve to reinforce this view.
Beijing's policy towards North Korea will have to change. It has long sought to preserve the status quo on the Korean Peninsular, as any change would be a worse outcome for it. In return, the North's nuclear missile program has been an affront to Beijing and provided the opportunity for the US to weaken China's security by providing a justification for installing missile defence systems in South Korea.
The calculus of a US attack on North Korean missile installations is imponderable. The consequences for China, however, would be dire. Xi is back home in Beijing, perhaps reflecting on what might have been from his grand gesture of his visit to the US, but anxiously worrying about what the man he met briefly in sumptuous surroundings in Florida might be about to do next in China's backyard.
The problem for Xi is that after years of accommodating the leadership in Pyongyang his options are limited, while Trump's willingness to use American power is turning the China Dream into a potential nightmare.