I don't know, what's going on with your dji Spark.
However, one time my Spark was doing some crazy movements by himself. I did some research about the problem and how to fix it.
As a result, I found that my Spark needed a IMU calibration. I did a very bad job the first time I did the IMU...