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.

Keep disk repairs independent of the test-parser detour

pulse-triage[bot]131ce8725931
diff --git a/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.test.ts b/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.test.ts
index b2c9dd5b19..a8f06a7627 100644
--- a/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.test.ts
@@ -1,13 +1,6 @@
-import { describe, expect, it, vi } from 'vitest';
-import ts from 'typescript';
+import { describe, expect, it } from 'vitest';
import runtimeControlsSource from '@/components/Settings/AIRuntimeControlsSection.tsx?raw';
-vi.mock('typescript', async (importOriginal) => {
- const actual = await importOriginal<{ default: typeof ts }>();
- return {
- default: { ...actual.default, createSourceFile: vi.fn(actual.default.createSourceFile) },
- };
-});
import { settingsDocumentationLinkViolations } from './settingsDocumentationLinkContract';
const valid = `
@@ -17,10 +10,8 @@ const valid = `
`;
describe('surviving settings documentation link contract', () => {
- it('does not parse a link-free surviving runtime section', () => {
- vi.mocked(ts.createSourceFile).mockClear();
+ it('accepts the link-free surviving runtime section', () => {
expect(settingsDocumentationLinkViolations(runtimeControlsSource)).toEqual([]);
- expect(ts.createSourceFile).not.toHaveBeenCalled();
});
it.each([
@@ -28,10 +19,8 @@ describe('surviving settings documentation link contract', () => {
'export const Link = () => <\n a href="/docs">Docs</a>;',
String.raw`import { External\u0054extLink as Link } from './untrusted'; export const Section = () => <Link href="/docs">Docs</Link>;`,
'import { TERMS_DOC_URL as terms } from "@/utils/docsLinks"; export const Section = () => <p>No link</p>;',
- ])('still parses possible anchors, aliases and escaped bindings: %s', (source) => {
- vi.mocked(ts.createSourceFile).mockClear();
+ ])('rejects possible anchors, aliases and escaped bindings: %s', (source) => {
expect(settingsDocumentationLinkViolations(source)).not.toEqual([]);
- expect(ts.createSourceFile).toHaveBeenCalledOnce();
});
it('accepts an actual shared link to shipped Terms', () => {
diff --git a/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.ts b/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.ts
index a6c9cb90a4..4ce5f20278 100644
--- a/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.ts
+++ b/frontend-modern/src/components/shared/__tests__/settingsDocumentationLinkContract.ts
@@ -3,18 +3,6 @@ import ts from 'typescript';
// Inspect surviving JSX, not symbol mentions: removing a whole link is valid,
// but leaving an import or comment must not conceal a raw or misdirected link.
export function settingsDocumentationLinkViolations(source: string): string[] {
- // Removed controls can leave a section with no documentation link at all.
- // Avoid constructing an AST in that common case. Any possible raw anchor,
- // shared/Terms binding or escape still takes the full structural check.
- if (
- !source.includes('ExternalTextLink') &&
- !source.includes('TERMS_DOC_URL') &&
- !/<\s*a\b/.test(source) &&
- !source.includes('\\')
- ) {
- return [];
- }
-
const file = ts.createSourceFile(
'settings.tsx',
source,