Gaps fill up, fixes, ui restructuring

This commit is contained in:
master
2026-02-19 22:10:54 +02:00
parent b5829dce5c
commit 04cacdca8a
331 changed files with 42859 additions and 2174 deletions

View File

@@ -0,0 +1,360 @@
import { expect, test, type Page } from '@playwright/test';
import { policyAuthorSession } from '../../src/app/testing';
const shellSession = {
...policyAuthorSession,
scopes: [
...new Set([
...policyAuthorSession.scopes,
'ui.read',
'admin',
'orch:read',
'orch:operate',
'orch:quota',
'findings:read',
'vuln:view',
'vuln:investigate',
'vuln:operate',
'vuln:audit',
'authority:tenants.read',
'advisory:read',
'vex:read',
'exceptions:read',
'exceptions:approve',
'aoc:verify',
]),
],
};
const mockConfig = {
authority: {
issuer: 'http://127.0.0.1:4400/authority',
clientId: 'stella-ops-ui',
authorizeEndpoint: 'http://127.0.0.1:4400/authority/connect/authorize',
tokenEndpoint: 'http://127.0.0.1:4400/authority/connect/token',
logoutEndpoint: 'http://127.0.0.1:4400/authority/connect/logout',
redirectUri: 'http://127.0.0.1:4400/auth/callback',
postLogoutRedirectUri: 'http://127.0.0.1:4400/',
scope:
'openid profile email ui.read authority:tenants.read advisory:read vex:read exceptions:read exceptions:approve aoc:verify findings:read orch:read vuln:view vuln:investigate vuln:operate vuln:audit',
audience: 'http://127.0.0.1:4400/gateway',
dpopAlgorithms: ['ES256'],
refreshLeewaySeconds: 60,
},
apiBaseUrls: {
authority: '/authority',
scanner: '/scanner',
policy: '/policy',
concelier: '/concelier',
attestor: '/attestor',
gateway: '/gateway',
},
quickstartMode: true,
setup: 'complete',
};
const oidcConfig = {
issuer: mockConfig.authority.issuer,
authorization_endpoint: mockConfig.authority.authorizeEndpoint,
token_endpoint: mockConfig.authority.tokenEndpoint,
jwks_uri: 'http://127.0.0.1:4400/authority/.well-known/jwks.json',
response_types_supported: ['code'],
subject_types_supported: ['public'],
id_token_signing_alg_values_supported: ['RS256'],
};
async function setupShell(page: Page): Promise<void> {
await page.addInitScript((session) => {
try {
window.sessionStorage.clear();
} catch {
// ignore storage access errors in restricted contexts
}
(window as { __stellaopsTestSession?: unknown }).__stellaopsTestSession = session;
}, shellSession);
await page.route('**/platform/envsettings.json', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(mockConfig),
})
);
await page.route('**/config.json', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(mockConfig),
})
);
await page.route('**/authority/.well-known/openid-configuration', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(oidcConfig),
})
);
await page.route('**/.well-known/openid-configuration', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify(oidcConfig),
})
);
await page.route('**/authority/.well-known/jwks.json', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ keys: [] }),
})
);
await page.route('**/authority/connect/**', (route) =>
route.fulfill({
status: 400,
contentType: 'application/json',
body: JSON.stringify({ error: 'not-used-in-critical-path-e2e' }),
})
);
await page.route('**/api/v1/advisory-sources**', (route) => {
const url = new URL(route.request().url());
const path = url.pathname;
if (path === '/api/v1/advisory-sources') {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
items: [
{
sourceId: 'src-nvd',
sourceKey: 'nvd',
sourceName: 'NVD',
sourceFamily: 'nvd',
sourceUrl: 'https://nvd.nist.gov',
priority: 10,
enabled: true,
lastSyncAt: '2026-02-19T08:00:00Z',
lastSuccessAt: '2026-02-19T08:00:00Z',
freshnessAgeSeconds: 1200,
freshnessSlaSeconds: 7200,
freshnessStatus: 'warning',
signatureStatus: 'signed',
lastError: null,
syncCount: 14,
errorCount: 0,
totalAdvisories: 12345,
signedAdvisories: 12300,
unsignedAdvisories: 45,
signatureFailureCount: 0,
},
],
totalCount: 1,
dataAsOf: '2026-02-19T08:00:00Z',
}),
});
}
if (path === '/api/v1/advisory-sources/summary') {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
totalSources: 1,
healthySources: 1,
warningSources: 0,
staleSources: 0,
unavailableSources: 0,
disabledSources: 0,
conflictingSources: 0,
dataAsOf: '2026-02-19T08:00:00Z',
}),
});
}
if (path.endsWith('/impact')) {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
sourceId: 'src-nvd',
sourceFamily: 'nvd',
region: null,
environment: null,
impactedDecisionsCount: 2,
impactSeverity: 'medium',
lastDecisionAt: '2026-02-19T08:05:00Z',
decisionRefs: [
{
decisionId: 'apr-001',
decisionType: 'approval',
label: 'Approval apr-001',
route: '/release-control/approvals/apr-001',
},
],
dataAsOf: '2026-02-19T08:00:00Z',
}),
});
}
if (path.endsWith('/conflicts')) {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
sourceId: 'src-nvd',
status: 'open',
limit: 50,
offset: 0,
totalCount: 0,
items: [],
dataAsOf: '2026-02-19T08:00:00Z',
}),
});
}
if (path.endsWith('/freshness')) {
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({
source: {
sourceId: 'src-nvd',
sourceKey: 'nvd',
sourceName: 'NVD',
sourceFamily: 'nvd',
sourceUrl: 'https://nvd.nist.gov',
priority: 10,
enabled: true,
lastSyncAt: '2026-02-19T08:00:00Z',
lastSuccessAt: '2026-02-19T08:00:00Z',
freshnessAgeSeconds: 1200,
freshnessSlaSeconds: 7200,
freshnessStatus: 'warning',
signatureStatus: 'signed',
lastError: null,
syncCount: 14,
errorCount: 0,
totalAdvisories: 12345,
signedAdvisories: 12300,
unsignedAdvisories: 45,
signatureFailureCount: 0,
},
lastSyncAt: '2026-02-19T08:00:00Z',
lastSuccessAt: '2026-02-19T08:00:00Z',
lastError: null,
syncCount: 14,
errorCount: 0,
dataAsOf: '2026-02-19T08:00:00Z',
}),
});
}
return route.fulfill({
status: 404,
contentType: 'application/json',
body: JSON.stringify({ error: 'not mocked in critical-path e2e' }),
});
});
}
async function go(page: Page, path: string): Promise<void> {
await page.goto(path, { waitUntil: 'domcontentloaded' });
await page.waitForLoadState('networkidle', { timeout: 5000 }).catch(() => null);
}
async function ensureShell(page: Page): Promise<void> {
await expect(page.locator('aside.sidebar')).toHaveCount(1, { timeout: 15000 });
}
async function openSidebarGroupRoute(
page: Page,
groupLabel: string,
targetHref: string
): Promise<void> {
const sidebar = page.locator('aside.sidebar');
const targetLink = sidebar.locator(`a[href="${targetHref}"]`).first();
const isVisible = await targetLink.isVisible().catch(() => false);
if (!isVisible) {
await sidebar.getByRole('button', { name: groupLabel, exact: true }).click();
}
await expect(targetLink).toBeVisible();
await targetLink.click();
}
test.describe.configure({ mode: 'serial' });
test.describe('Critical path shell verification', () => {
test.beforeEach(async ({ page }) => {
await setupShell(page);
});
test('dashboard to release-control setup/bundles/promotions/runs renders canonical flow', async ({
page,
}) => {
await go(page, '/dashboard');
await expect(page).toHaveURL(/\/dashboard$/);
await ensureShell(page);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Dashboard');
await go(page, '/release-control/setup');
await expect(page).toHaveURL(/\/release-control\/setup$/);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Setup');
await go(page, '/release-control/bundles');
await expect(page).toHaveURL(/\/release-control\/bundles$/);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Bundles');
await go(page, '/release-control/promotions');
await expect(page).toHaveURL(/\/release-control\/promotions$/);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Promotions');
await go(page, '/release-control/runs');
await expect(page).toHaveURL(/\/release-control\/runs$/);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Run Timeline');
});
test('security advisory sources preserves ownership split links', async ({ page }) => {
await go(page, '/security-risk/advisory-sources');
await expect(page).toHaveURL(/\/security-risk\/advisory-sources$/);
await ensureShell(page);
await expect(page.locator('body')).toContainText('Advisory Sources');
await expect(page.locator('a[href*="/integrations/feeds"]').first()).toBeVisible();
await expect(page.locator('a[href*="/platform-ops/feeds"]').first()).toBeVisible();
await expect(page.locator('a[href*="/security-risk/findings"]').first()).toBeVisible();
});
test('evidence routes expose replay, timeline, proofs, and trust ownership link', async ({ page }) => {
await go(page, '/evidence-audit');
await expect(page).toHaveURL(/\/evidence-audit$/);
await ensureShell(page);
await expect(page.locator('body')).toContainText('Evidence Surfaces');
await expect(page.locator('a[href="/administration/trust-signing"]').first()).toBeVisible();
await go(page, '/evidence-audit/replay');
await expect(page).toHaveURL(/\/evidence-audit\/replay$/);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Replay / Verify');
await go(page, '/evidence-audit/timeline');
await expect(page).toHaveURL(/\/evidence-audit\/timeline$/);
await expect(page.getByRole('heading', { name: /Timeline/i }).first()).toBeVisible();
await go(page, '/evidence-audit/proofs');
await expect(page).toHaveURL(/\/evidence-audit\/proofs$/);
await expect(page.locator('app-breadcrumb nav.breadcrumb')).toContainText('Proof Chains');
});
test('integrations and platform-ops split navigation remains intact', async ({ page }) => {
await go(page, '/dashboard');
await ensureShell(page);
await expect(page.locator('aside.sidebar')).toContainText('Integrations');
await openSidebarGroupRoute(page, 'Platform Ops', '/platform-ops/data-integrity');
await expect(page).toHaveURL(/\/platform-ops\/data-integrity$/);
await expect(page.locator('body')).toContainText('Data Integrity');
await expect(page.locator('a[href="/security-risk/advisory-sources"]').first()).toBeVisible();
});
});