Naman-Gururani commented on issue #50003: URL: https://github.com/apache/airflow/issues/50003#issuecomment-5802732321
I'd like to work on this, going with the `KeyError` approach suggested above. Plan: `OutletEventAccessors` gets the task's outlets, and `__getitem__` raises a `KeyError` with a hint when the asset or alias isn't one of them. Outlets are matched the same way the API server matches them when registering events (`Asset` by name and URI, `Asset.ref` by name or URI, `AssetAlias` by name), so it only raises when the event would be dropped anyway. `yield Metadata` goes through the same accessor, so it's covered too, and it lines up with `inlet_events`, which already raises `KeyError` for assets that aren't inlets. One behaviour change to flag: a TaskFlow task that returns an `Asset` only gets it added to its outlets after it returns (`_handle_output`), so setting `outlet_events[asset]` for that asset inside the task currently works and would start raising. It doesn't seem to be documented, but if that should keep working, the alternative is to check after execution against the final outlets and log a warning instead of raising. Happy to go either way. I have the `KeyError` version working locally with tests. --- Drafted-by: Claude Code (Claude Opus 5.5); reviewed by @Naman-Gururani before posting -- 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]
