kaxil opened a new pull request, #73296:
URL: https://github.com/apache/airflow/pull/73296

   Three `raise` sites pass `%s`-style format arguments to the exception 
constructor, which does not interpolate them. The extra arguments land in 
`args[1:]` and the message renders as a tuple repr, so the user sees the format 
string rather than their own values:
   
   ```
   before  ('%s task failed as %s not found.', 'wait_for_drop', 
'/data/incoming/*.csv')
   after   wait_for_drop task failed as /data/incoming/*.csv not found.
   
   before  ('conf parameter should be JSON Serializable %s', {'customer': {1, 
2}})
   after   conf parameter should be JSON Serializable: {'customer': {1, 2}}
   
   before  ('connection_config must be provided for %s', <StorageType.S3: 's3'>)
   after   connection_config must be provided for s3
   ```
   
   The `self.log.info("%s completed successfully as %s found.", ...)` on the 
line below the first one is correct and is left alone: Airflow's structlog 
processor applies `msg % args`, so the logging form interpolates. Only the 
exception constructor does not.
   
   Two of the three lines had no test reading the message, and the 
`connection_config is None` branch was not reached by any test at all, so both 
now have one. The third already had two assertions, but they matched on a 
prefix that appears in the tuple repr as well and so passed either way; they 
now require the interpolated form, and fail without the fix.
   
   Worth knowing before this is merged: it is coupled to #73076, which adds a 
prek hook plus `generated/known_exception_format_args.txt` recording exactly 
these three files at count 1, and says it does not fix them. Whichever lands 
second has to update the other -- if #73076 goes first, three counts need 
decrementing here; if this goes first, its allowlist is stale and the hook 
fails. I am happy to rebase on it in either order. Separately, #64941 moves 
`datafusion/object_storage_provider.py` into the amazon provider, so that one 
line may need rehoming.
   


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