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

   
   ### Why
   
   The six supervisor discriminated unions (`ToTask`, `ToSupervisor`, 
`ToManager`, `ToDagProcessor`, `ToTriggerRunner`, `ToTriggerSupervisor`) rely 
on every member's class `__name__` matching its `type: Literal[...]` value so 
`CommsDecoder` routes wire frames to the right class — but nothing enforced 
that invariant, and two members had silently drifted on `main`.
   
   ### What
   
   - Add prek hook `check-supervisor-schemas-name-type-sync` that walks all six 
unions and fails when a member's class `__name__` differs from its `type` 
literal (or the literal is missing / multi-valued).
     - Entrypoint runs in prek's rich-only env; the actual introspection runs 
under the airflow-core venv via a sibling worker script.
     - Scoped to `comms.py`, `processor.py`, `triggerer_job_runner.py` so it 
only fires when relevant.
   - Fix the two pre-existing mismatches the new hook surfaces:
     - `XComCountResponse`: `Literal["XComLengthResponse"]` → 
`Literal["XComCountResponse"]`
     - `GetXComCount`: `Literal["GetNumberXComs"]` → `Literal["GetXComCount"]`
   - Update the one test assertion that pinned the old wire string in 
`test_supervisor.py`.
   - Add pytest coverage for the hook's classifier (pass / rename-drift / 
missing `type` / multi-value Literal / cross-union dedup) and for the 
`.pre-commit-config.yaml` wiring.
   
   ### Verfication
   
   <img width="1540" height="221" alt="Screenshot 2026-05-14 at 12 10 48 PM" 
src="https://github.com/user-attachments/assets/89e580e8-b1a8-4406-9d1c-930c6792d90c";
 />
   
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code Opus 4.7 following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


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