Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutionContext dirty flag is reset by a new put #4685

Open
mjwiq opened this issue Oct 18, 2024 · 1 comment · May be fixed by #4691
Open

ExecutionContext dirty flag is reset by a new put #4685

mjwiq opened this issue Oct 18, 2024 · 1 comment · May be fixed by #4691
Labels
status: waiting-for-triage Issues that we did not analyse yet type: bug

Comments

@mjwiq
Copy link

mjwiq commented Oct 18, 2024

Bug description
ExecutionContext.isDirty is supposed to tell if the context has been changed with a "put" operation since the dirty flag was last cleared (or the context was created). Only the clearDirtyFlag method is supposed to clear the flag once it has been set.

Instead, a "put" that sets a value to the same as its original value will also set the dirty flag to false, even if another put has happened before that did make a meaningfull change

Environment
Any code since commit 963142c will have this issue. The environment is not relevant

Steps to reproduce

  • Do a meaningful put (change a value to something different)
  • Do another put that does not actually change a value (for example, repeating the previous put)

Expected behavior
The dirty flag will still be true

Minimal Complete Reproducible example

@Test
void dirtyContextIsDirty() {
    ExecutionContext context = new ExecutionContext();
    context.put("hello", "world");
    assert context.isDirty(); // succeeds
    context.put("hello", "world");
    assert context.isDirty(); // fails
}

Further context
I did not have a problem with this yet. I just stumbled across it when looking at ExecutionContext
The issue was mentioned, but not addressed in #2020 (comment)

Proposed fix

this.dirty = this.dirty || result == null || !result.equals(value);
@GGHDMS
Copy link

GGHDMS commented Oct 27, 2024

i create fix pr #4691

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage Issues that we did not analyse yet type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants