Skip to content

Upgrade cel-python to 0.4.0 and update usage #2015

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

Merged
merged 3 commits into from
Aug 5, 2025
Merged

Upgrade cel-python to 0.4.0 and update usage #2015

merged 3 commits into from
Aug 5, 2025

Conversation

fangnx
Copy link
Member

@fangnx fangnx commented Aug 1, 2025

What

Fix usage of cel-py as some breaking changes were introduced in 0.4.0: cloud-custodian/cel-python#118

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA:

Test & Review

Open questions / Follow-ups

@Copilot Copilot AI review requested due to automatic review settings August 1, 2025 19:53
@fangnx fangnx requested review from MSeal and a team as code owners August 1, 2025 19:53
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the usage of the cel-python library by modifying how context is passed to the evaluator. The change moves context from being passed during activation creation to being passed during evaluation execution.

  • Updates CEL evaluator instantiation to pass context during evaluation rather than activation
  • Modifies the parameter passing pattern in the cel_field_presence module

@@ -41,6 +41,6 @@ def macro_has_eval(self, exprlist):
_has_state.in_has = False
return result

e = Evaluator(ast=self.ast, activation=self.new_activation(context), functions=self.functions)
value = e.evaluate()
e = Evaluator(ast=self.ast, activation=self.new_activation(), functions=self.functions)
Copy link
Preview

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

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

The new_activation() method is being called without the context parameter that was previously passed. Verify that this method can handle being called without parameters and that the context will be properly available when passed to evaluate().

Suggested change
e = Evaluator(ast=self.ast, activation=self.new_activation(), functions=self.functions)
e = Evaluator(ast=self.ast, activation=self.new_activation(context), functions=self.functions)

Copilot uses AI. Check for mistakes.

@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent

This comment has been minimized.

@fangnx fangnx changed the title Update cel-python usage Upgrade cel-python to 0.4.0 and update usage Aug 5, 2025
Copy link
Member

@rayokota rayokota left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqube-confluent
Copy link

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 100.00% Coverage (64.60% Estimated after merge)
  • Duplications No duplication information (5.50% Estimated after merge)

Project ID: confluent-kafka-python

View in SonarQube

@fangnx fangnx merged commit 7039489 into master Aug 5, 2025
3 checks passed
@fangnx fangnx deleted the celpy-update branch August 5, 2025 18:58
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy