Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: use intent-specific wording for access grant entry points (#21272)

zchpeter2d1accb1aeae
diff --git a/frontend/src/lib/i18n/messages.test.ts b/frontend/src/lib/i18n/messages.test.ts
index 32442b61cd..78d6710cf8 100644
--- a/frontend/src/lib/i18n/messages.test.ts
+++ b/frontend/src/lib/i18n/messages.test.ts
@@ -183,6 +183,67 @@ describe("Locale keys are sorted alphabetically", () => {
}
});
+const dig = (messages: LocaleMessageObject, path: string): string => {
+ let cur: string | LocaleMessageObject = messages;
+ for (const part of path.split(".")) {
+ expect(typeof cur, path).toBe("object");
+ cur = (cur as LocaleMessageObject)[part];
+ }
+ expect(typeof cur, path).toBe("string");
+ return cur as string;
+};
+
+// The workspace data-export setting's description quotes the "Request
+// export" button label verbatim so admins can connect the policy to the
+// affordance users see. Nothing else ties the two strings together, and
+// the label has a history of renames (#21081, #21200) — assert the quote
+// tracks the label in every locale. Scoped to these two keys on purpose:
+// a repo-wide grep would false-positive on prose that coincidentally
+// contains the label (e.g. ja role.project-viewer.description).
+describe("data-export description quotes the Request export label", () => {
+ for (const [locale, messages] of Object.entries(mergedLocalMessage)) {
+ test(locale, () => {
+ const label = dig(
+ messages as LocaleMessageObject,
+ "sql-editor.request-export"
+ );
+ const description = dig(
+ messages as LocaleMessageObject,
+ "settings.general.workspace.data-export.description"
+ );
+ expect(description).toContain(label);
+ });
+ }
+});
+
+// The Masking Exemptions FEATURE (admin-granted, resource-scoped policy on
+// the project's Masking Exemptions page) and the access-grant "unmask"
+// capability (user-requested, statement-bound) are different mechanisms.
+// zh once shipped the feature's name (脱敏豁免) on the capability's CTA,
+// sending users into the wrong mental model in the largest zh market —
+// lock the separation in every locale: the capability strings must never
+// reuse the feature's name.
+describe("unmask capability wording stays distinct from the Masking Exemptions feature", () => {
+ for (const [locale, messages] of Object.entries(mergedLocalMessage)) {
+ test(locale, () => {
+ const featureName = dig(
+ messages as LocaleMessageObject,
+ "project.masking-exemption.self"
+ );
+ for (const key of [
+ "sql-editor.request-unmask",
+ "sql-editor.grant-type-unmask",
+ ]) {
+ const value = dig(messages as LocaleMessageObject, key);
+ expect(
+ value.toLowerCase().includes(featureName.toLowerCase()),
+ `${locale} ${key} ("${value}") must not reuse the Masking Exemptions feature name ("${featureName}")`
+ ).toBe(false);
+ }
+ });
+ }
+});
+
const compareMessages = (
localA: LocaleMessageObject,
localB: LocaleMessageObject
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 7fac28f4a2..a3efb57e8c 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1941,7 +1941,7 @@
"confirm-delete-project": "Deleting \"{{name}}\" will permanently remove the project and all associated data including issues, configurations, and history. All databases in this project will be moved to the default project. This action cannot be undone.",
"issue-related": {
"allow-access-grants": {
- "description": "Allow project members to request time-boxed access grants for specific read-only statements.",
+ "description": "Allow project members to request time-boxed access grants for specific read-only statements. Grants can also cover exporting results and viewing unmasked data.",
"self": "Allow access grants"
},
"allow-request-role": {
@@ -2414,7 +2414,10 @@
"exiting": "Exiting..."
},
"data-copy": "Enable data copying",
- "data-export": "Enable data export",
+ "data-export": {
+ "description": "When disabled, users cannot export query results directly. In projects that allow access grants, users can still click \"Request export\" to submit an access grant request and export after approval.",
+ "self": "Allow data export without approval"
+ },
"default-landing-page": {
"default-view-changed-to-sql-editor": "The workspace's default view has been changed to SQL Editor.",
"go-to-sql-editor": "Go to SQL Editor",
@@ -3146,6 +3149,8 @@
"request-aborted": "User aborted the request",
"request-access-grant": "Request access grant",
"request-export": "Request export",
+ "request-query": "Request query",
+ "request-unmask": "Request unmask",
"result-detail": {
"cell": "Cell detail",
"next-match": "Next match",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 453d3ed4e8..6a16e77fb6 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1941,7 +1941,7 @@
"confirm-delete-project": "Eliminar \"{{name}}\" eliminará permanentemente el proyecto y todos los datos asociados, incluidos issues, configuraciones e historial. Todas las bases de datos de este proyecto se moverán al proyecto predeterminado. Esta acción no se puede deshacer.",
"issue-related": {
"allow-access-grants": {
- "description": "Permite a los miembros del proyecto solicitar concesiones de acceso con límite de tiempo para sentencias específicas de solo lectura.",
+ "description": "Permite a los miembros del proyecto solicitar concesiones de acceso con límite de tiempo para sentencias específicas de solo lectura. Las concesiones también pueden incluir la exportación de resultados y la visualización de datos sin enmascarar.",
"self": "Permitir concesiones de acceso"
},
"allow-request-role": {
@@ -2414,7 +2414,10 @@
"exiting": "Saliendo..."
},
"data-copy": "Habilitar la copia de datos",
- "data-export": "Habilitar la exportación de datos",
+ "data-export": {
+ "description": "Si está deshabilitado, los usuarios no pueden exportar directamente los resultados de las consultas. En los proyectos que permiten concesiones de acceso, aún pueden pulsar \"Solicitar exportación\" para enviar una solicitud de concesión de acceso y exportar tras la aprobación.",
+ "self": "Permitir la exportación de datos sin aprobación"
+ },
"default-landing-page": {
"default-view-changed-to-sql-editor": "La vista predeterminada del espacio de trabajo se ha cambiado al Editor SQL.",
"go-to-sql-editor": "Ir al Editor SQL",
@@ -3146,6 +3149,8 @@
"request-aborted": "El usuario abortó la solicitud",
"request-access-grant": "Solicitar concesión de acceso",
"request-export": "Solicitar exportación",
+ "request-query": "Solicitar consulta",
+ "request-unmask": "Solicitar desenmascaramiento",
"result-detail": {
"cell": "Detalle de celda",
"next-match": "Siguiente coincidencia",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 855c4904b3..76e1068db6 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1941,7 +1941,7 @@
"confirm-delete-project": "\"{{name}}\" を削除すると、Issue、設定、履歴を含むプロジェクトとそれに関連するすべてのデータが完全に削除されます。このプロジェクト内のすべてのデータベースはデフォルトプロジェクトに移動されます。この操作は元に戻せません。",
"issue-related": {
"allow-access-grants": {
- "description": "プロジェクトメンバーが特定の読み取り専用ステートメントに対して期限付きのアクセス付与をリクエストできるようにします。",
+ "description": "プロジェクトメンバーが特定の読み取り専用ステートメントに対して期限付きのアクセス付与をリクエストできるようにします。付与には結果のエクスポートやマスク解除データの閲覧を含めることもできます。",
"self": "アクセス付与を許可"
},
"allow-request-role": {
@@ -2414,7 +2414,10 @@
"exiting": "退出中..."
},
"data-copy": "データのコピーを有効にする",
- "data-export": "データのエクスポートを有効にする",
+ "data-export": {
+ "description": "無効にすると、ユーザーはクエリ結果を直接エクスポートできません。アクセス付与が有効なプロジェクトでは、「エクスポートをリクエスト」からアクセス付与をリクエストし、承認後にエクスポートできます。",
+ "self": "承認なしのデータエクスポートを許可"
+ },
"default-landing-page": {
"default-view-changed-to-sql-editor": "ワークスペースのデフォルト ビューが SQL エディターに変更されました。",
"go-to-sql-editor": "SQLエディタに移動",
@@ -3146,6 +3149,8 @@
"request-aborted": "ユーザーがリクエストを中止しました",
"request-access-grant": "アクセス付与をリクエスト",
"request-export": "エクスポートをリクエスト",
+ "request-query": "クエリをリクエスト",
+ "request-unmask": "マスク解除をリクエスト",
"result-detail": {
"cell": "セルの詳細",
"next-match": "次の一致",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index d7376ff3cf..01d770ab72 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1941,7 +1941,7 @@
"confirm-delete-project": "Việc xóa \"{{name}}\" sẽ xóa vĩnh viễn dự án và tất cả dữ liệu liên quan bao gồm issue, cấu hình và lịch sử. Tất cả cơ sở dữ liệu trong dự án này sẽ được chuyển sang dự án mặc định. Hành động này không thể hoàn tác.",
"issue-related": {
"allow-access-grants": {
- "description": "Cho phép thành viên dự án yêu cầu cấp quyền truy cập có thời hạn cho các câu lệnh chỉ đọc cụ thể.",
+ "description": "Cho phép thành viên dự án yêu cầu cấp quyền truy cập có thời hạn cho các câu lệnh chỉ đọc cụ thể. Quyền được cấp cũng có thể bao gồm xuất kết quả và xem dữ liệu chưa che.",
"self": "Cho phép cấp quyền truy cập"
},
"allow-request-role": {
@@ -2414,7 +2414,10 @@
"exiting": "Đang rời..."
},
"data-copy": "Bật sao chép dữ liệu",
- "data-export": "Bật xuất dữ liệu",
+ "data-export": {
+ "description": "Khi tắt, người dùng không thể xuất trực tiếp kết quả truy vấn. Trong các dự án cho phép cấp quyền truy cập, người dùng vẫn có thể nhấn \"Yêu cầu xuất dữ liệu\" để gửi yêu cầu cấp quyền truy cập và xuất sau khi được phê duyệt.",
+ "self": "Cho phép xuất dữ liệu mà không cần phê duyệt"
+ },
"default-landing-page": {
"default-view-changed-to-sql-editor": "Chế độ xem mặc định của không gian làm việc đã được thay đổi thành SQL Editor.",
"go-to-sql-editor": "Đi tới Trình soạn thảo SQL",
@@ -3146,6 +3149,8 @@
"request-aborted": "Người dùng đã hủy yêu cầu",
"request-access-grant": "Yêu cầu cấp quyền truy cập",
"request-export": "Yêu cầu xuất dữ liệu",
+ "request-query": "Yêu cầu truy vấn",
+ "request-unmask": "Yêu cầu bỏ che",
"result-detail": {
"cell": "Chi tiết ô",
"next-match": "Kết quả tiếp theo",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index b510d5b153..b333444acb 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1941,7 +1941,7 @@
"confirm-delete-project": "删除「{{name}}」将永久移除该项目及所有关联数据,包括工单、配置和历史记录。该项目中的所有数据库将被移至默认项目。此操作无法撤销。",
"issue-related": {
"allow-access-grants": {
- "description": "允许项目成员为特定只读语句申请限时访问授权。",
+ "description": "允许项目成员为特定只读语句申请限时访问授权。授权还可包含导出查询结果和查看未脱敏数据。",
"self": "允许访问授权"
},
"allow-request-role": {
@@ -2414,7 +2414,10 @@
"exiting": "退出中..."
},
"data-copy": "启用复制数据",
- "data-export": "启用数据导出",
+ "data-export": {
+ "description": "关闭后,用户无法直接导出查询结果。在启用访问授权的项目中,用户仍可点击“申请导出”提交访问授权申请,审批通过后即可导出。",
+ "self": "允许无需审批导出数据"
+ },
"default-landing-page": {
"default-view-changed-to-sql-editor": "工作区的默认视图已更改为 SQL 编辑器。",
"go-to-sql-editor": "转到 SQL 编辑器",
@@ -3104,7 +3107,7 @@
"format-sql": "格式化 SQL",
"generate-sql": "生成 SQL",
"grant-type-export": "导出",
- "grant-type-unmask": "脱敏豁免",
+ "grant-type-unmask": "取消脱敏",
"hex-format": "十六进制格式",
"hint-tips": {
"confirm-to-close-unsaved-sheet": {
@@ -3146,6 +3149,8 @@
"request-aborted": "用户中止了请求",
"request-access-grant": "申请访问授权",
"request-export": "申请导出",
+ "request-query": "申请查询",
+ "request-unmask": "申请取消脱敏",
"result-detail": {
"cell": "单元格详情",
"next-match": "下一个匹配项",
diff --git a/frontend/src/modules/sql-editor/components/MaskingReasonPopover.test.tsx b/frontend/src/modules/sql-editor/components/MaskingReasonPopover.test.tsx
index 02d953528e..5d0f847b19 100644
--- a/frontend/src/modules/sql-editor/components/MaskingReasonPopover.test.tsx
+++ b/frontend/src/modules/sql-editor/components/MaskingReasonPopover.test.tsx
@@ -243,7 +243,7 @@ describe("MaskingReasonPopover", () => {
unmount();
});
- test("does not show the request-access-grant button when JIT not available", () => {
+ test("does not show the request-unmask button when JIT not available", () => {
setupDefaultMocks(false);
const { container, render, unmount } = renderIntoContainer(
<MaskingReasonPopover reason={makeReason()} statement="SELECT * FROM t" />
@@ -252,13 +252,13 @@ describe("MaskingReasonPopover", () => {
const buttons = container.querySelectorAll("[data-testid='jit-button']");
const jitBtn = Array.from(buttons).find((b) =>
- b.textContent?.includes("sql-editor.request-access-grant")
+ b.textContent?.includes("sql-editor.request-unmask")
);
expect(jitBtn).toBeUndefined();
unmount();
});
- test("shows the request-access-grant button and opens drawer when JIT available and statement provided", async () => {
+ test("shows the request-unmask button and opens drawer when JIT available and statement provided", async () => {
setupDefaultMocks(true);
const { container, render, unmount } = renderIntoContainer(
<MaskingReasonPopover
@@ -277,7 +277,7 @@ describe("MaskingReasonPopover", () => {
"[data-testid='jit-button']"
) as HTMLButtonElement;
expect(jitBtn).not.toBeNull();
- expect(jitBtn.textContent).toContain("sql-editor.request-access-grant");
+ expect(jitBtn.textContent).toContain("sql-editor.request-unmask");
await act(async () => {
jitBtn.click();
diff --git a/frontend/src/modules/sql-editor/components/MaskingReasonPopover.tsx b/frontend/src/modules/sql-editor/components/MaskingReasonPopover.tsx
index 67af7b8007..fdd0b7f657 100644
--- a/frontend/src/modules/sql-editor/components/MaskingReasonPopover.tsx
+++ b/frontend/src/modules/sql-editor/components/MaskingReasonPopover.tsx
@@ -155,7 +155,7 @@ export function MaskingReasonPopover({
className="self-start"
onClick={() => setShowDrawer(true)}
>
- {t("sql-editor.request-access-grant")}
+ {t("sql-editor.request-unmask")}
</Button>
)}
</div>
diff --git a/frontend/src/modules/sql-editor/components/RequestQueryButton.test.tsx b/frontend/src/modules/sql-editor/components/RequestQueryButton.test.tsx
index 202c2f10ac..36ad37faaf 100644
--- a/frontend/src/modules/sql-editor/components/RequestQueryButton.test.tsx
+++ b/frontend/src/modules/sql-editor/components/RequestQueryButton.test.tsx
@@ -264,7 +264,7 @@ describe("RequestQueryButton", () => {
unmount();
});
- test("renders the Request access grant label in JIT mode", () => {
+ test("renders the Request query label in JIT mode", () => {
setupDefaultMocks(true, true);
const { container, render, unmount } = renderIntoContainer(
<RequestQueryButton
@@ -275,7 +275,22 @@ describe("RequestQueryButton", () => {
/>
);
render();
- expect(container.textContent).toContain("sql-editor.request-access-grant");
+ expect(container.textContent).toContain("sql-editor.request-query");
+ unmount();
+ });
+
+ test("bb.sql.info-only denial also takes the JIT path", () => {
+ setupDefaultMocks(true, true);
+ const { container, render, unmount } = renderIntoContainer(
+ <RequestQueryButton
+ text={false}
+ permissionDeniedDetail={makePermissionDeniedDetail({
+ requiredPermissions: ["bb.sql.info"],
+ })}
+ />
+ );
+ render();
+ expect(container.textContent).toContain("sql-editor.request-query");
unmount();
});
diff --git a/frontend/src/modules/sql-editor/components/RequestQueryButton.tsx b/frontend/src/modules/sql-editor/components/RequestQueryButton.tsx
index 5e77535bde..84f90dc68e 100644
--- a/frontend/src/modules/sql-editor/components/RequestQueryButton.tsx
+++ b/frontend/src/modules/sql-editor/components/RequestQueryButton.tsx
@@ -181,7 +181,7 @@ export function RequestQueryButton({
<FeatureBadge clickable={false} feature={requiredFeature} />
)}
{useJIT
- ? t("sql-editor.request-access-grant")
+ ? t("sql-editor.request-query")
: t("issue.title.request-role")}
</Button>
)}
diff --git a/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx b/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx
index c0764ed2e2..ffe39db107 100644
--- a/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx
+++ b/frontend/src/routes/workspace/general/SQLEditorSection.test.tsx
@@ -342,3 +342,64 @@ describe("SQLEditorSection theme", () => {
expect(anyDisabled).toBeTruthy();
});
});
+
+// The data-export policy control was reworked from a bare "Enable data
+// export" checkbox (no description) to "Allow data export without approval"
+// + a description naming the access-grant path — customers read the old
+// title as a hard kill switch and never found approval-gated export.
+// These tests lock the retitled key pair and the `checked={!disableExport}`
+// inversion the new title depends on.
+describe("SQLEditorSection data-export policy toggle", () => {
+ function renderSection() {
+ const ref = createRef<SectionHandle>();
+ render(
+ <SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />
+ );
+ return ref;
+ }
+
+ function exportCheckbox(): HTMLElement {
+ // The checkbox renders inside the FormField title span, as a sibling of
+ // the label text (SQLEditorSection.tsx) — scope by that span.
+ const span = Array.from(container.querySelectorAll("span")).find((s) =>
+ s.textContent?.includes("settings.general.workspace.data-export.self")
+ );
+ expect(span).toBeTruthy();
+ const box = span?.querySelector<HTMLElement>('[role="checkbox"]');
+ expect(box).toBeTruthy();
+ return box as HTMLElement;
+ }
+
+ test("renders the retitled label with its description", () => {
+ renderSection();
+ expect(container.textContent).toContain(
+ "settings.general.workspace.data-export.self"
+ );
+ expect(container.textContent).toContain(
+ "settings.general.workspace.data-export.description"
+ );
+ });
+
+ test("export allowed without approval (disableExport=false) renders checked", () => {
+ mocks.policy.disableExport = false;
+ renderSection();
+ expect(exportCheckbox().getAttribute("aria-checked")).toBe("true");
+ });
+
+ test("approval-gated export (disableExport=true) renders unchecked", () => {
+ mocks.policy.disableExport = true;
+ renderSection();
+ expect(exportCheckbox().getAttribute("aria-checked")).toBe("false");
+ });
+
+ test("toggling the checkbox marks the section dirty for the Update bar", () => {
+ mocks.policy.disableExport = false;
+ const ref = renderSection();
+ expect(ref.current?.isDirty()).toBe(false);
+ act(() => {
+ exportCheckbox().click();
+ });
+ expect(ref.current?.isDirty()).toBe(true);
+ expect(exportCheckbox().getAttribute("aria-checked")).toBe("false");
+ });
+});
diff --git a/frontend/src/routes/workspace/general/SQLEditorSection.tsx b/frontend/src/routes/workspace/general/SQLEditorSection.tsx
index f313c6add1..20c31ef4b6 100644
--- a/frontend/src/routes/workspace/general/SQLEditorSection.tsx
+++ b/frontend/src/routes/workspace/general/SQLEditorSection.tsx
@@ -428,10 +428,13 @@ export const SQLEditorSection = forwardRef<
handleToggle("disableExport", !checked)
}
/>
- {t("settings.general.workspace.data-export")}
+ {t("settings.general.workspace.data-export.self")}
<FeatureBadge feature={PlanFeature.FEATURE_QUERY_POLICY} />
</span>
}
+ description={t(
+ "settings.general.workspace.data-export.description"
+ )}
/>
</PermissionGuard>
diff --git a/frontend/tests/e2e/sql-editor/sql-editor-access-grants.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-access-grants.spec.ts
index 143cc980bb..29d9e755da 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor-access-grants.spec.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor-access-grants.spec.ts
@@ -1,26 +1,26 @@
// SQL Editor — access-grant flow (Batch 8, L-series + H1 CUJs).
//
// Covers:
-// - L1 / L2 RequestQueryButton label switches to "Request access grant"
+// - L1 / L2 RequestQueryButton label switches to "Request query"
// when project.allowJustInTimeAccess is on AND the missing
-// permission is exactly bb.sql.select (the access-grant path).
+// permissions consist only of bb.sql.select / bb.sql.info (the
+// access-grant path).
// - L4 ACCESS pane shows the "Request access grant" CTA when JIT is enabled.
// - L5 AccessGrantRequestDrawer renders Databases / Statement / Unmask /
// Export / Expiration / Reason fields when opened from the pane
// (Unmask + Export capability sections added by PRs #20491/#20487).
// - L6 ACCESS gutter tab appears only while JIT is on.
+// - L7 masked-cell popover explains WHY a cell is masked and, only
+// while JIT is on, offers "Request unmask" → grant drawer with the
+// Unmask capability pre-checked (Export not).
// - H1 Gutter tab count flips between 3 (no JIT) and 4 (with JIT).
//
// Deferred (out of this batch):
// - L3 full JIT Unmask flow — request → admin approve → re-run.
// Requires a multi-actor handoff (requestor user creates grant,
-// admin user approves, requestor re-runs and sees unmasked data),
-// plus seeded masked columns. Worth its own spec; punted to a
-// later session.
-// - L7 MaskingReasonPopover — requires the demo to ship a column
-// with a non-empty maskingReason; the discovered Postgres project
-// in this branch's demo does not have one out of the box. Will
-// pair with L3 when masking-test data is set up.
+// admin user approves, requestor re-runs and sees unmasked data).
+// The masked-column fixture it needs now lives in this file's L7
+// block — reuse it when picking L3 up.
import {
test,
@@ -169,9 +169,9 @@ test.describe("ACCESS gutter tab follows the project's allowJustInTimeAccess fla
});
// L1 / L2 — RequestQueryButton's `useJIT` is true when
-// project.allowJustInTimeAccess is on AND the missing permissions are
-// exactly bb.sql.select. The visible label switches from
-// "Request role" to "Request access grant" accordingly.
+// project.allowJustInTimeAccess is on AND the missing permissions
+// consist only of bb.sql.select / bb.sql.info. The visible label
+// switches from "Request role" to "Request query" accordingly.
test.describe("RequestQueryButton label tracks the project's JIT flag", () => {
test("with access grants off, running a forbidden SELECT shows the 'Request role' CTA", async () => {
await setJIT(false);
@@ -181,15 +181,15 @@ test.describe("RequestQueryButton label tracks the project's JIT flag", () => {
await expect(viewerEditor.requestRoleButton.first()).toBeVisible({
timeout: 10_000,
});
- await expect(viewerEditor.requestAccessGrantButton).toHaveCount(0);
+ await expect(viewerEditor.requestQueryButton).toHaveCount(0);
});
- test("with access grants on, running a forbidden SELECT shows the 'Request access grant' CTA", async () => {
+ test("with access grants on, running a forbidden SELECT shows the 'Request query' CTA", async () => {
await setJIT(true);
await viewerEditor.runPreparedQuery("SELECT 1;");
await viewerPage.waitForTimeout(800);
- await expect(viewerEditor.requestAccessGrantButton.first()).toBeVisible({
+ await expect(viewerEditor.requestQueryButton.first()).toBeVisible({
timeout: 10_000,
});
await expect(viewerEditor.requestRoleButton).toHaveCount(0);
@@ -288,6 +288,184 @@ test.describe("ACCESS pane Request-access-grant button opens the grant drawer",
});
});
+// L7 — a masked result column's header renders an EyeOff trigger; opening it
+// shows a popover explaining WHY the column is masked (semantic type, method),
+// and — only while the project allows access grants — a "Request unmask"
+// button that opens the grant drawer with the Unmask capability pre-checked
+// and Export unchecked (MaskingReasonPopover.tsx passes unmask={true} only).
+//
+// Runs as the ADMIN: the viewer user above lacks bb.sql.select, and L7 needs
+// the query to SUCCEED so masked cells render. Masking applies to admins too
+// (sql-editor-export.spec.ts asserts the mask marker on-screen as admin).
+// The masked column is seeded the same way as that spec's "Masking ↔ export
+// security" block: register a scoped full-mask semantic type, create a
+// throwaway schema via psql, and bind the column through the catalog —
+// all restored in afterAll. workers=1, so overwriting the shared
+// SEMANTIC_TYPES workspace setting cannot race the export spec.
+test.describe("L7 — masked-cell popover offers Request unmask", () => {
+ const SEMANTIC_TYPE_ID = "bb.unmask-l7-qa";
+ const SCHEMA = "qa_unmask_l7";
+ const TABLE = "secret";
+ const COLUMN = "email_addr";
+ // Unique full-mask substitution (not the default "******") so the cell
+ // provably carries OUR semantic type — see the export spec for why.
+ const MASK_MARKER = "QAL7MASKED";
+ const STATEMENT = `SELECT id, ${COLUMN} FROM ${SCHEMA}.${TABLE} ORDER BY id;`;
+
+ let adminEditor: SqlEditorPage;
+ let l7PgPort = "";
+ let originalSemanticTypes: unknown = null;
+
+ test.beforeAll(async () => {
+ adminEditor = new SqlEditorPage(adminPage, env.baseURL);
+ l7PgPort = await getInstancePgPort(env);
+
+ originalSemanticTypes =
+ (await env.api.getSetting("SEMANTIC_TYPES"))?.value ?? null;
+ await env.api.upsertSetting(
+ "SEMANTIC_TYPES",
+ {
+ semanticType: {
+ types: [
+ {
+ id: SEMANTIC_TYPE_ID,
+ title: "QA L7 Unmask",
+ description: "L7 masked-cell popover e2e",
+ algorithm: { fullMask: { substitution: MASK_MARKER } },
+ },
+ ],
+ },
+ },
+ "value.semantic_type",
+ );
+
+ execSql(env.databaseId, l7PgPort, `DROP SCHEMA IF EXISTS ${SCHEMA} CASCADE`);
+ execSql(env.databaseId, l7PgPort, `CREATE SCHEMA ${SCHEMA}`);
+ execSql(
+ env.databaseId,
+ l7PgPort,
+ `CREATE TABLE ${SCHEMA}.${TABLE} (id INT PRIMARY KEY, ${COLUMN} TEXT)`,
+ );
+ execSql(
+ env.databaseId,
+ l7PgPort,
+ `INSERT INTO ${SCHEMA}.${TABLE} VALUES (1, 'l7-plaintext-value')`,
+ );
+ await env.api.syncDatabase(env.database);
+ await env.api.updateCatalog(env.database, {
+ name: `${env.database}/catalog`,
+ schemas: [
+ {
+ name: SCHEMA,
+ tables: [
+ {
+ name: TABLE,
+ columns: {
+ columns: [{ name: COLUMN, semanticType: SEMANTIC_TYPE_ID }],
+ },
+ },
+ ],
+ },
+ ],
+ });
+ });
+
+ test.afterAll(async () => {
+ try {
+ execSql(
+ env.databaseId,
+ l7PgPort,
+ `DROP SCHEMA IF EXISTS ${SCHEMA} CASCADE`,
+ );
+ await env.api.syncDatabase(env.database);
+ } catch {
+ /* best-effort */
+ }
+ try {
+ await env.api.upsertSetting(
+ "SEMANTIC_TYPES",
+ originalSemanticTypes ?? { semanticType: { types: [] } },
+ "value.semantic_type",
+ );
+ } catch {
+ /* best-effort */
+ }
+ });
+
+ // Set the project's JIT flag, load the editor fresh (the per-tab project
+ // cache does not pick up API-side flag flips), run the statement, and
+ // open the masking-reason popover. The EyeOff trigger renders in the
+ // masked COLUMN's header (VirtualDataTable.tsx renders MaskingReasonPopover
+ // next to the column name; masking is column-scoped), and its own click
+ // handler stops propagation, so clicking it cannot toggle the adjacent
+ // sort control. Click (not hover) to open: click-open is sticky, so moving
+ // the pointer to the popover's button can't hover-close it on the way.
+ async function openMaskedCellPopover(jit: boolean): Promise<void> {
+ await env.api.updateProjectSettings(env.project, {
+ allowJustInTimeAccess: jit,
+ });
+ await adminEditor.gotoWithDb(projectId, env.instanceId, env.databaseId);
+ await adminPage.waitForTimeout(1500);
+ await adminEditor.runPreparedQuery(STATEMENT);
+
+ // The full mask replaces the value with OUR marker — masking is live.
+ await expect(
+ adminPage.getByText(MASK_MARKER).first(),
+ "the seeded semantic type must mask the cell",
+ ).toBeVisible({ timeout: 10_000 });
+ await expect(adminPage.getByText("l7-plaintext-value")).toHaveCount(0);
+
+ // Only the masked column's header renders the EyeOff popover trigger —
+ // the statement selects exactly one masked column, so .first() is it.
+ const trigger = adminPage.locator("svg.lucide-eye-off").first();
+ await expect(trigger).toBeVisible();
+ await trigger.click();
+ await expect(
+ adminPage.getByText("Why is this data masked?"),
+ "the masking-reason popover must open from the masked cell",
+ ).toBeVisible({ timeout: 5000 });
+ }
+
+ test("with JIT off, the popover explains the mask but offers no Request unmask", async () => {
+ await openMaskedCellPopover(false);
+
+ // The reason rows surface the seeded semantic type by title.
+ await expect(adminPage.getByText("QA L7 Unmask").first()).toBeVisible();
+ await expect(adminEditor.requestUnmaskButton).toHaveCount(0);
+
+ await adminPage.keyboard.press("Escape");
+ await adminPage.waitForTimeout(300);
+ });
+
+ test("with JIT on, Request unmask opens the grant drawer with Unmask pre-checked and Export not", async () => {
+ await openMaskedCellPopover(true);
+
+ await expect(adminEditor.requestUnmaskButton.first()).toBeVisible({
+ timeout: 5000,
+ });
+ await adminEditor.requestUnmaskButton.first().click();
+
+ const drawer = adminEditor.accessGrantDrawer;
+ await expect(drawer).toBeVisible({ timeout: 10_000 });
+ await expect(drawer.getByText(STATEMENT)).toBeVisible();
+
+ // The masked-cell entry point requests exactly the Unmask capability
+ // (MaskingReasonPopover passes unmask={true}; export stays opt-in —
+ // the mirror of RequestExportButton's export-only pre-fill, BYT-9654).
+ await expect(
+ drawer.getByRole("checkbox", { name: "See unmasked sensitive data" }),
+ "Unmask must be pre-checked from the masked-cell popover",
+ ).toBeChecked();
+ await expect(
+ drawer.getByRole("checkbox", { name: "Export the query result" }),
+ "Export must NOT be pre-checked from the masked-cell popover",
+ ).not.toBeChecked();
+
+ await adminPage.keyboard.press("Escape");
+ await adminPage.waitForTimeout(300);
+ });
+});
+
// BYT-9801 — the access-grant drawer's database picker used to fetch a single flat page of
// 100 databases with no server-side search, so any database past that page was
// invisible AND unsearchable in the drawer (even though the SQL Editor tree
diff --git a/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts
index 0763b2c322..74e040c6ee 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor-export.spec.ts
@@ -4,7 +4,7 @@
// library was deleted and export now goes through the backend Export RPC. A
// workspace `DATA_QUERY` policy (`disableExport`) gates the toolbar's Export
// button; when export is disabled but the project allows access grants,
-// a "Request access grant" affordance replaces it, and an active export grant
+// a "Request export" affordance replaces it, and an active export grant
// for the EXACT statement re-enables the real Export button.
//
// One file per sub-area (the repo convention): all export CUJs live here as
@@ -16,7 +16,7 @@
//
// Groups (CUJ ids from the QA session):
// - Direct export (export allowed): C1 backend Export RPC, C9 password
-// - Gated + JIT on: C2 Request access grant, C3/C4 drawer pre-fill (export only)
+// - Gated + JIT on: C2 Request export, C3/C4 drawer pre-fill (export only)
// - Gated + JIT off: C8 no affordance
// - Multi-statement: C10 one affordance above the tabs
// - Active export grant: C7 exact-match re-enable, C5 badge, C6 filter
@@ -258,15 +258,15 @@ test.describe("Direct export when the policy allows it (C1, C9)", () => {
});
});
-// --- Gated export, JIT on → Request access grant (C2, C3, C4) -------------
+// --- Gated export, JIT on → Request export (C2, C3, C4) -------------------
test.describe("Export gated by policy, JIT enabled (C2, C3, C4)", () => {
- test('the toolbar shows "Request access grant" instead of "Export"', async () => {
+ test('the toolbar shows "Request export" instead of "Export"', async () => {
await applyExportState({ disableExport: true, jit: true });
await sqlEditor.runPreparedQuery("SELECT emp_no, first_name FROM employee LIMIT 5;");
await expect(
- sqlEditor.requestAccessGrantButton.first(),
+ sqlEditor.requestExportButton.first(),
).toBeVisible({ timeout: 10_000 });
await expect(page.getByRole("button", { name: /^Export$/ })).toHaveCount(0);
await expect(
@@ -274,12 +274,12 @@ test.describe("Export gated by policy, JIT enabled (C2, C3, C4)", () => {
).toBeVisible();
});
- test('the export-blocked "Request access grant" CTA opens the grant drawer pre-filled with the statement, DB, and Export checked (unmask not)', async () => {
+ test('the export-blocked "Request export" CTA opens the grant drawer pre-filled with the statement, DB, and Export checked (unmask not)', async () => {
await applyExportState({ disableExport: true, jit: true });
const statement = "SELECT emp_no, last_name FROM employee LIMIT 4;";
await sqlEditor.runPreparedQuery(statement);
- await sqlEditor.requestAccessGrantButton.first().click();
+ await sqlEditor.requestExportButton.first().click();
const drawer = sqlEditor.accessGrantDrawer;
await expect(drawer).toBeVisible({ timeout: 10_000 });
@@ -313,7 +313,7 @@ test.describe("Export gated by policy, JIT enabled (C2, C3, C4)", () => {
const statement = `SELECT emp_no FROM employee WHERE emp_no = ${marker % 100000} LIMIT 1;`;
await sqlEditor.runPreparedQuery(statement);
- await sqlEditor.requestAccessGrantButton.first().click();
+ await sqlEditor.requestExportButton.first().click();
const drawer = sqlEditor.accessGrantDrawer;
await expect(drawer).toBeVisible({ timeout: 10_000 });
@@ -375,7 +375,7 @@ test.describe("Export gated by policy, JIT disabled (C8)", () => {
).toBeVisible({ timeout: 10_000 });
await expect(page.getByRole("button", { name: /^Export$/ })).toHaveCount(0);
await expect(
- sqlEditor.requestAccessGrantButton,
+ sqlEditor.requestExportButton,
).toHaveCount(0);
});
});
@@ -394,7 +394,7 @@ test.describe("Multi-statement result export affordance (C10)", () => {
page.getByRole("tab", { name: /Query\s*#2/ }).first(),
).toBeVisible();
await expect(
- sqlEditor.requestAccessGrantButton,
+ sqlEditor.requestExportButton,
).toHaveCount(1);
});
});
@@ -440,7 +440,7 @@ test.describe("Active export grant (C5, C6, C7)", () => {
const exportButton = page.getByRole("button", { name: /^Export$/ }).first();
await expect(exportButton).toBeVisible({ timeout: 10_000 });
await expect(
- sqlEditor.requestAccessGrantButton,
+ sqlEditor.requestExportButton,
).toHaveCount(0);
await exportButton.hover();
@@ -472,11 +472,11 @@ test.describe("Active export grant (C5, C6, C7)", () => {
).toBeTruthy();
});
- test("running a DIFFERENT statement keeps export gated (Request access grant, no Export) (C7)", async () => {
+ test("running a DIFFERENT statement keeps export gated (Request export, no Export) (C7)", async () => {
await sqlEditor.runPreparedQuery(UNGRANTED_STATEMENT);
await expect(
- sqlEditor.requestAccessGrantButton.first(),
+ sqlEditor.requestExportButton.first(),
).toBeVisible({ timeout: 10_000 });
await expect(page.getByRole("button", { name: /^Export$/ })).toHaveCount(0);
});
diff --git a/frontend/tests/e2e/sql-editor/sql-editor-permissions.spec.ts b/frontend/tests/e2e/sql-editor/sql-editor-permissions.spec.ts
index c68237a8e7..8e1fb5594e 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor-permissions.spec.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor-permissions.spec.ts
@@ -229,14 +229,14 @@ test.describe("INSERT is denied with an inline error for sqlEditorReadUser", ()
// The error pane renders the permission detail somewhere in the
// result region. We accept any of the common shapes: an explicit
// "permission" mention, the role name, or the request-role /
- // request-access-grant CTA.
+ // request-query CTA.
// The strong assertion is that the row-count footer DID NOT appear
// (Run reached an error state) AND a request affordance is offered.
const permissionMention = rc.page.getByText(
/(permission denied|no.*permission|bb\.sql\.(update|delete|create|admin|insert)|missing.*permission)/i,
);
const requestCTA = rc.sqlEditor.requestRoleButton.or(
- rc.sqlEditor.requestAccessGrantButton,
+ rc.sqlEditor.requestQueryButton,
);
const anySignal = permissionMention.or(requestCTA).first();
await expect(anySignal).toBeVisible({ timeout: 10_000 });
@@ -287,7 +287,7 @@ test.describe("Request-role CTA respects project.allowRequestRole", () => {
// Neither label should appear — the component returned null.
await expect(rc.sqlEditor.requestRoleButton).toHaveCount(0);
- await expect(rc.sqlEditor.requestAccessGrantButton).toHaveCount(0);
+ await expect(rc.sqlEditor.requestQueryButton).toHaveCount(0);
});
test("with allowRequestRole=true, projectViewer running a forbidden SELECT sees the 'Request role' button", async () => {
@@ -309,6 +309,6 @@ test.describe("Request-role CTA respects project.allowRequestRole", () => {
// Access-grant variant must NOT show — this project has
// allowJustInTimeAccess=false (its default), so `useJIT` resolves
// to false and the label switch picks the non-JIT side.
- await expect(rc.sqlEditor.requestAccessGrantButton).toHaveCount(0);
+ await expect(rc.sqlEditor.requestQueryButton).toHaveCount(0);
});
});
diff --git a/frontend/tests/e2e/sql-editor/sql-editor.page.ts b/frontend/tests/e2e/sql-editor/sql-editor.page.ts
index caa693966e..8bd7c16193 100644
--- a/frontend/tests/e2e/sql-editor/sql-editor.page.ts
+++ b/frontend/tests/e2e/sql-editor/sql-editor.page.ts
@@ -15,6 +15,9 @@ export class SqlEditorPage {
readonly gutterHistoryTab: Locator;
readonly gutterAccessTab: Locator;
readonly requestAccessGrantButton: Locator;
+ readonly requestQueryButton: Locator;
+ readonly requestExportButton: Locator;
+ readonly requestUnmaskButton: Locator;
readonly requestRoleButton: Locator;
readonly accessGrantDrawer: Locator;
readonly accessGrantDrawerTitle: Locator;
@@ -62,18 +65,33 @@ export class SqlEditorPage {
name: "Access Grants",
exact: true,
});
- // "Request access grant" is ONE shared label (i18n key
- // `sql-editor.request-access-grant`) used by every entry point that opens
- // the grant drawer — ACCESS pane CTA, permission-denied result button,
- // masked-cell popover, export-blocked toolbar button — AND by the drawer's
- // own SheetTitle. Button and drawer title are therefore textually
- // identical: match buttons by role=button, and match the drawer by its
- // accessible name (SheetTitle wraps BaseDialog.Title, which labels the
- // dialog), so the two never collide.
+ // Entry points into the access-grant drawer carry intent-specific labels
+ // ("Request query" / "Request export" / "Request unmask"); the generic
+ // "Request access grant" label (i18n key `sql-editor.request-access-grant`)
+ // remains only on the ACCESS pane CTA — where there is no prior intent —
+ // and on the drawer's own SheetTitle. Match buttons by role=button, and
+ // match the drawer by its accessible name (SheetTitle wraps
+ // BaseDialog.Title, which labels the dialog), so the two never collide.
this.requestAccessGrantButton = page.getByRole("button", {
name: "Request access grant",
exact: true,
});
+ // Permission-denied result CTA in JIT mode (i18n key
+ // `sql-editor.request-query`).
+ this.requestQueryButton = page.getByRole("button", {
+ name: "Request query",
+ exact: true,
+ });
+ // Export-blocked toolbar CTA (i18n key `sql-editor.request-export`).
+ this.requestExportButton = page.getByRole("button", {
+ name: "Request export",
+ exact: true,
+ });
+ // Masked-cell popover CTA (i18n key `sql-editor.request-unmask`).
+ this.requestUnmaskButton = page.getByRole("button", {
+ name: "Request unmask",
+ exact: true,
+ });
// Non-JIT permission-denied CTA (opens RequestRoleSheet); label comes from
// i18n key `issue.title.request-role`, shared with the Members page.
this.requestRoleButton = page.getByRole("button", {
diff --git a/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts b/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts
new file mode 100644
index 0000000000..9698dd66be
--- /dev/null
+++ b/frontend/tests/e2e/workspace/workspace-general-settings.spec.ts
@@ -0,0 +1,150 @@
+// Workspace Settings → General → SQL Editor section: the data-export policy
+// control. #21081 unified all wording to "access grant" terminology; customers
+// then reported they couldn't tell that DISABLING export is how you enable
+// approval-gated (access-grant) export — the control was a bare "Enable data
+// export" checkbox with no description. The rework retitles it "Allow data
+// export without approval" and adds a description naming the "Request export"
+// CTA users see in the SQL editor.
+//
+// Covers:
+// - W1 wording + policy→UI: the retitled label and its description render
+// in the SQL Editor settings section, and the checkbox reflects the LIVE
+// workspace DATA_QUERY policy in both states (checked = export allowed
+// without approval = disableExport:false).
+// - W2 UI→policy wiring: unchecking + Update persists disableExport:true
+// (verified via the API, not just the UI), and re-checking + Update
+// restores it — both directions of the `checked={!disableExport}`
+// inversion in SQLEditorSection.tsx.
+//
+// State safety: the DATA_QUERY policy is snapshotted in beforeAll and
+// restored via API in afterAll. The sql-editor specs that flip the same
+// policy run earlier (directory order) and restore their own state; this
+// file runs before workspace-seat-limit's license drop.
+
+import {
+ test,
+ expect,
+ type BrowserContext,
+ type Page,
+} from "@playwright/test";
+import { loadTestEnv, type TestEnv } from "../framework/env";
+import { BytebaseApiClient } from "../framework/api-client";
+
+test.setTimeout(120_000);
+
+let env: TestEnv & { api: BytebaseApiClient };
+let workspace = "";
+let sharedContext: BrowserContext;
+let page: Page;
+let originalQueryDataPolicy: Record<string, unknown> = {};
+
+const EXPORT_LABEL = "Allow data export without approval";
+
+async function readDisableExport(): Promise<boolean> {
+ const policy = (await env.api.getPolicy(
+ `${workspace}/policies/data_query`
+ )) as { queryDataPolicy?: Record<string, unknown> } | null;
+ return Boolean(policy?.queryDataPolicy?.disableExport);
+}
+
+async function setQueryDataPolicy(
+ payload: Record<string, unknown>
+): Promise<void> {
+ await env.api.upsertPolicy(workspace, "data_query", {
+ name: `${workspace}/policies/data_query`,
+ type: "DATA_QUERY",
+ queryDataPolicy: payload,
+ });
+}
+
+// The checkbox lives inside the FormField title span next to the label text
+// (SQLEditorSection.tsx renders `<Checkbox/>{label}<FeatureBadge/>` in one
+// inline-flex span), so scope by that span rather than by accessible name —
+// the label text is a sibling, not an aria label.
+function exportCheckbox() {
+ return page
+ .locator("span", { hasText: EXPORT_LABEL })
+ .first()
+ .getByRole("checkbox");
+}
+
+async function gotoGeneralSettings(): Promise<void> {
+ await page.goto(`${env.baseURL}/setting/general`);
+ await page.waitForLoadState("networkidle").catch(() => {});
+ await expect(page.getByText(EXPORT_LABEL, { exact: true })).toBeVisible({
+ timeout: 10_000,
+ });
+}
+
+test.beforeAll(async ({ browser }) => {
+ env = loadTestEnv();
+ await env.api.login(env.adminEmail, env.adminPassword);
+ ({ workspace } = await env.api.getActuatorInfo());
+
+ // Snapshot the whole queryDataPolicy so afterAll restores every field we
+ // may clobber via the UI's Update (it writes the full payload).
+ const existing = (await env.api.getPolicy(
+ `${workspace}/policies/data_query`
+ )) as { queryDataPolicy?: Record<string, unknown> } | null;
+ originalQueryDataPolicy = existing?.queryDataPolicy ?? {};
+
+ sharedContext = await browser.newContext({ storageState: ".auth/state.json" });
+ page = await sharedContext.newPage();
+});
+
+test.afterAll(async () => {
+ try {
+ await setQueryDataPolicy(originalQueryDataPolicy);
+ } catch {
+ /* best-effort restore */
+ }
+ await sharedContext?.close();
+});
+
+test.describe("data-export policy control wording and wiring", () => {
+ test("the retitled checkbox and its description render, reflecting the live policy in both states (W1)", async () => {
+ // Known state first (own your fixtures): export allowed without approval.
+ await setQueryDataPolicy({ ...originalQueryDataPolicy, disableExport: false });
+ await gotoGeneralSettings();
+
+ // The description teaches the access-grant path and quotes the exact
+ // "Request export" button label (coupling locked by messages.test.ts).
+ await expect(
+ page.getByText(
+ /In projects that allow access grants, users can still click "Request export"/
+ )
+ ).toBeVisible();
+ await expect(exportCheckbox()).toBeChecked();
+
+ // Flip the policy via API → a fresh load shows the checkbox unchecked.
+ await setQueryDataPolicy({ ...originalQueryDataPolicy, disableExport: true });
+ await gotoGeneralSettings();
+ await expect(exportCheckbox()).not.toBeChecked();
+ });
+
+ test("unchecking + Update persists disableExport, re-checking restores it (W2)", async () => {
+ // Start from export-allowed so the test owns its precondition.
+ await setQueryDataPolicy({ ...originalQueryDataPolicy, disableExport: false });
+ await gotoGeneralSettings();
+ await expect(exportCheckbox()).toBeChecked();
+
+ // Uncheck → the dirty bar's Update commits the policy.
+ await exportCheckbox().click();
+ await expect(exportCheckbox()).not.toBeChecked();
+ await page.getByRole("button", { name: "Update", exact: true }).click();
+ await expect(
+ page.getByText("Configuration is updated.").first()
+ ).toBeVisible({ timeout: 10_000 });
+ await expect
+ .poll(readDisableExport, { timeout: 10_000 })
+ .toBe(true);
+
+ // Re-check → Update → the policy returns to export-without-approval.
+ await exportCheckbox().click();
+ await expect(exportCheckbox()).toBeChecked();
+ await page.getByRole("button", { name: "Update", exact: true }).click();
+ await expect
+ .poll(readDisableExport, { timeout: 10_000 })
+ .toBe(false);
+ });
+});