From 2e389c5a41b795041e0ea2ef1581915263181a7e Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 17 Mar 2026 14:08:09 +0100 Subject: [PATCH] [rails] migrate compiles of conversions/submissions to history mode (#32053) * [saas-e2e] test gallery templates with binary file * [rails] add make target for fixing rubocop errors * [rails] migrate compiles of conversions/submissions to history mode * [rails] forward version to clsi request * [rails] trim down compile request * [saas-e2e] source v1 secrets after make install GitOrigin-RevId: 65269e1df1051c9f3b4f1813d2e9dcf32a01be50 --- services/clsi/app/js/CompileManager.js | 4 ++-- services/clsi/app/js/HistoryResourceWriter.js | 16 +++++++++++++--- services/clsi/app/js/RequestParser.js | 5 +++++ .../web/app/src/Features/Compile/ClsiManager.mjs | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/services/clsi/app/js/CompileManager.js b/services/clsi/app/js/CompileManager.js index 4cb9132a28..7631223cf5 100644 --- a/services/clsi/app/js/CompileManager.js +++ b/services/clsi/app/js/CompileManager.js @@ -107,7 +107,7 @@ async function doCompile(request, stats, timings) { let resourceList, baseHistoryVersion try { - if (request.historyId) { + if (request.rawChangeOperations) { ;({ resourceList, baseHistoryVersion } = await HistoryResourceWriter.syncResourcesToDisk( projectId, @@ -849,7 +849,7 @@ function _emitMetrics(request, status, stats, timings) { if (timings.compileE2E != null) { ClsiMetrics.e2eCompileDurationSeconds.observe( { - compileFromHistory: !!request.historyId, + compileFromHistory: !!request.rawChangeOperations, compile: request.metricsOpts.compile, group: request.compileGroup, }, diff --git a/services/clsi/app/js/HistoryResourceWriter.js b/services/clsi/app/js/HistoryResourceWriter.js index 8dcf92fbf0..ec05101d74 100644 --- a/services/clsi/app/js/HistoryResourceWriter.js +++ b/services/clsi/app/js/HistoryResourceWriter.js @@ -421,7 +421,11 @@ export async function syncResourcesToDisk( ) } - const blobStore = new BlobStore(request.historyId, globalBlobs) + const blobStore = new BlobStore( + request.historyId, + request.filestoreBlobPrefix, + globalBlobs + ) const loadEagerStart = performance.now() await snapshot.loadFiles('eager', blobStore) timings.snapshotLoadEager = Math.ceil(performance.now() - loadEagerStart) @@ -503,13 +507,17 @@ class BlobStore { #historyId /** @type {string[]} */ #globalBlobs + /** @type {string} */ + #filestoreBlobPrefix /** * @param {string} historyId + * @param {string} filestoreBlobPrefix * @param {string[]} globalBlobs */ - constructor(historyId, globalBlobs) { + constructor(historyId, filestoreBlobPrefix, globalBlobs) { this.#historyId = historyId + this.#filestoreBlobPrefix = filestoreBlobPrefix this.#globalBlobs = globalBlobs } @@ -519,7 +527,9 @@ class BlobStore { */ getBlobURL(hash) { const u = new URL(Settings.apis.filestore.url) - if (this.#globalBlobs.includes(hash)) { + if (this.#filestoreBlobPrefix) { + u.pathname = `${this.#filestoreBlobPrefix}/${hash}` + } else if (this.#globalBlobs.includes(hash)) { u.pathname = `/history/global/hash/${hash}` } else { u.pathname = `/history/project/${this.#historyId}/hash/${hash}` diff --git a/services/clsi/app/js/RequestParser.js b/services/clsi/app/js/RequestParser.js index 332df85033..4d153799a9 100644 --- a/services/clsi/app/js/RequestParser.js +++ b/services/clsi/app/js/RequestParser.js @@ -162,6 +162,11 @@ function parse(body, callback) { response.rawSnapshot = compile.rawSnapshot response.rawChangeOperations = compile.rawChangeOperations + // v1 conversions / submissions + if (compile.filestoreBlobPrefix) { + response.filestoreBlobPrefix = _checkPath(compile.filestoreBlobPrefix) + } + const rootResourcePath = _parseAttribute( 'rootResourcePath', compile.rootResourcePath, diff --git a/services/web/app/src/Features/Compile/ClsiManager.mjs b/services/web/app/src/Features/Compile/ClsiManager.mjs index b514529c8c..5da6c55c39 100644 --- a/services/web/app/src/Features/Compile/ClsiManager.mjs +++ b/services/web/app/src/Features/Compile/ClsiManager.mjs @@ -287,7 +287,7 @@ async function _sendBuiltRequest(projectId, userId, req, options) { await clearClsiServerId(projectId, userId, options.compileBackendClass) } const validationProblems = ClsiFormatChecker.checkRecoursesForProblems( - req.compile?.resources + req.compile?.resources || [] ) if (validationProblems != null) { logger.debug(