This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 27433bf4830 Show Dag version diff values-hidden pill only when values 
are hidden (#74746)
27433bf4830 is described below

commit 27433bf4830800f57970d4dad2b9772da2cf4e01
Author: Jed Cunningham <[email protected]>
AuthorDate: Wed Oct 14 11:53:27 2026 -0600

    Show Dag version diff values-hidden pill only when values are hidden 
(#74746)
    
    The comparison header always showed an "Observed state" pill, a "Values
    shown"/"Values hidden" pill and a "Values require access to Dag code"
    hint, so users who could see values were still told they needed access.
    
    Drop the static "Observed state" and "Values shown" pills and show the
    "Values hidden" pill only when values are withheld, with the access hint
    as its hover tooltip. Remove the now-unused translation keys.
---
 .../src/airflow/ui/public/i18n/locales/ca/dag.json |  4 +--
 .../src/airflow/ui/public/i18n/locales/de/dag.json |  4 +--
 .../src/airflow/ui/public/i18n/locales/el/dag.json |  4 +--
 .../src/airflow/ui/public/i18n/locales/en/dag.json |  4 +--
 .../src/airflow/ui/public/i18n/locales/fr/dag.json |  4 +--
 .../src/airflow/ui/public/i18n/locales/ko/dag.json |  4 +--
 .../src/airflow/ui/public/i18n/locales/pl/dag.json |  4 +--
 .../airflow/ui/public/i18n/locales/zh-TW/dag.json  |  4 +--
 .../ui/src/pages/Dag/Versions/VersionDiff.test.tsx | 33 ++++++++++++++++++----
 .../ui/src/pages/Dag/Versions/VersionDiff.tsx      | 16 +++++------
 10 files changed, 42 insertions(+), 39 deletions(-)

diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
index 455e6c134ea..f1633e4ed3c 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
@@ -290,7 +290,6 @@
     "maxChanges": "Màxim de canvis",
     "maxChangesDefault": "Per defecte",
     "noChanges": "Aquestes versions contenen el mateix estat.",
-    "observedState": "Estat observat",
     "observedStateBoundary": "Compara l'estat emmagatzemat actualment, no les 
dades del moment de creació. La comparació del codi font no està disponible per 
a versions històriques; utilitzeu la pestanya Codi per a comparar el codi 
font.",
     "operations": {
       "added": "Afegit",
@@ -312,7 +311,6 @@
       "title": "Comparació no disponible",
       "withoutReason": "No s'han pogut comparar aquestes versions."
     },
-    "valuesHidden": "Valors ocults",
-    "valuesShown": "Valors visibles"
+    "valuesHidden": "Valors ocults"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
index bb59dd2f30b..c0a791916d2 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
@@ -290,7 +290,6 @@
     "maxChanges": "Maximale Änderungen",
     "maxChangesDefault": "Standard",
     "noChanges": "Es gibt keinen Unterschied zwischen diesen Versionen.",
-    "observedState": "Beachteter Status",
     "observedStateBoundary": "Vergleicht aktuell gespeichterte Dagversionen. 
Quellcodevergleich ist nicht verfügbar für alte Versionen; Code-Tab nutzen um 
Quellcode zu vergleichen.",
     "operations": {
       "added": "Hinzugefügt",
@@ -312,7 +311,6 @@
       "title": "Vergleich nicht verfügbar",
       "withoutReason": "Diese Versionen können nicht verglichen werden."
     },
-    "valuesHidden": "Werte verstecken",
-    "valuesShown": "Werte anzeigen"
+    "valuesHidden": "Werte verstecken"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
index 2b00a6442cd..6553b05a05e 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
@@ -290,7 +290,6 @@
     "maxChanges": "Μέγιστες αλλαγές",
     "maxChangesDefault": "Προεπιλογή",
     "noChanges": "Αυτές οι εκδόσεις έχουν την ίδια κατάσταση.",
-    "observedState": "Παρατηρούμενη κατάσταση",
     "observedStateBoundary": "Συγκρίνει την τρέχουσα αποθηκευμένη κατάσταση, 
όχι στοιχεία από τη στιγμή της δημιουργίας. Η σύγκριση πηγαίου κώδικα δεν είναι 
διαθέσιμη για ιστορικές εκδόσεις· χρησιμοποιήστε την καρτέλα Κώδικας για 
σύγκριση πηγαίου κώδικα.",
     "operations": {
       "added": "Προστέθηκε",
@@ -312,7 +311,6 @@
       "title": "Η σύγκριση δεν είναι διαθέσιμη",
       "withoutReason": "Δεν ήταν δυνατή η σύγκριση αυτών των εκδόσεων."
     },
-    "valuesHidden": "Οι τιμές είναι κρυφές",
-    "valuesShown": "Οι τιμές εμφανίζονται"
+    "valuesHidden": "Οι τιμές είναι κρυφές"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
index a30b6f8b5c6..654c52203c0 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
@@ -337,7 +337,6 @@
     "maxChanges": "Max changes",
     "maxChangesDefault": "Default",
     "noChanges": "These versions hold the same state.",
-    "observedState": "Observed state",
     "observedStateBoundary": "Compares currently stored state, not 
creation-time evidence. Source comparison is unavailable for historical 
versions; use the Code tab to compare source.",
     "operations": {
       "added": "Added",
@@ -360,7 +359,6 @@
       "title": "Comparison unavailable",
       "withoutReason": "These versions could not be compared."
     },
-    "valuesHidden": "Values hidden",
-    "valuesShown": "Values shown"
+    "valuesHidden": "Values hidden"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
index 48e2111abef..4ad96980381 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
@@ -299,7 +299,6 @@
     "maxChanges": "Changements max.",
     "maxChangesDefault": "Par défaut",
     "noChanges": "Ces versions ont le même état.",
-    "observedState": "État observé",
     "observedStateBoundary": "Compare l'état actuellement stocké, et non les 
preuves au moment de la création. La comparaison des sources n'est pas 
disponible pour les versions historiques ; utilisez l'onglet Code pour comparer 
les sources.",
     "operations": {
       "added": "Ajouté",
@@ -323,7 +322,6 @@
       "title": "Comparaison indisponible",
       "withoutReason": "Ces versions n'ont pas pu être comparées."
     },
-    "valuesHidden": "Valeurs masquées",
-    "valuesShown": "Valeurs affichées"
+    "valuesHidden": "Valeurs masquées"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
index ee202b4e3fa..3cee58a3fd4 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
@@ -337,7 +337,6 @@
     "maxChanges": "최대 변경 수",
     "maxChangesDefault": "기본값",
     "noChanges": "두 버전에 저장된 상태가 같습니다.",
-    "observedState": "관측된 상태",
     "observedStateBoundary": "버전 생성 시점의 기록이 아니라 현재 저장된 상태를 비교합니다. 이전 버전은 소스 
비교를 지원하지 않으므로, 소스를 비교하려면 코드 탭을 사용하세요.",
     "operations": {
       "added": "추가됨",
@@ -359,7 +358,6 @@
       "title": "비교할 수 없음",
       "withoutReason": "두 버전을 비교할 수 없습니다."
     },
-    "valuesHidden": "값 숨김",
-    "valuesShown": "값 표시"
+    "valuesHidden": "값 숨김"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
index 7376278aa54..384853f8b9b 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
@@ -308,7 +308,6 @@
     "maxChanges": "Maksymalna liczba zmian",
     "maxChangesDefault": "Domyślna",
     "noChanges": "Te wersje mają ten sam stan.",
-    "observedState": "Zaobserwowany stan",
     "observedStateBoundary": "Porównuje aktualnie zapisany stan, a nie dane z 
chwili utworzenia. Porównanie kodu źródłowego nie jest dostępne dla wersji 
historycznych; aby porównać kod źródłowy, użyj zakładki Kod.",
     "operations": {
       "added": "Dodano",
@@ -334,7 +333,6 @@
       "title": "Porównanie niedostępne",
       "withoutReason": "Nie udało się porównać tych wersji."
     },
-    "valuesHidden": "Wartości ukryte",
-    "valuesShown": "Wartości widoczne"
+    "valuesHidden": "Wartości ukryte"
   }
 }
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
index 7ac9a24163c..4e16cec4f65 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
@@ -337,7 +337,6 @@
     "maxChanges": "變更數上限",
     "maxChangesDefault": "預設",
     "noChanges": "這些版本的狀態相同。",
-    "observedState": "目前儲存狀態",
     "observedStateBoundary": 
"比較的是目前儲存的狀態,而非建立當時的證據。歷史版本無法比較原始碼;請使用「程式碼」分頁比較原始碼。",
     "operations": {
       "added": "新增",
@@ -359,7 +358,6 @@
       "title": "無法比較",
       "withoutReason": "無法比較這些版本。"
     },
-    "valuesHidden": "值已隱藏",
-    "valuesShown": "值已顯示"
+    "valuesHidden": "值已隱藏"
   }
 }
diff --git 
a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx 
b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
index d754220454a..52d29b4939a 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
@@ -17,8 +17,8 @@
  * under the License.
  */
 import "@testing-library/jest-dom/vitest";
-import { render, screen, within } from "@testing-library/react";
-import { describe, expect, it } from "vitest";
+import { act, fireEvent, render, screen, within } from 
"@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
 
 import {
   $DagVersionDiffCategory,
@@ -114,8 +114,6 @@ describe("VersionDiff", () => {
     expect(screen.getByText("/dag/tasks/*/retries")).toBeInTheDocument();
     
expect(screen.queryByText("versions.columns.before")).not.toBeInTheDocument();
     
expect(screen.queryByText("versions.columns.after")).not.toBeInTheDocument();
-    // Says what would grant them, since nothing here can.
-    expect(screen.getByText("versions.codeAccess")).toBeInTheDocument();
   });
 
   it("renders every returned record", () => {
@@ -235,11 +233,34 @@ describe("VersionDiff", () => {
     expect(cells[6]).toHaveTextContent("bob");
   });
 
-  it("labels the disclosure state the response reports", () => {
+  it("shows no disclosure chrome when the caller may see values", () => {
     renderDiff(authorized);
 
-    expect(screen.getByText("versions.valuesShown")).toBeInTheDocument();
     
expect(screen.queryByText("versions.valuesHidden")).not.toBeInTheDocument();
+    expect(screen.queryByText("versions.codeAccess")).not.toBeInTheDocument();
+  });
+
+  it("flags hidden values, saying on hover what would grant them", async () => 
{
+    vi.useFakeTimers();
+
+    try {
+      renderDiff(redacted);
+
+      const pill = screen.getByText("versions.valuesHidden");
+
+      // Only on hover: not repeated as inline text next to the pill.
+      
expect(screen.queryByText("versions.codeAccess")).not.toBeInTheDocument();
+
+      await act(async () => {
+        fireEvent.focus(pill);
+        fireEvent.pointerEnter(pill);
+        await vi.advanceTimersByTimeAsync(500);
+      });
+
+      
expect(screen.getByRole("tooltip")).toHaveTextContent("versions.codeAccess");
+    } finally {
+      vi.useRealTimers();
+    }
   });
 
   it("says so when two versions hold the same state", () => {
diff --git a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx 
b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
index c09d019ceec..5a9d11071a4 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
@@ -162,15 +162,13 @@ export const VersionDiff = ({ baseVersionNumber, diff, 
targetVersionNumber }: Ve
           </Text>
         </Box>
         <Flex alignItems="center" gap={2}>
-          <Badge 
colorPalette="teal">{translate("versions.observedState")}</Badge>
-          <Badge colorPalette={valuesShown ? "green" : "gray"}>
-            {translate(valuesShown ? "versions.valuesShown" : 
"versions.valuesHidden")}
-          </Badge>
-          {/* Says what grants values, since the viewer cannot grant it here: 
the server decides
-              from the caller's access to Dag code. */}
-          <Text color="fg.muted" fontSize="sm">
-            {translate("versions.codeAccess")}
-          </Text>
+          {/* The hover says what grants values, since the viewer cannot grant 
it here: the server
+              decides from the caller's access to Dag code. */}
+          {valuesShown ? undefined : (
+            <Tooltip content={translate("versions.codeAccess")} portalled>
+              <Badge 
colorPalette="gray">{translate("versions.valuesHidden")}</Badge>
+            </Tooltip>
+          )}
           {/* Above the table rather than below it: a long diff would 
otherwise push the caveat
               off-screen exactly when it matters most. */}
           <Tooltip content={translate("versions.observedStateBoundary")} 
portalled>

Reply via email to