damccorm opened a new pull request, #41870:
URL: https://github.com/apache/beam/pull/41870

   Note: this PR was auto-generated by tooling. Before moving it out of draft, 
the author has done a full review of the PR, specifically evaluating it on the 
following criteria:
   
   - The PR is an appropriate fix for the issue (e.g. we're not changing a test 
to avoid a bug)
   - The PR is a simple fix to the issue (e.g. we're not adding infra when we 
could just modify a test)
   - The PR is not covering for other problems (e.g. if we're bumping timeouts, 
it is not because we're covering for a performance problem)
     
   Full details of the methodology of generation and review can be found here - 
https://docs.google.com/document/d/14lj7ECVov4T4EdwmIzNlWrRGE3lLDMOwX5xUMGzaLoc/edit?usp=sharing
   
   If you have concerns with the PR or with the underlying methodology used to 
generate this, please comment below - they will be addressed by the author not 
the tooling :)
   
   ## Summary
   Fixes `GroupByEncryptedKeyTest.test_gbk_actually_does_encryption` and 
`GroupByEncryptedKeyTest.test_gbek_fake_secret_manager_actually_does_encryption`
 failing across all Python CI workflows under `cryptography==51.0.0` 
(`TypeError: cannot pickle 'cryptography.hazmat.bindings._rust.fernet.Fernet' 
object`).
   
   ## Failing `master` Runs (3 occurrences)
   - **PreCommit Python Transforms** (py311 & py314): 
https://github.com/apache/beam/actions/runs/46783808936 (jobs 
https://github.com/apache/beam/actions/runs/46783808936/job/143128487044, 
https://github.com/apache/beam/actions/runs/46783808936/job/143128487311; build 
scan https://develocity.apache.org/s/u6dlk7ck3ljlu)
   - **PreCommit Python Coverage** (py311): 
https://github.com/apache/beam/actions/runs/46783809054 (job 
https://github.com/apache/beam/actions/runs/46783809054/job/143128487409; build 
scan https://develocity.apache.org/s/p5ht3nvizrb46)
   - **PreCommit Python Coverage** (py311): 
https://github.com/apache/beam/actions/runs/46784022722 (job 
https://github.com/apache/beam/actions/runs/46784022722/job/143129232015; build 
scan https://develocity.apache.org/s/wqlxaz5v4rmx2)
   
   ## Root Cause
   `cryptography==51.0.0` replaced Python `Fernet` with a Rust-backed 
`cryptography.hazmat.bindings._rust.fernet.Fernet` object that is not 
picklable. Production DoFns `_EncryptMessage` (`util.py:350`) and 
`_DecryptMessage` (`util.py:387`) already construct `Fernet` in `setup()`, but 
test subclass `MockNoOpDecrypt` (`util_test.py:260`) constructed 
`self.fernet_tester = Fernet(hmac_key)` in `__init__()`, which fails during 
pipeline serialization.
   
   ## Changes
   - `sdks/python/apache_beam/transforms/util_test.py`: Moved 
`self.fernet_tester = Fernet(...)` from `MockNoOpDecrypt.__init__()` to 
`MockNoOpDecrypt.setup()` (calling `super().setup()` first), matching 
`_DecryptMessage`.
   - **Disjoint file note**: Open PR #41320 also edits `util_test.py`, strictly 
at lines 90 (`Timestamp` import) and 3016+ (`Reify` tests), >2,750 lines away 
from `MockNoOpDecrypt` (lines 257–268).
   
   ## Verification
   - Verified syntax locally (`python3 -m py_compile`).
   - Dispatched `beam_PreCommit_Python_Transforms.yml` (and `Python tests` / 
`PreCommit Python Coverage` run automatically on this PR).
   
   ### Verification
   - Triggered `.github/workflows/beam_PreCommit_Python_Transforms.yml` 
workflow run on branch: 
[`46794545782`](https://github.com/apache/beam/actions/runs/46794545782)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to