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

   Fix the Trigger form silently clamping out-of-range numeric params
   
   The Trigger Dag form passed the Param schema's `minimum`/`maximum` straight 
to the number input, so the input clamped the typed value into the allowed 
range when it lost focus. Typing `6666` into a param declared as `Param(180, 
type="integer", minimum=1, maximum=600)` silently became `600`, and the Dag run 
started with the corrected value instead of the requested one. The CLI and the 
REST API reject the same value with `ParamValidationError`, so the trigger form 
was the only path that accepted it.
   
   The number field now keeps the value that was typed, validates it against 
the schema bounds, reports the violation inline and blocks the trigger, so no 
Dag run is created until the value is corrected.
   
   | before | after |
   | --- | --- |
   | ![Before: the typed 6666 is silently clamped to 600 and the trigger stays 
enabled](https://raw.githubusercontent.com/muditagrawal2007/airflow/screenshots-issue-75747/screenshots/issue-75747/trigger-param-before.png)
 | ![After: 6666 is kept, the violation is reported inline and the trigger is 
disabled](https://raw.githubusercontent.com/muditagrawal2007/airflow/screenshots-issue-75747/screenshots/issue-75747/trigger-param-after.png)
 |
   
   The screenshots were taken against a Dag declaring `hold_seconds` with 
`minimum=1` and `maximum=600`.
   
   ### Changes
   
   - `FieldNumber` no longer lets the number input clamp the value on blur 
(`clampValueOnBlur={false}`), so the value the user typed is the value that is 
submitted.
   - `FieldNumber` validates the value against the schema `minimum`/`maximum` 
and reports the violation through the existing flexible-form error channel, 
which shows the message inline and disables the trigger button.
   - New `getParamRangeViolation` helper holds the bounds check, so it can be 
unit tested on its own.
   
   ### Tests
   
   - `FieldNumber.test.tsx`: the typed value survives a blur (no clamping) for 
a value above the maximum and below the minimum, and the corresponding 
validation error is reported.
   - `getParamRangeViolation.test.ts`: the bounds check itself, including the 
inclusive bounds and the schema without bounds.
   - `TriggerDAGForm.test.tsx`: an out-of-range param value shows the error, 
disables the trigger button and does not create a Dag run.
   
   closes: #75747
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — OpenCode (MiniMax-M3)
   
   Generated-by: OpenCode (MiniMax-M3) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   Drafted-by: OpenCode (MiniMax-M3) (no human review 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]

Reply via email to