Skip to content

[#73458] Missing feature specs on drag & drop#22545

Merged
dombesz merged 2 commits intorelease/17.3from
code-maintenance/73458-missing-feature-specs-on-drag-and-drop
Mar 31, 2026
Merged

[#73458] Missing feature specs on drag & drop#22545
dombesz merged 2 commits intorelease/17.3from
code-maintenance/73458-missing-feature-specs-on-drag-and-drop

Conversation

@dombesz
Copy link
Copy Markdown
Contributor

@dombesz dombesz commented Mar 27, 2026

Ticket

https://community.openproject.org/work_packages/73458

What are you trying to accomplish?

What approach did you choose and why?

  • Check that project permissions are verified on the InboxController
  • Use a real sign in workflow to reproduce the bug caused by the previous buggy prepend_before_action impementation.

Merge checklist

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

@github-actions
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

Comment thread spec/support/authentication_helpers.rb Outdated
@EinLama
Copy link
Copy Markdown
Contributor

EinLama commented Mar 30, 2026

This PR should target release/17.3, not dev – or the version should be adjusted in the linked work package.

Copy link
Copy Markdown
Contributor

@EinLama EinLama left a comment

Choose a reason for hiding this comment

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

I think something is not yet quite right here 🤔

The spec spec/features/oauth/authorization_code_flow_spec.rb is failing - and it is failing locally on my machine, too. I suspected it was related to unmocking the RequestStore - but I cannot make it green it by removing it.

Further investigation is necessary here.

before do
logout
login_with(current_user.login, user_password)
planning_page.visit!
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Interestingly, these two lines along with the password definition in the user variable can be removed and this test will still pass. So the logout hack is not necessary ☝️

This only works with the RequestStore unmocking in place 🤔 However, that one might be causing a failing spec (see other comment). If so, the unmocking should be moved here instead of residing in the authentication helper.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, if the logout is not necessary, why does the unmocking have an effect? There might be other effects at play here.

Copy link
Copy Markdown
Contributor Author

@dombesz dombesz Mar 30, 2026

Choose a reason for hiding this comment

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

Interestingly, these two lines along with the password definition in the user variable can be removed and this test will still pass. So the logout hack is not necessary ☝️

Yes, that is correct. However if the real login is removed, the spec will still pass even without the fix applied, producing a false positive.

Having the real login flow will make the test fail if the fix is not applied, which is the correct behaviour.

Comment thread spec/support/authentication_helpers.rb Outdated
@EinLama
Copy link
Copy Markdown
Contributor

EinLama commented Mar 30, 2026

After some investigation, it seems like RequestStore is called with :anonymous_user in some situations. I think we might have to reset the mocks when logging out so that the original behavior is restored:

In authentication_helper:

  def login_as(user)
    # ...
    allow(RequestStore).to receive(:[]).and_call_original
    allow(RequestStore).to receive(:[]).with(:current_user).and_return(user)
  end

  # ...

  def logout
    # ...
    # Reset RequestStore stubs - restore original behavior for all keys:
    allow(RequestStore).to receive(:[]).and_call_original
  end

Sigh if only there was a web app without state 😅 Not sure if this is a good idea. But it makes both specs green. Maybe you'll find a better solution that is less frail.

@dombesz dombesz force-pushed the code-maintenance/73458-missing-feature-specs-on-drag-and-drop branch 2 times, most recently from abc98b6 to 1849038 Compare March 31, 2026 06:34
@dombesz dombesz force-pushed the code-maintenance/73458-missing-feature-specs-on-drag-and-drop branch from 1849038 to 0b0b4bd Compare March 31, 2026 07:11
@dombesz dombesz changed the base branch from dev to release/17.3 March 31, 2026 07:13
@dombesz dombesz requested a review from EinLama March 31, 2026 07:56
Copy link
Copy Markdown
Contributor

@EinLama EinLama left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this 👏 What an intricate bug 😅

@dombesz dombesz merged commit c67413c into release/17.3 Mar 31, 2026
1 check passed
@dombesz dombesz deleted the code-maintenance/73458-missing-feature-specs-on-drag-and-drop branch March 31, 2026 08:40
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants