Browse Source

Merge pull request #30813 from overleaf/bg-fix-compile-from-redis

exclude buildId from project state hash

GitOrigin-RevId: da7424378422bec348adeaa5da0fe2d3581744d9
Brian Gough 6 months ago
parent
commit
dbff5ae559

+ 1 - 1
services/web/app/src/Features/Compile/ClsiStateManager.mjs

@@ -47,7 +47,7 @@ export default {
       const object = options || {}
       for (const key in object) {
         const value = object[key]
-        if (!['isAutoCompile'].includes(key)) {
+        if (!['isAutoCompile', 'buildId'].includes(key)) {
           result.push(`option ${key}:${value}`)
         }
       }

+ 17 - 1
services/web/test/unit/src/Compile/ClsiStateManager.test.mjs

@@ -18,7 +18,11 @@ describe('ClsiStateManager', function () {
 
     ctx.ClsiStateManager = (await import(modulePath)).default
     ctx.project = 'project'
-    ctx.options = { draft: true, isAutoCompile: false }
+    ctx.options = {
+      draft: true,
+      isAutoCompile: false,
+      buildId: 'original-build-id',
+    }
     ctx.callback = sinon.stub()
   })
 
@@ -189,5 +193,17 @@ describe('ClsiStateManager', function () {
         ).to.equal(ctx.hash0)
       })
     })
+
+    describe('when the buildId option is changed', function () {
+      beforeEach(function (ctx) {
+        ctx.options.buildId = 'new-build-id'
+      })
+
+      it('should return the same hash value', function (ctx) {
+        expect(
+          ctx.ClsiStateManager.computeHash(ctx.project, ctx.options)
+        ).to.equal(ctx.hash0)
+      })
+    })
   })
 })