Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

M-arcus
Copy link
Contributor

@M-arcus M-arcus commented Jul 31, 2025

1. Why is this change necessary?

Currently, there is no way to change the status of a scheduled task without directly editing the database.

2. What does this change do, exactly?

It adds 2 commands to schedule and disable scheduled tasks.

  • scheduled-task:schedule
  • scheduled-task:deactivate

3. Describe each step to reproduce the issue or behavior.

Let a scheduled task fail, and now there is no way to re-enable it without editing the database correctly.

4. Please link to the relevant issues (if any).

5. Checklist

  • I have written tests and verified that they fail without my change
  • I have created a changelog file with all necessary information about my changes
  • I have written or adjusted the documentation according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfilled them

@M-arcus M-arcus requested a review from a team July 31, 2025 19:29
@github-actions github-actions bot added the external-contribution A PR contributed by a community member. label Jul 31, 2025
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 82.43243% with 13 lines in your changes missing coverage. Please review.
βœ… Project coverage is 54.95%. Comparing base (9c49724) to head (b06734b).
⚠️ Report is 41 commits behind head on trunk.

Files with missing lines Patch % Lines
...e/Framework/MessageQueue/MessageQueueException.php 0.00% 12 Missing ⚠️
...ssageQueue/ScheduledTask/Registry/TaskRegistry.php 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #11670      +/-   ##
==========================================
- Coverage   54.99%   54.95%   -0.05%     
==========================================
  Files        4785     4787       +2     
  Lines      162763   162842      +79     
  Branches     8919     8923       +4     
==========================================
- Hits        89511    89483      -28     
- Misses      70633    70732      +99     
- Partials     2619     2627       +8     
Flag Coverage Ξ”
jest-admin 60.83% <ΓΈ> (-0.19%) ⬇️
jest-storefront 69.37% <ΓΈ> (ΓΈ)
phpunit-migration 48.39% <ΓΈ> (+0.08%) ⬆️
phpunit-unit 48.20% <82.43%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added the needs-triage A newly created issue or PR that needs team assignment and/or prioritization. label Jul 31, 2025
@M-arcus M-arcus changed the title feat: Add commands to schedule and disable scheduled tasks feat: Add commands to schedule and deactivate scheduled tasks Jul 31, 2025
@mitelg mitelg added component/core domain/framework Responsible for the framework-level code includes core, administration, storefront, and frontends and removed needs-triage A newly created issue or PR that needs team assignment and/or prioritization. labels Aug 4, 2025
Copy link
Contributor

@keulinho keulinho left a comment

Choose a reason for hiding this comment

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

Hey @M-arcus ,

thanks for your contribution, we think this would be a great addition! πŸ‘

I've left some smaller comments and looks like your tests are also failing because symfony adds some line breaks to the command output, maybe we can just remove them before comparing against the expected output?

Additionally please provide another PR to the docs repo to mention the new commands there as well: https://developer.shopware.com/docs/guides/hosting/infrastructure/scheduled-task.html#scheduled-task

@M-arcus
Copy link
Contributor Author

M-arcus commented Aug 4, 2025

[...] looks like your tests are also failing because symfony adds some line breaks to the command output, maybe we can just remove them before comparing against the expected output?

The tests work locally, but for some reason the GitHub Action CI adds extra line breaks. I'm going to loosen the check.

@M-arcus
Copy link
Contributor Author

M-arcus commented Aug 4, 2025

Additionally please provide another PR to the docs repo to mention the new commands there as well: developer.shopware.com/docs/guides/hosting/infrastructure/scheduled-task.html#scheduled-task

The docs PR is here, marked as a draft for now: shopware/docs#1882

@M-arcus
Copy link
Contributor Author

M-arcus commented Aug 4, 2025

The tests work locally, but for some reason the GitHub Action CI adds extra line breaks. I'm going to loosen the check.

I have fixed the tests in d7ab4ec

@M-arcus
Copy link
Contributor Author

M-arcus commented Aug 4, 2025

I have fixed the tests in d7ab4ec

Correction: Still not working because ShopwareStyle (or SymfonyStyle) prepends new lines with spaces that break sentences from the output.

Is there a PHPUnit test that tests out like this already?

@M-arcus M-arcus requested review from keulinho and mitelg August 4, 2025 11:38
@mitelg
Copy link
Member

mitelg commented Aug 4, 2025

@M-arcus the problem is, that the output on CI has line breaks in the middle of the sentence 😬

I am not sure, if we can make the CI output "wider" somehow, or else you would need to assert on the different parts of the outputs πŸ™ˆ

@M-arcus
Copy link
Contributor Author

M-arcus commented Aug 4, 2025

the problem is, that the output on CI has line breaks in the middle of the sentence 😬

I am not sure, if we can make the CI output "wider" somehow, or else you would need to assert on the different parts of the outputs πŸ™ˆ

@mitelg It's calculated here https://github.com/symfony/console/blob/7.3/Style/SymfonyStyle.php#L58 .
When set it to 20, it even cuts words off.
I solved it by comparing compressed strings.

@mitelg mitelg requested review from h1k3r and SpiGAndromeda August 5, 2025 09:51
@keulinho keulinho added this pull request to the merge queue Aug 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 5, 2025
@keulinho keulinho added this pull request to the merge queue Aug 5, 2025
Merged via the queue into shopware:trunk with commit 6ac671c Aug 5, 2025
64 of 65 checks passed
@mitelg
Copy link
Member

mitelg commented Aug 5, 2025

thanks for your contribution @M-arcus πŸ‘πŸŽ‰πŸ’™

@mkraeml mkraeml added this to the 6.7.2.0 milestone Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/core domain/framework Responsible for the framework-level code includes core, administration, storefront, and frontends external-contribution A PR contributed by a community member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants