Relax split test import schema to allow staging export fields (#36832)

* Relax split test import schema to allow staging export fields

The staging split test export includes fields (variant.active, version.__v,
splitTest.customerIoEnabled) that aren't otherwise written by the app but
are present in Mongo exports. The strict zod schema was rejecting the
import; mark these as optional so a staging export can be imported into a
local dev environment.

* [web] allow split-test import in dev-env and CI

* [web] ensure that the zod schema for split-tests covers all fields

---------

Co-authored-by: Thomas Mees <thomas.mees@overleaf.com>
GitOrigin-RevId: eab633e8498e351a64dc9a9dad85759e80744da0
This commit is contained in:
Jakob Ackermann
2026-09-17 12:03:21 +00:00
committed by Copybot
co-authored by Thomas Mees
parent 0e7eff712c
commit e276104da8
@@ -4,6 +4,7 @@ import SplitTestUtils from './SplitTestUtils.mjs'
import OError from '@overleaf/o-error'
import _ from 'lodash'
import { CacheFlow } from 'cache-flow'
import Settings from '@overleaf/settings'
// customer.io silently drops attribute values over 1000 bytes, so cap the
// number of split tests whose assignments are sent in the
@@ -594,11 +595,12 @@ async function _saveSplitTest(splitTest) {
}
/*
* As this is only used for utility in local dev environment, we should make sure this isn't run in
* any other deployment environment.
* As this is only used for utility in local dev environment (and the test
* suites), we should make sure this isn't run in any other deployment
* environment.
*/
function _checkEnvIsSafe(operation) {
if (process.env.NODE_ENV !== 'development') {
if (!Settings.isDevEnv && !Settings.isCI) {
throw new Errors.ForbiddenError(
`Attempted to ${operation} all feature flags outside of local env`
)