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

   
   This Pull Request fixes a silent production bug in the Pub/Sub subscription 
cleaner (`stale_cleaner.py`) and aligns the unit test suite 
(`stale_cleaner_test.py`) to validate the fix properly.
   
   ## Problem Detectd
   
   In `master`, the `PubSubSubscriptionCleaner._delete_resource` method used 
`self.client.subscription_path(self.project_id, resource_name)`. 
   *   However, the `delete_stale()` orchestrator passes the **full GCP 
resource path** (e.g. 
`projects/apache-beam-testing/subscriptions/taxirides-realtime_beam_...`) from 
the GCS JSON state to `_delete_resource`.
   *   This caused the Google Cloud Client Library to generate a duplicated, 
invalid URI: 
`projects/apache-beam-testing/subscriptions/projects/apache-beam-testing/subscriptions/...`.
   *   The API call failed silently with a `403/404` error on GCP, leaving the 
orphaned subscriptions alive and continuing the financial billing leak.
   
   ## Changes Applied 
   
    **`stale_cleaner.py`**:
       *   Simplified `_delete_resource` in `PubSubSubscriptionCleaner` to pass 
`resource_name` directly into the delete request, bypassing the redundant 
`subscription_path()`.
       
    **`stale_cleaner_test.py`**:
       *   Updated `PubSubSubscriptionCleanerTest.test_delete_resource` to feed 
a realistic full GCP path (`projects/test-project/subscriptions/...`) and 
assert that `delete_subscription` is called with that exact direct path.
    
   ###  Verification & Testing
   - Unit tests run and pass locally with 100% success (`PASSED`):
     ```bash
     pytest stale_cleaner_test.py -v
   ```


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