https://sonarly.com/issue/29664?type=bug
When a workflow executes a CODE step, the `CodeWorkflowAction` calls `LogicFunctionExecutorService.execute()` which proceeds directly to `LambdaDriver.execute()` and attempts to read the compiled JavaScript from S3 via `getBuiltCode()`. Neither the workflow action nor the executor service checks the `isBuildUpToDate` flag on the logic function before attempting execution. If the logic function's source code has never been compiled (or was modified since last compile), no built artifact exists in S3, and the S3 driver throws `FileStorageException('File not found', FILE_NOT_FOUND)`.
The GraphQL execution path (`LogicFunctionFromSourceService.executeOneFromSource()`) correctly checks `flatLogicFunction.isBuildUpToDate` and triggers `buildOneFromSource()` before executing. The workflow path bypasses this entirely.
Fix: Added a `LOGIC_FUNCTION_NOT_BUILT` exception code and an `isBuildUpToDate` check in `LogicFunctionExecutorService.execute()`.
When a logic function's source code is created or updated, `isBuildUpToDate` is set to `false` and no built artifact exists in S3. The GraphQL execution path (`executeOneFromSource`) checks this flag and triggers a build first. However, the workflow path (`CodeWorkflowAction → LogicFunctionExecutorService.execute() → LambdaDriver.execute()`) did not check this flag, leading to a cryptic S3 "File not found" error when `getBuiltCode()` tried to read the non-existent built file.
The fix adds validation in `LogicFunctionExecutorService.execute()` — immediately after fetching the flat logic function entity, it checks `isBuildUpToDate`. If false, it throws a `LogicFunctionExecutionException` with the new `LOGIC_FUNCTION_NOT_BUILT` code and a clear message explaining the function needs to be built first.
This protects all callers of the executor (workflow actions, route triggers, future integrations) from hitting the cryptic S3 error. The existing route trigger error mapper handles unmapped codes by falling through to `LOGIC_FUNCTION_EXECUTION_ERROR` (500), which is correct behavior.
Note: The pre-flight build in `RunWorkflowJob.startWorkflowExecution` (`buildCodeStepsFromSourceForSteps`) is supposed to build unbuilt code steps before execution, but has a silent failure path — it skips the build without logging when `applicationUniversalIdentifier` cannot be resolved. This new check is defense-in-depth for when that pre-flight build fails silently.