fix(ui): retain policy warning outcome

This commit is contained in:
jesse-merhi
2026-08-11 03:25:49 +10:00
parent 372e3b4f55
commit ba5fa6ee67
3 changed files with 43 additions and 1 deletions
+1
View File
@@ -2799,6 +2799,7 @@ export const en: TranslationMap = {
defaultRiskWarning: "Review the ClawHub warning before installing this plugin.",
policyReviewTitle: "Security review needed",
policyReviewBodyKnown: "Policy warnings: {count}. Not installed.",
policyReviewBodyReason: "{reason} Not installed.",
policyReviewFindings: "Findings",
policyReviewSeverityInfo: "Info",
policyReviewSeverityWarn: "Warning",
+41
View File
@@ -760,6 +760,47 @@ describe("renderPlugins", () => {
});
});
it("keeps the not-installed outcome visible for reason-only policy warnings", () => {
const plugin = createPlugin({
id: "reason-only",
name: "Reason Only",
installed: false,
enabled: false,
state: "disabled",
install: { source: "official", pluginId: "reason-only" },
});
const key = pluginRowKey(plugin.id);
const container = mount(
createProps({
activeTab: "discover",
result: createResult([plugin]),
messages: {
[key]: {
kind: "warning",
text: "Review this package source.",
installPolicyWarning: {
request: { source: "official", pluginId: "reason-only" },
details: {
installPolicyCode: "install_policy_warning_acknowledgement_required",
targetName: "reason-only",
targetType: "plugin",
requestMode: "install",
reason: "Review this package source.",
acknowledgementToken: "reason-only-token",
},
},
},
},
}),
);
const alert = expectDefined(
container.querySelector('[data-plugin-id="reason-only"] [role="alert"]'),
"reason-only install policy warning",
);
expect(normalizedText(alert)).toContain("Review this package source. Not installed.");
});
it("correlates installed ClawHub packages without a search runtime id", () => {
const packageName = "@community/calendar-plus";
const installed = createPlugin({
+1 -1
View File
@@ -404,7 +404,7 @@ function renderRowMessage(
const findings = details.findings ?? [];
const reviewBody =
findings.length === 0
? details.reason
? t("pluginsPage.policyReviewBodyReason", { reason: details.reason })
: t("pluginsPage.policyReviewBodyKnown", { count: String(findings.length) });
return html`
<div