Businesses are legally bound to act in the best interest of their shareholders. This is quite an open ended precedent.
You can argue almost anything meets this criterion, in some egregious scenarios a court won't buy it, but they will give you enormous leeway.
There is a lot - A LOT - of room for ambiguity and debate on the specifics of shareholder value and "best interests." The "legal constraints to act in the best interest" is not some set of corporate rules and KPIs codified into our legal code write large. It's not about maximizing a specific KPI over a fixed timeframe.
Not to mention Sweeney is the majority shareholder in Epic's case.
Businesses are legally bound to follow the official decisions of shareholders at official meetings. Anything beyond that is merely "a good idea".