The ruling was not on constitutional grounds, it was essentially a statement that the way that they had repealed DACA was so incompetently done as to be invalid.
Oh, Lord, thank you for making the evil so inept:
It has been eight years since the Obama administration created the Deferred Action for Childhood Arrivals program, known as DACA, which allows undocumented young adults who came to the United States as children to apply for protection from deportation. In 2017, the Trump administration announced that it would end the program, which it believed had been illegal in the first place. Today, by a vote of 5-4, the Supreme Court ruled that the administration acted improperly in terminating the program, and it sent the case back for the Department of Homeland Security to take another look. The ruling means that the DACA program will remain in place, at least for the foreseeable future."Even this relatively low bar."
The battle over DACA came to the Supreme Court in November 2018, when the Trump administration asked the justices to take up three different challenges, filed in California, the District of Columbia and New York, to the decision to end DACA. The challengers – which include states, cities, universities, DACA recipients, civil rights groups and even Microsoft – argued that the decision to rescind DACA violated the rights of DACA recipients and the Administrative Procedure Act, the federal law governing administrative agencies. In all three cases, the lower courts ruled for the challengers and ordered the government to keep DACA in place. At the end of June 2019, the Supreme Court announced that it would review the three cases.
Roberts then turned to the central question in the case: whether the Trump administration followed proper procedures in terminating DACA. Under the APA, Roberts stressed, courts should not substitute their own judgment for that of the agency. Instead, he explained, their job is to determine whether an agency made its decision “based on a consideration of the relevant factors and whether there has been a clear error of judgment.” In the majority’s view, the Trump administration had failed to meet even this relatively low bar.