Skip to content

Conversation

Boomatang
Copy link

@Boomatang Boomatang commented Oct 1, 2025

In a number of location there were comparisons against None, and boolean values that were using equality comparisons. This can lead to bugs caused by false positives. Bug of this nature are hard track down.

While I could not track down an instance of the bug, this PR introduces the correct pattern of using identity comparisons to the code base. Hopefully, the pattern will be followed within future work, and no unexpected bugs arise.

Equality and Identity by example

In the repl equality and identity can easily be seen.

>>> 1 == True # Equality
True
>>> 1 is True # Identity
False

Classes defining a custom __eq__() methods can have logic error that allowing None equality to be true.

class Foo:
  def __eq__(self, other):
    return True

bar = Foo()

if bar == None:
  print("bar is None !!!")

if bar is not None:
  print("but bar is also not None !!!")

More on comparisons can be found at https://docs.python.org/3/reference/expressions.html#comparisons

Verification

There is no fundamental change to the logic. All tests should pass as expected.

Note: Locally I was not setup to run e2e tests.

Fix a number of instances where Equality was being checked over
Identity. While no bug currently existed, this pattern was could have
caused an extremely hard to track down bug.

```python
>>> 1 == True # Equality
True
>>> 1 is True # Identity
False
```

Signed-off-by: Jim Fitzpatrick <[email protected]>
@openshift-ci openshift-ci bot requested review from chipspeak and dimakis October 1, 2025 15:22
Copy link
Contributor

openshift-ci bot commented Oct 1, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign laurafitzgerald for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.47%. Comparing base (e8404ec) to head (d928e0a).

Files with missing lines Patch % Lines
src/codeflare_sdk/ray/cluster/cluster.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #916   +/-   ##
=======================================
  Coverage   92.47%   92.47%           
=======================================
  Files          25       25           
  Lines        1395     1395           
=======================================
  Hits         1290     1290           
  Misses        105      105           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant