Skip to content

Commit 91aa2aa

Browse files
authored
Upgrade to cel-rust 0.14.5, refresh dependencies, bump CI actions (#42)
## Why cel-rust 0.14.4/0.14.5 change behaviour the wrapper has to follow, and the Python and Actions dependencies had drifted. ## Upstream behaviour now reflected - **Reserved CEL words are rejected as identifiers** (`var`, `let`, `if`, ...). Spec-correct, but user-visible: `var == "x"` is now a parse-time `ValueError` even if the context defines `var`. Tests that used `var` are renamed; a parametrised test pins all 17 words. Called out first in the CHANGELOG. - **`type()` is native** and returns a first-class type value, so `type(1u) == uint` and `type(null) == null_type` work inside expressions. Upstream converts a type value to its name when returning it, so Python receives `"int"`. The string-returning `type()` and identity `dyn()` shims are removed from `cel.stdlib` (built-ins already shadowed them). Visible differences: `uint` reports `"uint"` not `"int"`, `null` reports `"null_type"`. - **`int()`/`uint()` reject out-of-range conversions.** Mapped to `OverflowError`, matching the existing arithmetic overflow mapping. - Pinned: negative hex literals, stacked unary operators, bytes-literal escape rules, optional equality by content. ## Dependencies - cel 0.14.3 → 0.14.5 (minimum now 0.14.5) plus in-range transitive bumps. 83 crates checked against OSV: no advisories. - `tool.uv.dev-dependencies` → `dependency-groups.dev` (deprecation warning); `uv.lock` refreshed (ruff 0.16.6 stays inside the 0.16 pin). - Actions: checkout v7, setup-python v7, upload-artifact v7, download-artifact v8 (digest mismatch now fails the job), setup-uv v10 (cache disabled on fork PRs and Dependabot rollups). ## Verification `cargo fmt --check`, `cargo clippy -D warnings`, `cargo test`, pytest (510 passed, 1 skipped, 5 xfailed; was 482/6 xfailed), ruff format/check, mypy, `ty` probe, and the executed doc snippets all pass locally.
1 parent 6594a38 commit 91aa2aa

19 files changed

Lines changed: 408 additions & 272 deletions

.github/workflows/ci.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
matrix:
2727
python-version: ["3.11", "3.12", "3.13", "3.14"]
2828
steps:
29-
- uses: actions/checkout@v5
29+
- uses: actions/checkout@v7
3030

3131
- name: Install uv
32-
uses: astral-sh/setup-uv@v7
32+
uses: astral-sh/setup-uv@v10.0.1
3333
with:
3434
version: "latest"
3535

@@ -56,10 +56,10 @@ jobs:
5656
name: Code Quality & Type Checking
5757
runs-on: ubuntu-latest
5858
steps:
59-
- uses: actions/checkout@v5
59+
- uses: actions/checkout@v7
6060

6161
- name: Install uv
62-
uses: astral-sh/setup-uv@v7
62+
uses: astral-sh/setup-uv@v10.0.1
6363
with:
6464
version: "latest"
6565

@@ -119,8 +119,8 @@ jobs:
119119
- runner: ubuntu-latest
120120
target: ppc64le
121121
steps:
122-
- uses: actions/checkout@v5
123-
- uses: actions/setup-python@v6
122+
- uses: actions/checkout@v7
123+
- uses: actions/setup-python@v7
124124
with:
125125
python-version: '3.11'
126126
- name: Build wheels
@@ -131,7 +131,7 @@ jobs:
131131
sccache: 'true'
132132
manylinux: auto
133133
- name: Upload wheels
134-
uses: actions/upload-artifact@v5
134+
uses: actions/upload-artifact@v7
135135
with:
136136
name: wheels-linux-${{ matrix.platform.target }}
137137
path: dist
@@ -147,8 +147,8 @@ jobs:
147147
- runner: windows-latest
148148
target: x86
149149
steps:
150-
- uses: actions/checkout@v5
151-
- uses: actions/setup-python@v6
150+
- uses: actions/checkout@v7
151+
- uses: actions/setup-python@v7
152152
with:
153153
python-version: '3.11'
154154
architecture: ${{ matrix.platform.target }}
@@ -159,7 +159,7 @@ jobs:
159159
args: --release --out dist --find-interpreter
160160
sccache: 'true'
161161
- name: Upload wheels
162-
uses: actions/upload-artifact@v5
162+
uses: actions/upload-artifact@v7
163163
with:
164164
name: wheels-windows-${{ matrix.platform.target }}
165165
path: dist
@@ -175,8 +175,8 @@ jobs:
175175
- runner: macos-14
176176
target: aarch64
177177
steps:
178-
- uses: actions/checkout@v5
179-
- uses: actions/setup-python@v6
178+
- uses: actions/checkout@v7
179+
- uses: actions/setup-python@v7
180180
with:
181181
python-version: '3.11'
182182
- name: Build wheels
@@ -186,7 +186,7 @@ jobs:
186186
args: --release --out dist --find-interpreter
187187
sccache: 'true'
188188
- name: Upload wheels
189-
uses: actions/upload-artifact@v5
189+
uses: actions/upload-artifact@v7
190190
with:
191191
name: wheels-macos-${{ matrix.platform.target }}
192192
path: dist
@@ -195,14 +195,14 @@ jobs:
195195
runs-on: ubuntu-latest
196196
needs: [test, lint]
197197
steps:
198-
- uses: actions/checkout@v5
198+
- uses: actions/checkout@v7
199199
- name: Build sdist
200200
uses: PyO3/maturin-action@v1
201201
with:
202202
command: sdist
203203
args: --out dist
204204
- name: Upload sdist
205-
uses: actions/upload-artifact@v5
205+
uses: actions/upload-artifact@v7
206206
with:
207207
name: wheels-sdist
208208
path: dist
@@ -222,10 +222,10 @@ jobs:
222222
# contents: write lets the last step create the GitHub release for the tag.
223223
contents: write
224224
steps:
225-
- uses: actions/checkout@v5
225+
- uses: actions/checkout@v7
226226

227227
- name: Collect wheels and sdist
228-
uses: actions/download-artifact@v5
228+
uses: actions/download-artifact@v8
229229
with:
230230
pattern: wheels-*
231231
merge-multiple: true

.github/workflows/claude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
id-token: write
2626
steps:
2727
- name: Checkout repository
28-
uses: actions/checkout@v5
28+
uses: actions/checkout@v7
2929
with:
3030
fetch-depth: 1
3131

.github/workflows/security.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ jobs:
2323
issues: write
2424
checks: write
2525
steps:
26-
- uses: actions/checkout@v5
26+
- uses: actions/checkout@v7
2727

2828
- name: Run Rust security audit
2929
uses: rustsec/audit-check@v2.0.0
3030
with:
3131
token: ${{ secrets.GITHUB_TOKEN }}
3232

3333
- name: Install uv
34-
uses: astral-sh/setup-uv@v7
34+
uses: astral-sh/setup-uv@v10.0.1
3535
with:
3636
version: "latest"
3737

@@ -56,7 +56,7 @@ jobs:
5656
security-events: write
5757
steps:
5858
- name: Checkout repository
59-
uses: actions/checkout@v5
59+
uses: actions/checkout@v7
6060

6161
- name: Initialize CodeQL
6262
uses: github/codeql-action/init@v3

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **CEL reserved words are now rejected as identifiers.** cel-rust 0.14.4 enforces the
13+
specification's reserved word list (`as`, `break`, `const`, `continue`, `else`, `for`,
14+
`function`, `if`, `import`, `let`, `loop`, `package`, `namespace`, `return`, `var`,
15+
`void`, `while`), so an expression such as `var == "x"` now raises `ValueError` at
16+
parse time even if the context defines `var`. Names that merely contain a reserved
17+
word (`var_2`) and map keys (`{"var": 1}["var"]`) are unaffected. Rename such
18+
variables before upgrading.
19+
- `type()` is now provided natively by cel-rust 0.14.5 and returns a first-class CEL
20+
type value, so `type(x) == int`, `type(1u) == uint` and `type(null) == null_type`
21+
work inside expressions. Returned to Python, a type value arrives as its name. The
22+
string-returning `type()` shim and the identity `dyn()` shim have been removed from
23+
`cel.stdlib`'s `core` library because the native functions take precedence anyway;
24+
the only visible differences are that `uint` is now reported as `"uint"` rather than
25+
`"int"` and `null` as `"null_type"` rather than `"null"`.
26+
- `int()` and `uint()` reject conversions that do not fit the target type (for example
27+
`int(9223372036854775808u)`, `uint(-1)`, `int(1e300)` and `int(double("NaN"))`),
28+
raising `OverflowError` instead of silently wrapping or saturating.
29+
- `duration` and `timestamp` values report their spec type names from `type()`:
30+
`google.protobuf.Duration` and `google.protobuf.Timestamp`.
31+
32+
### Fixed
33+
34+
- Negative hexadecimal literals (`-0x10`) parse; stacked unary operators (`--1`,
35+
`!!true`) cancel; `\u` escapes inside bytes literals are rejected per the spec;
36+
and `optional.of(1) == optional.of(1)` compares by content (all from cel-rust
37+
0.14.4/0.14.5).
38+
39+
### Updated
40+
41+
- cel-rust 0.14.3 to 0.14.5 (the minimum is now 0.14.5), plus in-range transitive
42+
bumps (log 0.4.34, uuid 1.26.0, smallvec 1.16.0, cc 1.4.5, syn 3.0.5).
43+
- Python dev dependencies moved from the deprecated `tool.uv.dev-dependencies` to
44+
`dependency-groups.dev`; `uv.lock` refreshed (ruff 0.16.6, typer 0.27.2,
45+
maturin 1.15.0).
46+
- GitHub Actions: `actions/checkout` v7, `actions/setup-python` v7,
47+
`actions/upload-artifact` v7, `actions/download-artifact` v8 (digest mismatches
48+
now fail the job), `astral-sh/setup-uv` v10 (cache disabled on pull requests
49+
from forks and on Dependabot rollups, to guard against cache poisoning).
1050
### Updated
1151

1252
- Releases publish to PyPI with

Cargo.lock

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
pyo3 = { version = "0.29", features = ["chrono", "py-clone"]}
13-
cel = { version = "0.14.0", features = ["chrono", "json", "regex", "bytes"] }
13+
cel = { version = "0.14.5", features = ["chrono", "json", "regex", "bytes"] }
1414
log = "0.4.27"
1515
pyo3-log = "0.13.4"
1616
chrono = { version = "0.4.42", features = ["serde"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
**Fast, Safe, and Expressive evaluation of Google's Common Expression Language (CEL) in Python, powered by Rust.**
88

9-
The Common Expression Language (CEL) is a non-Turing complete language designed for simplicity, speed, and safety. This Python package wraps the Rust implementation [cel](https://crates.io/crates/cel) v0.14.0, providing microsecond-level expression evaluation with seamless Python integration.
9+
The Common Expression Language (CEL) is a non-Turing complete language designed for simplicity, speed, and safety. This Python package wraps the Rust implementation [cel](https://crates.io/crates/cel) v0.14.5, providing microsecond-level expression evaluation with seamless Python integration.
1010

1111
## 🚀 Use Cases
1212

docs/contributing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ def test_lower_ascii_expected_behavior(self):
158158
| Category | Status | Impact |
159159
|----------|--------|---------|
160160
| **String Functions** (`lowerAscii`, `upperAscii`, `indexOf`, etc.) | 8 functions monitored | Medium - String processing |
161-
| **Type Introspection** (`type()` function) | Ready to detect | Medium - Dynamic typing |
162161
| **Mixed Arithmetic** (`int + uint` operations) | Comprehensive detection | Medium - Type safety |
163162
| **Optional Values** (`optional.of()`, `?.` chaining) | Future feature detection | Low - Advanced use cases |
164163
| **🚨 OR Operator** (CEL spec compliance) | **Critical behavioral difference** | **High - Logic errors** |

0 commit comments

Comments
 (0)