Skip to content

Equality Vs Identity#916

Merged
openshift-merge-bot[bot] merged 1 commit into
project-codeflare:mainfrom
Boomatang:Equality_vs_Identity
Feb 5, 2026
Merged

Equality Vs Identity#916
openshift-merge-bot[bot] merged 1 commit into
project-codeflare:mainfrom
Boomatang:Equality_vs_Identity

Conversation

@Boomatang

@Boomatang Boomatang commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

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.

@openshift-ci openshift-ci Bot requested review from chipspeak and dimakis October 1, 2025 15:22
@codecov

codecov Bot commented Oct 2, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.96%. Comparing base (70098a0) to head (821394f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/codeflare_sdk/ray/cluster/cluster.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #916      +/-   ##
==========================================
- Coverage   95.96%   95.96%   -0.01%     
==========================================
  Files          23       23              
  Lines        2208     2203       -5     
==========================================
- Hits         2119     2114       -5     
  Misses         89       89              

☔ 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.

@Boomatang Boomatang force-pushed the Equality_vs_Identity branch from d928e0a to 51e2b12 Compare October 20, 2025 08:48
@Boomatang Boomatang force-pushed the Equality_vs_Identity branch from 51e2b12 to efb8ea0 Compare December 8, 2025 16:35
@Boomatang Boomatang force-pushed the Equality_vs_Identity branch from efb8ea0 to 738c6fa Compare January 22, 2026 12:22
@kryanbeane kryanbeane added test-guided-notebooks Run PR check to verify Guided notebooks test-additional-notebooks test-ui-notebooks Run PR check to verify UI notebooks labels Jan 22, 2026
@Boomatang Boomatang force-pushed the Equality_vs_Identity branch from 738c6fa to b21a017 Compare January 22, 2026 15:21
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 <jfitzpat@redhat.com>
@Boomatang Boomatang force-pushed the Equality_vs_Identity branch from b21a017 to 821394f Compare February 5, 2026 13:47
@kryanbeane

Copy link
Copy Markdown
Contributor

/override verify-3_widget_example

@openshift-ci

openshift-ci Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

@kryanbeane: Overrode contexts on behalf of kryanbeane: verify-3_widget_example

Details

In response to this:

/override verify-3_widget_example

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kryanbeane kryanbeane left a comment

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.

thanks for the contribution Jim and apologies it took so long to get merged!

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Feb 5, 2026
@openshift-ci

openshift-ci Bot commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kryanbeane

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit bc89f92 into project-codeflare:main Feb 5, 2026
19 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. test-additional-notebooks test-guided-notebooks Run PR check to verify Guided notebooks test-ui-notebooks Run PR check to verify UI notebooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants