Skip to content

[FND-198] Switch project’s type variant in background - #24559

Open
dfriquet wants to merge 1 commit into
feature/fnd-109-changing-the-active-type-variant-in-a-projectfrom
implementation/fnd-187-run-the-type-switch-in-a-background-job
Open

[FND-198] Switch project’s type variant in background#24559
dfriquet wants to merge 1 commit into
feature/fnd-109-changing-the-active-type-variant-in-a-projectfrom
implementation/fnd-187-run-the-type-switch-in-a-background-job

Conversation

@dfriquet

@dfriquet dfriquet commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/FND-198

Stacked on #24540 (FND-109) — the base of this PR is that branch, so it needs to merge first. The diff here is the background execution only.

What are you trying to accomplish?

  • Run a project's type-variant switch in a background job rather than in the request.

Feedback is in-place state on the type row — a spinner plus "Switching to variant: …", keyed on the project rather than the user, so a colleague who did not start it sees it too.

A job-status dialog was built as the alternative so the two could be compared. The designer chose the row indicator, so the last commit removes the dialog.

Screenshots

Screenshot of the spinner

What approach did you choose and why?

  • Debounce instead of WP count:
    • Relies on perceived user-time: the request waits up to a second for the job's status row to settle. That duration is arbitrary and the constant can be easily changed.
    • A first commit gated on a work package count (BACKGROUND_THRESHOLD); the debounce replaces it, since process time per WP can’t be steadily guessed.
  • The row names the target variant on its own ("Switching to variant: Blueprint"), reusing the wording the settled row already uses rather than the composite name. Switching to the family parent leaves the project on no variant at all, so that case reads "Switching to:" instead.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...) — Chrome only so far

@dfriquet
dfriquet force-pushed the implementation/fnd-187-run-the-type-switch-in-a-background-job branch from 0ccbd53 to cb018ce Compare August 3, 2026 10:08
@dfriquet dfriquet changed the title [FND-187] Update work packages of the old type to use the new one [FND-198] Switch project’s type variant in background Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/projects/create_spec.rb[1:12:3:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24559, linked for reference only):

- `rspec ./spec/features/projects/create_spec.rb[1:12:3:1]`

Treat this as a standalone task, unrelated to PR #24559. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24559 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @dfriquet to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @dfriquet, and request a review from @dfriquet.
On every commit, set @dfriquet as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/wikis/spec/features/admin/internal_provider_spec.rb[1:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24559, linked for reference only):

- `rspec ./modules/wikis/spec/features/admin/internal_provider_spec.rb[1:1]`

Treat this as a standalone task, unrelated to PR #24559. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24559 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @dfriquet to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @dfriquet, and request a review from @dfriquet.
On every commit, set @dfriquet as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@dfriquet
dfriquet force-pushed the implementation/fnd-187-run-the-type-switch-in-a-background-job branch from cedc6f3 to ce55a7b Compare August 3, 2026 12:13
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/overviews/spec/features/managing_dashboard_page_spec.rb[1:1:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24559, linked for reference only):

- `rspec ./modules/overviews/spec/features/managing_dashboard_page_spec.rb[1:1:1]`

Treat this as a standalone task, unrelated to PR #24559. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24559 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @dfriquet to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @dfriquet, and request a review from @dfriquet.
On every commit, set @dfriquet as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@dfriquet
dfriquet force-pushed the implementation/fnd-187-run-the-type-switch-in-a-background-job branch 2 times, most recently from 5674cbe to f583a27 Compare August 4, 2026 15:10
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/workflows/edit_multi_role_spec.rb[1:4:4:2]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24559, linked for reference only):

- `rspec ./spec/features/workflows/edit_multi_role_spec.rb[1:4:4:2]`

Treat this as a standalone task, unrelated to PR #24559. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24559 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @dfriquet to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @dfriquet, and request a review from @dfriquet.
On every commit, set @dfriquet as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

Every switch is enqueued. The request then waits up to a second for it to
settle, so a small project reads as a plain page refresh while a slower one
leaves a spinner on the type row until it finishes.
@dfriquet
dfriquet force-pushed the implementation/fnd-187-run-the-type-switch-in-a-background-job branch from f583a27 to aa30b39 Compare August 4, 2026 16:13
@dfriquet
dfriquet marked this pull request as ready for review August 4, 2026 16:13
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:2:1]
  • rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:3:2:2:1:1]
  • rspec ./spec/features/projects/create_spec.rb[1:12:3:2:1]
  • rspec ./spec/features/roles/report_spec.rb[1:1]
  • rspec ./spec/features/roles/report_spec.rb[1:2]
  • rspec ./spec/features/roles/report_spec.rb[1:3]
  • rspec ./spec/features/workflows/edit_spec.rb[1:4:4]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24559, linked for reference only):

- `rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:2:1]`
- `rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:3:2:2:1:1]`
- `rspec ./spec/features/projects/create_spec.rb[1:12:3:2:1]`
- `rspec ./spec/features/roles/report_spec.rb[1:1]`
- `rspec ./spec/features/roles/report_spec.rb[1:2]`
- `rspec ./spec/features/roles/report_spec.rb[1:3]`
- `rspec ./spec/features/workflows/edit_spec.rb[1:4:4]`

Treat this as a standalone task, unrelated to PR #24559. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24559 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @dfriquet to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @dfriquet, and request a review from @dfriquet.
On every commit, set @dfriquet as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant