Get your taxes done using TurboTax

I went through something similar years ago when I moved to CA from CO but my wife stayed on into the next year until the school district finished in June.  However, I do not profess to be any sort of expert.  If I were in your situation, this is what I might well do based on what we did for joint filing that year:

 

Your legal residence is still in MA (https://www.mass.gov/service-details/learn-about-legal-and-residency-status-in-massachusetts)  and your secondary residence is in CA.  This tells me to file full-year MA Form 1 resident return and a part-year/nonresident 540NR return in CA.  After completing the federal Form 1040, work on CA next.  It will ask you to divided your total joint income into that part earned while you were working in CA and the rest.  [Community property laws in CA could, I think require you to treat half of your wife's income during that period as if it were earned in CA, but all the discussion I can find focuses on married filing separately and not jointly.  As I recall, we didn't know about that and never got any letters from the CA Franchise Tax Board asking about it.] MA allows a credit for the CA income tax paid against your MA tax bill.  (Technically, it is a credit for the other state tax on income that is being taxed by both states.)  Then finally do the MA return.

 

As I said, this is only what I would do in your situation based on what I did way back when. Others with more expertise or experience will likely chime in with better information.  Hopefully it is enough to get you started.