Skip to content

Fix getBulkStatus() for OPEN operations (issue 36911) - #41245

Open
parsoya wants to merge 3 commits into
magento:2.4-developfrom
parsoya:issue-36911-bulk-status
Open

Fix getBulkStatus() for OPEN operations (issue 36911)#41245
parsoya wants to merge 3 commits into
magento:2.4-developfrom
parsoya:issue-36911-bulk-status

Conversation

@parsoya

@parsoya parsoya commented Sep 8, 2026

Copy link
Copy Markdown

Description (*)

BulkStatus::getBulkStatus() treated every persisted operation row as processed. OPEN rows were counted as complete, so a bulk that still had OPEN work (or work not persisted yet) was reported as Finished with Failure.

This change counts:

  • processed = persisted rows minus OPEN rows
  • pending = OPEN rows plus scheduled operations that are not in magento_operation yet

Status is then:

  • Not Started if nothing has left OPEN
  • Finished Successfully if every scheduled operation is COMPLETE
  • In Progress if any work is still pending
  • Finished with Failure only when processing finished and not all operations succeeded

Unit and integration tests cover all-OPEN and mixed OPEN/complete bulks.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Bulk status returning FINISHED_WITH_ERRORS status while is IN_PROGRESS #36911

Manual testing scenarios (*)

  1. Pause queue consumers so bulk operations stay OPEN (bin/magento queue:consumers:stop or disable cron_consumers_runner).
  2. In Admin, run a bulk product update (Catalog → Products → select a few products → Update attributes). Note the bulk UUID from System → Action Logs → Bulk Actions, or from magento_bulk.uuid.
  3. Call bulk status for that UUID (REST GET /V1/bulk/:uuid/status or PHP BulkStatusInterface::getBulkStatus()).
    • Expected before fix: Finished with Failure while operations are still OPEN.
    • Expected after fix: Not Started if no operation has completed; In Progress if some completed and some are still OPEN.
  4. Start the matching consumer (for attribute updates: bin/magento queue:consumers:start product_action_attribute.update).
  5. Recheck status. Expected: Finished Successfully when all operations complete, or Finished with Failure only if some failed and none remain OPEN.
  6. Repeat with a mixed bulk (some complete, some still OPEN) and confirm In Progress, not Finished with Failure.

Questions or comments

Admin Bulk Actions grid status uses CalculatedStatusSql (MAX(status)), not getBulkStatus(). This PR fixes the API / getBulkStatus() path reported in #36911. Grid display for all-OPEN bulks is unchanged.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Count OPEN (and not-yet-persisted) operations as pending so getBulkStatus() returns Not Started or In Progress instead of Finished with Failure.

Fixes magento#36911
@m2-assistant

m2-assistant Bot commented Sep 8, 2026

Copy link
Copy Markdown

Hi @parsoya. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@parsoya

parsoya commented Sep 8, 2026

Copy link
Copy Markdown
Author

@magento run all tests

@parsoya

parsoya commented Sep 9, 2026

Copy link
Copy Markdown
Author

@magento run Static Tests

@parsoya

parsoya commented Sep 9, 2026

Copy link
Copy Markdown
Author

Relevant builds for this change are green: Unit Tests, Integration Tests, Semantic Version Checker, Database Compare, Magento Health Index, Preliminary Checks.

This PR is a single commit, six files, all in Magento_AsynchronousOperations (BulkStatus.php + unit/integration tests). It does not touch storefront JS, admin order view, or MFTF.

Remaining red checks are pre-existing / infrastructure and unrelated to getBulkStatus():

  • Static Tests: re-run still returned "no build reports were generated" (no PHPCS output to act on). Please treat as infrastructure.
  • Functional CE / EE / B2B:
    • MC-89: listing add-to-cart stays on the category URL (…/apicategory….html?product_list_mode=list); the mainline test still expects a redirect to the product URL key. This PR does not change that test or catalog JS.
    • MC-25479: remainder span stays display:none after hover; waitForElementVisible on dd:nth-child(2) is a no-op. Same failure in CE and EE, including retries.
    • MC-219, AC-15180, MC-10899, AC-8015: ElementClickInterceptedException from the sticky page-actions _fixed toolbar (Chrome 150).
    • AC-4273: timeout waiting for $330.00 (known flake).
  • WebAPI: one broken test, Downloadable ProductRepositoryTest::testCreateDownloadableProduct — "Link URL's domain is not in list of downloadable_domains in env.php". GraphQL and SOAP suites passed.

Happy to re-run a specific build if a maintainer asks.

@parsoya

parsoya commented Sep 11, 2026

Copy link
Copy Markdown
Author

@magento run all tests

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

Labels

Priority: P3 May be fixed according to the position in the backlog. Progress: pending review

Projects

Status: Pending Review

Development

Successfully merging this pull request may close these issues.

Bulk status returning FINISHED_WITH_ERRORS status while is IN_PROGRESS

2 participants