Solution (source code)

= Solution

The field is continuously differentiable on all of $\mathbb R^3$, a <simply connected> domain. Its vanishing <curl> therefore implies a global <potential of a conservative vector field>, so $\mathbf F\cdot d\mathbf r=d\phi$ is an <exact differential>. This global domain condition matters: curl-free fields on domains with holes need not have single-valued potentials.

Integrating $\phi_x=2yz^2$ gives $\phi=2xyz^2+g(y,z)$. Matching $\phi_y=2xz^2$ forces $g_y=0$, so $g=h(z)$; matching $\phi_z=4xyz$ then forces $h'=0$. Consequently
$$
\boxed{\phi(x,y,z)=2xyz^2+C},\qquad d\phi=2yz^2dx+2xz^2dy+4xyz\,dz.
$$
The additive constant does not affect the field or any endpoint difference.