Skip to content

[WIP] feat: workflow engine integration#1684

Draft
bjorntore wants to merge 175 commits intomainfrom
feat/workflow-engine-integration
Draft

[WIP] feat: workflow engine integration#1684
bjorntore wants to merge 175 commits intomainfrom
feat/workflow-engine-integration

Conversation

@bjorntore
Copy link
Contributor

Description

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

bjorntore and others added 30 commits August 27, 2025 15:18
…ult enum and use result classes instead, for expandability.
…elds from result class and instead return generic failed ProcessChangeResult.
Move auto-advance orchestration from ExecuteServiceTask command to
the callback controller so state is captured after data is saved.
Remove null-state fallback in callback controller (error on null).
Add action support to ServiceTaskResult for BPMN-aware auto-advance.
Poll all active workflows instead of single workflow by ID.
Remove WorkflowType enum and IdempotencyKey/Type from WorkflowRequest
(idempotency key moved to batch-level WorkflowEnqueueRequest).
Add JsonStringEnumConverter to PersistentItemStatus enum so it
deserializes correctly as dictionary values.
/// <summary>
/// Gets or sets the API key for authenticating with the Workflow Engine.
/// </summary>
public string WorkflowEngineApiKey { get; set; } = "0544ba8b-2d8a-4ec9-b93a-47cdbd220293";

Check failure

Code scanning / SonarCloud

Secrets should not be hard-coded High

"WorkflowEngineApiKey" detected here, make sure this is not a hard-coded secret. See more on SonarQube Cloud
bjorntore and others added 2 commits March 6, 2026 13:01
Wire up IInstanceLocker in ProcessEngine constructor and fix
await using / duplicate using in ProcessEngineTest.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9897f6f6-de4a-4478-b7c0-029ca627adaf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/workflow-engine-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

bjorntore and others added 8 commits March 6, 2026 13:03
Co-Authored-By: Claude Opus 4.6 <[email protected]>
IInstanceLocker.LockAsync now returns the lock token acquired from
Storage. ProcessEngine uses it directly, removing the need for
controllers to generate and pass fake tokens. LockToken removed
from ProcessNextRequest and SubmitInitialProcessState parameter.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sanitize route-derived commandKey with LogSanitizer and use structured
logging placeholders instead of string interpolation in log calls.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Rename InstanceState → WorkflowStateSnapshot and InstanceStateService →
WorkflowStateSnapshotService. Split typed capture from serialization:
CaptureSnapshot returns WorkflowStateSnapshot, RestoreSnapshot accepts it,
and static Serialize/Deserialize handle the string conversion at HTTP
boundaries only.

Internal code (ProcessEngine, IProcessEngine.EnqueueProcessNext,
ProcessNextRequestFactory) now passes the typed WorkflowStateSnapshot.
Serialization to the opaque string happens only at the wire boundary
(WorkflowEngineCallbackController and ProcessNextRequestFactory.Create).

CaptureSnapshot deep-copies the Instance to prevent mutation after capture
but before serialization.

Also removes the legacy RunProcessNext_PdfFails_DataIsUnlocked test.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- ProcessEngineTest: update stale OperationId expectation to include the
  end event name ("Task_2 -> EndEvent_1")
- SigningControllerTests: add missing GetProcessTasks() mock setup so
  VerifyIsSigningTask resolves correctly on the strict mock instead of
  throwing before the task-type check

Co-Authored-By: Claude Opus 4.6 <[email protected]>
InstanceLocker.LockAsync() extracted instance identifiers from HTTP route
values, which fails during instance creation (POST /instances/create)
where those route parameters don't exist. Added overloads that accept
identifiers directly, and SubmitInitialProcessState now passes them
from the Instance object.

Also adds FakeWorkflowEngineClient for integration tests, which executes
workflow commands in-process via WorkflowEngineCallbackController instead
of requiring an external workflow engine HTTP service.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants