amoghrajesh opened a new issue, #59877:
URL: https://github.com/apache/airflow/issues/59877

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   When `AIRFLOW__CORE__MAX_TEMPLATED_FIELD_LENGTH` is set to very small values 
(e.g., 1, 5, 10), the Rendered Templates view in the Airflow UI shows 
inconsistent and broken truncation behavior.
   
   Let's take `1` as an example.
   
   If we set `AIRFLOW__CORE__MAX_TEMPLATED_FIELD_LENGTH=1` and run a task, it 
causes the Rendered Templates view to display truncated content inconsistently:
   - Some fields show only the truncation suffix without any actual content
   - Some fields are completely empty
   - The truncation suffix itself exceeds the configured max length
   
   
   ### What you think should happen instead?
   
   With `AIRFLOW__CORE__MAX_TEMPLATED_FIELD_LENGTH=1`, each templated field 
should:
   - Show at least 1 character of the actual value
   - Behave consistently across all field types
   
   ### How to reproduce
   
   1. Set `export AIRFLOW__CORE__MAX_TEMPLATED_FIELD_LENGTH=1` and run airflow
   2. Create a dag like this one:
   
   ```python
   from datetime import datetime
   from airflow.sdk import DAG
   from airflow.providers.standard.operators.bash import BashOperator
   
   with DAG(
       dag_id="test_max_length_1_bug",
       start_date=datetime(2024, 1, 1),
       schedule=None,
       catchup=False,
   ) as dag:
       task = BashOperator(
           task_id="test_truncation",
           bash_command="echo 'Field 1: {{ params.field1 }}' && echo 'Field 2: 
{{ params.field2 }}' && echo 'Field 3: {{ params.field3 }}'",
           params={
               "field1": "This is a long string that should be truncated",
               "field2": "Another long string for testing truncation behavior",
               "field3": "Short",
               "nested_dict": {
                   "key1": "Long value that needs truncation",
                   "key2": "Another long value",
                   "key3": "X"
               },
               "list_field": ["Item 1", "Item 2", "Item 3", "Item 4"],
           },
           env={
               "ENV_VAR_1": "Long environment variable value",
               "ENV_VAR_2": "Another long environment variable",
               "ENV_VAR_3": "Short"
           }
       )
   ```
   
   3. Observe rendered templates:
   
   <img width="2560" height="1261" alt="Image" 
src="https://github.com/user-attachments/assets/1eaafa28-9396-4d6c-bde4-71375b74fc44";
 />
   
   ### Operating System
   
   MacOS
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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