Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Verify held timestamp ages on desktop and phone

pulse-triage[bot]4c631ed813af
diff --git a/frontend-modern/browser-tests/residual-evidence-ages.cjs b/frontend-modern/browser-tests/residual-evidence-ages.cjs
index 5b82045c6b..00e94add88 100644
--- a/frontend-modern/browser-tests/residual-evidence-ages.cjs
+++ b/frontend-modern/browser-tests/residual-evidence-ages.cjs
@@ -66,6 +66,13 @@ const iso = (n) => new Date(n).toISOString();
locale: 'en-GB',
timezoneId: 'UTC',
});
+ // Only synthetic local POST responses are admitted; use the normal
+ // CSRF header path without a paused-clock cookie-preparation delay.
+ await page
+ .context()
+ .addCookies([
+ { name: 'pulse_csrf', value: 'synthetic-clock-control', url: origin, sameSite: 'Lax' },
+ ]);
currentPage = page;
page.setDefaultTimeout(7000);
const record = {
@@ -102,6 +109,9 @@ const iso = (n) => new Date(n).toISOString();
{ once: true },
);
}, dark);
+ await page.addInitScript(() => {
+ window.__residualReadiness = { resourcesRead: false };
+ });
await page.route('**/*', async (route) => {
const req = route.request(),
url = new URL(req.url()),
@@ -115,6 +125,7 @@ const iso = (n) => new Date(n).toISOString();
req.method() === 'POST' &&
['/api/admin/profiles/suggestions', '/api/admin/profiles/validate'].includes(p)
) {
+ assert.equal(req.headers()['x-csrf-token'], 'synthetic-clock-control');
record.computePosts.push(p);
if (p.endsWith('/validate'))
return route.fulfill({ json: { Valid: true, Errors: [], Warnings: [] } });
@@ -229,7 +240,12 @@ const iso = (n) => new Date(n).toISOString();
record.unexpectedReads.push(p);
return route.fulfill({ status: 404, json: { error: 'Unspecified synthetic read' } });
}
- return route.fulfill({ json: data });
+ await route.fulfill({ json: data });
+ if (p === '/api/resources')
+ await page.evaluate(() => {
+ window.__residualReadiness.resourcesRead = true;
+ });
+ return;
});
const activate = async (el) => {
await el.focus();
@@ -271,25 +287,26 @@ const iso = (n) => new Date(n).toISOString();
// from the accessibility tree, so select its DOM identity explicitly.
const card = page.locator('[data-api-token-card="fixture-token"]');
await card.waitFor({ state: 'attached' });
- age =
- width < 500
- ? card.getByText('Created', { exact: true }).locator('..').locator('dd')
- : page
- .locator('tr')
- .filter({ hasText: 'Held token' })
- .locator('td')
- .nth(
- await page
- .getByRole('columnheader', { name: 'Created', exact: true })
- .evaluate((el) => el.cellIndex),
- );
+ if (width < 500) {
+ age = card.getByText('Created', { exact: true }).locator('..').locator('dd');
+ } else {
+ const row = page.locator('tr').filter({ hasText: 'Held token' });
+ await row.waitFor();
+ const index = await row.evaluate((el) =>
+ [...el.closest('table').querySelectorAll('thead th')].findIndex(
+ (header) => header.textContent.trim() === 'Created',
+ ),
+ );
+ assert(index >= 0, 'visible token table identifies the Created column');
+ age = row.locator('td').nth(index);
+ assert.equal(await age.isVisible(), true, 'desktop Created is on screen');
+ }
await activate(page.getByRole('button', { name: 'Generate new', exact: true }));
target = page.getByLabel('Token name', { exact: true });
await target.fill('Unsaved token name');
} else if (surface === 'profiles') {
const row = page.locator('tr').filter({ hasText: 'Held profile host' });
await row.waitFor({ state: 'attached' });
- await page.clock.runFor(2000); // Finish the existing background canonical revalidation before the quiet interval.
age = row.locator('td').last();
target = row.getByRole('combobox');
assert.equal(await target.inputValue(), 'profile-a');
@@ -307,6 +324,13 @@ const iso = (n) => new Date(n).toISOString();
age = page.getByRole('button', { name: /First saved draft/ });
target = age;
}
+ if (surface === 'tokens' || surface === 'profiles') {
+ // This panel also paints websocket resources before its existing
+ // 15,250ms-delayed REST revalidation. Drain that initial read before measuring
+ // the quiet interval; the timer under test must cause no later reads.
+ await page.clock.fastForward(16_000);
+ await page.waitForFunction(() => window.__residualReadiness.resourcesRead);
+ }
const text = async () => (await age.textContent()).trim();
assert.match(await text(), compact ? /1m ago/ : /1 min ago/);
await target.focus();
@@ -391,13 +415,16 @@ const iso = (n) => new Date(n).toISOString();
);
} else if (surface === 'tokens') {
tokenTime = await page.evaluate(() => Date.now());
- await page.evaluate(() => window.__residualAges.refreshTokens());
+ // refreshing is a display-only prop, not a token-list refetch
+ // contract. A new visit legitimately rereads the immutable list.
+ await page.evaluate(() => window.__residualAges.unmount());
+ await page.evaluate(() => window.__residualAges.remount());
await page.waitForFunction(() =>
[...document.querySelectorAll('[data-api-token-card] dd')].some(
(el) => el.textContent === '0s ago',
),
);
- assert.equal(await target.inputValue(), 'Unsaved token name');
+ assert.equal(await page.getByLabel('Token name', { exact: true }).inputValue(), '');
await page.clock.fastForward(60_000);
assert.match(await text(), /1 min ago/);
} else if (surface === 'profiles') {
@@ -445,6 +472,11 @@ const iso = (n) => new Date(n).toISOString();
result.completed = true;
} catch (err) {
if (currentPage && !currentPage.isClosed()) {
+ result.failureHeaders = await currentPage
+ .locator('th')
+ .evaluateAll((els) =>
+ els.map((el) => ({ html: el.outerHTML, display: getComputedStyle(el).display })),
+ );
result.failureBody = (await currentPage.locator('body').innerText()).slice(0, 12000);
await currentPage.screenshot({ path: output + '/failure.png', fullPage: false });
}
diff --git a/frontend-modern/browser-verification/34814fe79a759a72.json b/frontend-modern/browser-verification/34814fe79a759a72.json
new file mode 100644
index 0000000000..5198eea206
--- /dev/null
+++ b/frontend-modern/browser-verification/34814fe79a759a72.json
@@ -0,0 +1,49 @@
+{
+ "version": 1,
+ "base_sha": "6e54a792e4ecdacaecc2e9554cf05634eb58c1b0",
+ "verified_at": "2026-10-11T14:26:08Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx",
+ "frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx",
+ "frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx",
+ "frontend-modern/src/components/Settings/APITokenManager.tsx",
+ "frontend-modern/src/components/Settings/AgentProfilesPanel.tsx",
+ "frontend-modern/src/components/Settings/SuggestProfileModal.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Infrastructure/ResourceChangeSummary.tsx": "86d997626a00efde5dbfbbed61f08e39b03f7e4594e84833bdd7b22ea01a0ef1",
+ "frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx": "d5fa94f6bea6cce231dda539f2f97293095ef1e296b760f7d40cc28eea9383b6",
+ "frontend-modern/src/components/Infrastructure/ResourceOperatorStateSection.tsx": "b04f2c250213bd9394abd7cbc877c76ead962ea69ffa93a6e6af738431ea5016",
+ "frontend-modern/src/components/Settings/APITokenManager.tsx": "31944a8715d7b5eefb36ab8aa6d10df912f3542d1bf252a85c39aec44cdd37e4",
+ "frontend-modern/src/components/Settings/AgentProfilesPanel.tsx": "a683af54b59a932f8d83b1bc0903a0617ffe9209f225c8ad7cd4405d56c594cb",
+ "frontend-modern/src/components/Settings/SuggestProfileModal.tsx": "580def5226062061adc1f7dbfd2ef83f2481454dcba56ccd69b4ebd3437c640c"
+ },
+ "routes": [
+ "/browser-tests/residual-evidence-ages.html?surface=resource (existing production panels with synthetic local data; not an added application route)",
+ "/browser-tests/residual-evidence-ages.html?surface=operator (existing production panels with synthetic local data; not an added application route)",
+ "/browser-tests/residual-evidence-ages.html?surface=tokens (existing production panels with synthetic local data; not an added application route)",
+ "/browser-tests/residual-evidence-ages.html?surface=profiles (existing production panels with synthetic local data; not an added application route)",
+ "/browser-tests/residual-evidence-ages.html?surface=drafts (existing production panels with synthetic local data; not an added application route)"
+ ],
+ "viewports": [
+ {
+ "width": 1680,
+ "height": 950
+ },
+ {
+ "width": 390,
+ "height": 950
+ }
+ ],
+ "states": [
+ "Playwright 1.56.1 matches integration lock. Chromium 141.0.7390.37 light desktop and WebKit 26.0 dark touch phone; 10 groups and 20 final initial/held captures inspected, with matching 20 inspected current-parent captures. Not a native guest, physical phone, full application, release or provider acceptance.",
+ "Held observations move from one minute to two hours in change summary/history, saved operator set time, both token Created projections, profile Last Seen and older draft ages. Original source timestamps, status, scopes, saved policy and payload stay unchanged. Profile Last Seen remains deliberately hidden on phones.",
+ "No clock-triggered read, computation, save or token write in each quiet interval. Initial canonical REST revalidation is completed before the measurement, not removed. No page errors, unexpected reads, off-origin traffic or page-level horizontal overflow; all browser pages and server close."
+ ],
+ "interactions": [
+ "Desktop Enter and phone tap open change filters; focused filters, unsaved operator note/token name and profile assignment survive two simulated hours. Expected offline, Retired and Never auto-remediate remain unchanged.",
+ "Replace and remove canonical changes, and replace a live agent observation; new timestamps initialise correctly and continue to age. A separate explicit token-panel remount rereads supplied canonical Created and starts a new form; no unsupported refreshing-prop refetch or unsaved-draft preservation across remount is claimed.",
+ "Return to the first saved draft and accept its original prompt/configuration into a local callback; exactly two synthetic suggestion responses, no extra age-triggered suggestion, profile save or external provider call."
+ ]
+}