From e2e2990550e15336311ec114e1de025f207c588f Mon Sep 17 00:00:00 2001
From: "pulse-triage[bot]"
<249995291+pulse-triage[bot]@users.noreply.github.com>
Date: Fri, 4 Sep 2026 23:58:11 +0100
Subject: [PATCH] Guard authentication strategy selection across polling
Exercise the mounted credential slot through repeated snapshots and a different edit target. A mutation that stops marking strategy selections dirty fails the new regression test.
Contract-Neutral: regression coverage only; no runtime or API changes
Change-source: pulse-maintainer
---
.../__tests__/NodeCredentialSlot.test.tsx | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/__tests__/NodeCredentialSlot.test.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/__tests__/NodeCredentialSlot.test.tsx
index f8698bef8..b74f43f50 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/__tests__/NodeCredentialSlot.test.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/__tests__/NodeCredentialSlot.test.tsx
@@ -116,6 +116,50 @@ describe('NodeCredentialSlot', () => {
);
});
+ it('keeps the selected authentication strategy across polls but resets for another node', async () => {
+ const settings = createSettings();
+ const initialNode = {
+ id: 'pve-0',
+ type: 'pve',
+ name: 'homelab',
+ host: 'https://pve1.local:8006',
+ user: '',
+ tokenName: 'root@pam!pulse',
+ hasToken: true,
+ verifySSL: true,
+ status: 'connected',
+ } as unknown as NodeConfigWithStatus;
+ const [editingNode, setEditingNode] = createSignal(initialNode);
+
+ render(() => (
+
+ ));
+
+ fireEvent.click(screen.getByRole('button', { name: /^Host Telemetry Agent$/i }));
+ const agentPanel = screen.getByText('Host telemetry agent');
+ for (let poll = 1; poll <= 2; poll += 1) {
+ setEditingNode({ ...initialNode, host: `https://poll-${poll}.local:8006` });
+ await waitFor(() => {
+ expect(screen.getByText('Host telemetry agent')).toBe(agentPanel);
+ expect(screen.getByLabelText(/^Endpoint URL/)).toHaveValue(initialNode.host);
+ });
+ }
+
+ // A genuinely different edit target must not inherit the previous strategy.
+ setEditingNode({ ...initialNode, id: 'pve-1', host: 'https://pve2.local:8006' });
+ await waitFor(() => {
+ expect(screen.queryByText('Host telemetry agent')).not.toBeInTheDocument();
+ expect(screen.getByLabelText(/^Endpoint URL/)).toHaveValue('https://pve2.local:8006');
+ });
+ expect(settings.saveNode).not.toHaveBeenCalled();
+ });
+
it('requires candidate import plan approval before guided setup handoff or manual save', () => {
render(() => (