Merge pull request #36314 from overleaf/revert-36194-rh-cio-split-tests

Revert "[web] send active split test assignments to customer.io"

GitOrigin-RevId: c3acb504be2ef003d6a103568ece3175f787e6d5
This commit is contained in:
roo hutton
2026-09-17 11:50:08 +00:00
committed by Copybot
parent 6b69ea7dc1
commit ba589211ea
3 changed files with 1 additions and 64 deletions
@@ -578,21 +578,6 @@ async function projectListPage(req, res, next) {
}
}
let splitTestUserProperties
if (isSaas) {
try {
;[splitTestUserProperties] = await Modules.promises.hooks.fire(
'getSplitTestUserProperties',
userId
)
} catch (err) {
logger.error(
{ err, userId },
'Failed to build split test user properties for customer.io'
)
}
}
Modules.promises.hooks
.fire('setUserProperties', userId, {
overleaf_id: userId,
@@ -617,7 +602,6 @@ async function projectListPage(req, res, next) {
...(groupRole && { group_role: groupRole }),
is_managed_user: Boolean(user.enrollment?.managedBy),
...(user.email && { email: user.email }),
...splitTestUserProperties,
})
.catch(err => {
logger.error({ err }, 'Failed to set user properties for customer.io')
@@ -45,7 +45,7 @@ function getProjection(splitTestName) {
/**
* @param id
* @param {string} [splitTestName] test to get; omit to fetch all assignments.
* @param {string} splitTestName
* @param {string} path
* @return {Promise<SplitTestUser>}
*/
@@ -568,53 +568,6 @@ describe('ProjectListController', function () {
)
})
it('should send packed split test assignments to customer.io', async function (ctx) {
ctx.Features.hasFeature.withArgs('saas').returns(true)
ctx.Modules.promises.hooks.fire
.withArgs('getSplitTestUserProperties', ctx.user._id)
.resolves([{ split_test_assignments: { 'test-a': 'variant-1' } }])
ctx.res.render = () => {}
await ctx.ProjectListController.projectListPage(ctx.req, ctx.res)
expect(ctx.Modules.promises.hooks.fire).to.have.been.calledWith(
'setUserProperties',
ctx.user._id,
sinon.match({
split_test_assignments: { 'test-a': 'variant-1' },
})
)
})
it('should not request split test user properties in a non-saas environment', async function (ctx) {
ctx.Features.hasFeature.withArgs('saas').returns(false)
ctx.res.render = () => {}
await ctx.ProjectListController.projectListPage(ctx.req, ctx.res)
expect(ctx.Modules.promises.hooks.fire).to.not.have.been.calledWith(
'getSplitTestUserProperties',
sinon.match.any
)
})
it('should still send other user properties when building split test assignments fails', async function (ctx) {
ctx.Features.hasFeature.withArgs('saas').returns(true)
ctx.Modules.promises.hooks.fire
.withArgs('getSplitTestUserProperties', ctx.user._id)
.rejects(new Error('boom'))
ctx.res.render = () => {}
await ctx.ProjectListController.projectListPage(ctx.req, ctx.res)
const call = ctx.Modules.promises.hooks.fire
.getCalls()
.find(call => call.args[0] === 'setUserProperties')
expect(call).to.exist
expect(call.args[2]).to.not.have.property('split_test_assignments')
expect(call.args[2]).to.have.property('overleaf_id', ctx.user._id)
})
it('should send enterprise_commons=true when user has commons from an enterprise_commons institution', async function (ctx) {
ctx.Features.hasFeature.withArgs('saas').returns(true)
ctx.UserGetter.promises.getUserFullEmails.resolves([