[#71645] Improve interface of WP identifier setting controller#22764
[#71645] Improve interface of WP identifier setting controller#22764
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the admin controller responsible for switching the Work Package identifier mode to use explicit dispatch (switch_to_semantic / switch_to_classic) and updates the background-job wiring accordingly (including adding new GoodJob-backed migration job stubs and updating the “job in progress” query).
Changes:
- Replace the previous
updateflow/guard with an explicitcasedispatch inAdmin::Settings::WorkPackagesIdentifierController. - Introduce new instance-level migration job stubs (
ConvertInstanceToSemanticIdsJob,RevertInstanceToClassicIdsJob) and updateWorkPackages::IdentifierAutofix.job_in_progress?to check for them. - Add a controller spec covering the new update behavior (enqueue/redirect/400 scenarios).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/controllers/admin/settings/work_packages_identifier_controller_spec.rb | New controller spec for the updated dispatch/enqueue behavior. |
| app/workers/project_identifiers/convert_instance_to_semantic_ids_job.rb | New job stub for switching instance to semantic identifiers (with GoodJob concurrency config). |
| app/workers/project_identifiers/revert_instance_to_classic_ids_job.rb | New job stub for reverting instance back to classic identifiers (with GoodJob concurrency config). |
| app/services/work_packages/identifier_autofix.rb | Update job_in_progress? to look for the new job class names in GoodJob. |
| app/controllers/admin/settings/work_packages_identifier_controller.rb | Refactor update into explicit branches that enqueue the corresponding jobs and handle invalid params as 400. |
Comments suppressed due to low confidence (1)
app/workers/project_identifiers/convert_instance_to_semantic_ids_job.rb:36
- The GoodJob concurrency limit is currently per job class (
total_limit: 1with the default key). That still allowsConvertInstanceToSemanticIdsJobandRevertInstanceToClassicIdsJobto run at the same time (one of each), which seems undesirable for mutually exclusive migrations and can still happen under concurrent requests. Consider setting an explicit sharedkeyfor both jobs (and usingperform_limit: 1if you only want one running at a time) so they are globally serialized.
|
@copilot Fill in the PR description again, respecting the template |
Done — the PR description now fills in all template sections (Ticket, What are you trying to accomplish?, approach rationale including why |
6ead97a to
cc475e6
Compare
Ticket
https://community.openproject.org/projects/communicator-stream/work_packages/71645/activity
What are you trying to accomplish?
Replace the single
updateaction (with booleanconfirm_dangerous_actionguard) with an explicit case dispatch toswitch_to_semantic/switch_to_classic. Each branch enqueues the matching instance-level job and redirects; an unrecognised setting parameter yields 400.The two new job classes are introduced as no-op stubs here; their real bodies land in the next two commits.
WorkPackages::IdentifierAutofix.job_in_progress?is updated to check GoodJob for the new job class names instead of the oldApplyHandlesJob(which is deleted here).Screenshots
What approach did you choose and why?
Merge checklist