Skip to content

VCST-4673: Preserve System Context for Hangfire Background Jobs#2982

Merged
OlegoO merged 4 commits intodevfrom
feat/VCST-4673
Feb 25, 2026
Merged

VCST-4673: Preserve System Context for Hangfire Background Jobs#2982
OlegoO merged 4 commits intodevfrom
feat/VCST-4673

Conversation

@OlegoO
Copy link
Copy Markdown
Contributor

@OlegoO OlegoO commented Feb 24, 2026

Description

This feature focuses on supporting system context for background jobs:

  • Recurring (scheduled) jobs — triggered automatically by Hangfire CRON scheduler. The audit log should clearly indicate that the operation was performed by the system.

References

QA-test:

Jira-link:

https://virtocommerce.atlassian.net/browse/VCST-4673

Artifact URL:


Note

Medium Risk
Changes affect audit attribution and background-job identity propagation; misconfiguration or unexpected user resolution could alter CreatedBy/ModifiedBy values in persisted data and logs.

Overview
Recurring Hangfire jobs now set the thread user context to system:{RecurringJobId} during execution, instead of relying solely on the stored USER_NAME job parameter.

Auditing triggers now always write ModifiedBy from the current IUserNameResolver (removing the previous guard that kept the original value when it was unknown), and HttpContextUserResolver returns http:anonymous when a request exists but is unauthenticated (plus minor constant renames).

Written by Cursor Bugbot for commit 6cc6e31. This will update automatically on new commits. Configure here.

Image tag:
ghcr.io/VirtoCommerce/platform:3.1007.0-pr-2982-6cc6-vcst-4673-6cc6e31d

Comment thread src/VirtoCommerce.Platform.Hangfire/Middleware/HangfireUserContextMiddleware.cs Outdated
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.209
Timestamp: 24-02-2026T13:31:42

Comment thread src/VirtoCommerce.Platform.Data/Constants/DefaultEntityNames.cs Outdated
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.745
Timestamp: 24-02-2026T14:15:42

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread src/VirtoCommerce.Platform.Security/HttpContextUserResolver.cs
Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.833
Timestamp: 24-02-2026T15:28:55

@sonarqubecloud
Copy link
Copy Markdown

1 similar comment
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.554
Timestamp: 24-02-2026T15:49:27

@OlegoO OlegoO merged commit 943e6d6 into dev Feb 25, 2026
17 checks passed
@OlegoO OlegoO deleted the feat/VCST-4673 branch February 25, 2026 09:49
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.

3 participants