Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Fix uses of Policy when referring to Pipelines (#8073)

James Bruntonf62299c57075
diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/policy/seed/DefaultClassificationPolicySeeder.java b/app/proprietary/src/main/java/stirling/software/proprietary/policy/seed/DefaultClassificationPolicySeeder.java
index 096d719f37..2b919e27bd 100644
--- a/app/proprietary/src/main/java/stirling/software/proprietary/policy/seed/DefaultClassificationPolicySeeder.java
+++ b/app/proprietary/src/main/java/stirling/software/proprietary/policy/seed/DefaultClassificationPolicySeeder.java
@@ -33,7 +33,7 @@ public class DefaultClassificationPolicySeeder {
static final String CATEGORY = "classification";
private static final String CLASSIFY_ENDPOINT = "/api/v1/ai/tools/classify-and-label";
- private static final String POLICY_NAME = "Classification Policy";
+ private static final String POLICY_NAME = "Classification";
/**
* Pre-existing seeds used this placeholder, which was never a user; see {@link #repairOwner}.
diff --git a/frontend/editor/public/locales/en-US/translation.toml b/frontend/editor/public/locales/en-US/translation.toml
index 3ba5191d62..64b81f2865 100644
--- a/frontend/editor/public/locales/en-US/translation.toml
+++ b/frontend/editor/public/locales/en-US/translation.toml
@@ -7284,7 +7284,8 @@ badgeRan = "{{name}} policy ran on this file"
badgeRunning = "{{name}} running..."
blockingAction = "{{action}} blocked while enforcing policy, please wait..."
dismiss = "Dismiss overlay"
-enforcingTitle = "Enforcing policy..."
+enforcingPipelineTitle = "Enforcing pipeline..."
+enforcingPolicyTitle = "Enforcing policy..."
exportBlocked = "A required policy failed. The export was cancelled. Try exporting again."
recoveryBody = "We couldn't apply a required policy to these files. Try again, or close the affected files to continue working."
recoveryClose_one = "Close file"
diff --git a/frontend/editor/src/proprietary/components/shared/PolicyEnforcingOverlay.tsx b/frontend/editor/src/proprietary/components/shared/PolicyEnforcingOverlay.tsx
index 1eee536932..c8f72cff15 100644
--- a/frontend/editor/src/proprietary/components/shared/PolicyEnforcingOverlay.tsx
+++ b/frontend/editor/src/proprietary/components/shared/PolicyEnforcingOverlay.tsx
@@ -11,6 +11,7 @@ import {
import { ActionIcon } from "@app/ui/ActionIcon";
import { Icon } from "@app/ui/Icon";
import { policyCategoryIcon } from "@app/components/policies/policyCategoryIcon";
+import { isEnforcedPolicy } from "@app/services/policyStorage";
import { useTranslation } from "react-i18next";
interface PolicyEnforcingOverlayProps {
@@ -98,7 +99,9 @@ export function PolicyEnforcingOverlay({
)}
</ThemeIcon>
<Text fw={600} size="sm">
- {t("policy.enforcingTitle", "Enforcing policy…")}
+ {isEnforcedPolicy(policyKey)
+ ? t("policy.enforcingPolicyTitle", "Enforcing policy...")
+ : t("policy.enforcingPipelineTitle", "Enforcing pipeline...")}
</Text>
{progress != null ? (
<Progress
diff --git a/frontend/editor/src/proprietary/components/viewer/PolicyEnforcementOverlay.tsx b/frontend/editor/src/proprietary/components/viewer/PolicyEnforcementOverlay.tsx
index 539cf713d0..08522fb011 100644
--- a/frontend/editor/src/proprietary/components/viewer/PolicyEnforcementOverlay.tsx
+++ b/frontend/editor/src/proprietary/components/viewer/PolicyEnforcementOverlay.tsx
@@ -7,6 +7,7 @@ import {
type PolicyRunRecord,
} from "@app/components/policies/policyRunStore";
import { policyAccentVar } from "@app/components/policies/policyStatus";
+import { isEnforcedPolicy } from "@app/services/policyStorage";
import { PolicyEnforcingOverlay } from "@app/components/shared/PolicyEnforcingOverlay";
import "@app/components/shared/PolicyBadges.css";
@@ -42,7 +43,11 @@ export function PolicyEnforcementOverlay({ runs }: Props) {
// per-file policy badges, larger) so the user can read the PDF.
return (
<Tooltip
- label={t("policy.enforcingTitle", "Enforcing policy…")}
+ label={
+ isEnforcedPolicy(inFlight.policyKey)
+ ? t("policy.enforcingPolicyTitle", "Enforcing policy...")
+ : t("policy.enforcingPipelineTitle", "Enforcing pipeline...")
+ }
position="left"
withArrow
>
diff --git a/frontend/editor/src/proprietary/services/policyExport.ts b/frontend/editor/src/proprietary/services/policyExport.ts
index 1be2bdebd3..a349108cae 100644
--- a/frontend/editor/src/proprietary/services/policyExport.ts
+++ b/frontend/editor/src/proprietary/services/policyExport.ts
@@ -71,16 +71,26 @@ function activeExportPolicies(): ExportPolicy[] {
// Same team-wide run order the upload path uses: enforcement is not commutative (a watermark
// then a flatten is not a flatten then a watermark), so both paths must agree on the sequence.
.sort(([, a], [, b]) => (a.order ?? 0) - (b.order ?? 0))
- .map(([id, s]) => ({
- policyKey: id,
- backendId: s.backendId as string,
- firstOperation: s.firstOperation,
- // A builder pipeline has no built-in category, so it labels by its own name.
- label: labels.get(id) ?? s.name ?? "Policy",
- outputMode: s.outputMode === "new_file" ? "new_file" : "new_version",
- required: s.required === true,
- accent: `var(--color-${ROW_ACCENT[id] ?? "blue"})`,
- }))
+ .map(([id, s]) => {
+ const required = s.required === true;
+ return {
+ policyKey: id,
+ backendId: s.backendId as string,
+ firstOperation: s.firstOperation,
+ // A builder pipeline has no built-in category, so it labels by its own name.
+ label:
+ labels.get(id) ??
+ s.name ??
+ i18n.t(
+ required
+ ? "portal.pipelines.type.policy"
+ : "portal.pipelines.type.pipeline",
+ ),
+ outputMode: s.outputMode === "new_file" ? "new_file" : "new_version",
+ required,
+ accent: `var(--color-${ROW_ACCENT[id] ?? "blue"})`,
+ };
+ })
);
}
diff --git a/frontend/editor/src/proprietary/services/policyStorage.ts b/frontend/editor/src/proprietary/services/policyStorage.ts
index f7a219a427..e3667ee0fc 100644
--- a/frontend/editor/src/proprietary/services/policyStorage.ts
+++ b/frontend/editor/src/proprietary/services/policyStorage.ts
@@ -106,6 +106,12 @@ export function loadPolicies(): PoliciesByKey {
return out;
}
+/** Whether the stored entry for this key is an enforced policy (blocking) rather
+ * than an ordinary pipeline. Unknown keys are treated as pipelines. */
+export function isEnforcedPolicy(policyKey: string | undefined): boolean {
+ return policyKey != null && loadPolicies()[policyKey]?.required === true;
+}
+
function persist(state: PoliciesByKey): void {
try {
if (typeof localStorage !== "undefined") {