You file in both states.
You must file in MA, since you are an MA resident. MA taxes its residents on all their income, regardless of its source.
You should also file a non-resident CA tax return. CA taxes non-resident independent contractors on income from services provided to CA customers. *
If you were a W-2 employee instead of an independent contractor, your income would not be taxable by CA unless you actually (physically) worked inside CA.
You'll be able to take a credit on your MA return for the taxes paid to CA on the income taxed by both states, so you won't be double-taxed.
*https://www.coblentzlaw.com/california-office-of-tax-appeals-gives-precedential-authority-to-bindley...
**Answers are correct to the best of my ability but do not constitute tax or legal advice.