Implement phased modernization infrastructure for transitioning from multi-page legacy routing to SPA portal-shell architecture, plus post-delivery hardening fixes for policy loading, fallback consistency, and governance drift detection. Key changes: - Add route contract enrichment with scope/visibility/compatibility policies - Canonical 302 redirects from legacy direct-entry to /portal-shell/ routes - Asset readiness enforcement and runtime fallback retirement for in-scope routes - Shared feature-flag helpers (env > config > default) replacing duplicated _to_bool - Defensive copy for lru_cached policy payloads preventing mutation corruption - Unified retired-fallback response helper across app and blueprint routes - Frontend/backend route-contract cross-validation in governance gates - Shell CSS token fallback values for routes rendered outside shell scope - Local-safe .env.example defaults with production recommendation comments - Legacy contract fallback warning logging and single-hop redirect optimization Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
53 lines
2.2 KiB
JavaScript
53 lines
2.2 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { existsSync, readFileSync } from 'node:fs';
|
|
import { resolve } from 'node:path';
|
|
|
|
function readSource(relativePath) {
|
|
const directPath = resolve(process.cwd(), relativePath);
|
|
if (existsSync(directPath)) {
|
|
return readFileSync(directPath, 'utf8');
|
|
}
|
|
return readFileSync(resolve(process.cwd(), 'frontend', relativePath), 'utf8');
|
|
}
|
|
|
|
test('shell route view uses direct RouterView host (no transition blank-state)', () => {
|
|
const appSource = readSource('src/portal-shell/App.vue');
|
|
assert.match(appSource, /<RouterView \/>/);
|
|
assert.doesNotMatch(appSource, /<Transition name=\"route-fade\" mode=\"out-in\">/);
|
|
});
|
|
|
|
test('Wave A chart components keep autoresize and tooltip configuration', () => {
|
|
const chartFiles = [
|
|
'src/wip-overview/components/ParetoSection.vue',
|
|
'src/qc-gate/components/QcGateChart.vue',
|
|
'src/hold-history/components/DailyTrend.vue',
|
|
'src/hold-history/components/ReasonPareto.vue',
|
|
'src/hold-history/components/DurationChart.vue',
|
|
'src/resource-history/components/TrendChart.vue',
|
|
'src/resource-history/components/StackedChart.vue',
|
|
'src/resource-history/components/HeatmapChart.vue',
|
|
'src/resource-history/components/ComparisonChart.vue',
|
|
];
|
|
|
|
chartFiles.forEach((filePath) => {
|
|
const source = readSource(filePath);
|
|
assert.match(source, /tooltip\s*:/, `missing tooltip config: ${filePath}`);
|
|
assert.match(source, /autoresize/, `missing autoresize lifecycle hook: ${filePath}`);
|
|
});
|
|
});
|
|
|
|
test('QC Gate keeps linked chart-table interaction guards', () => {
|
|
const source = readSource('src/qc-gate/App.vue');
|
|
assert.match(source, /const activeFilter = ref\(null\)/);
|
|
assert.match(source, /const filteredLots = computed\(\(\) =>/);
|
|
assert.match(source, /function handleChartSelect\(filter\)/);
|
|
assert.match(source, /activeFilter\.value = null/);
|
|
});
|
|
|
|
test('resource tooltip lifecycle keeps resize listener cleanup', () => {
|
|
const source = readSource('src/resource-status/components/FloatingTooltip.vue');
|
|
assert.match(source, /window\.addEventListener\('resize', positionTooltip\)/);
|
|
assert.match(source, /window\.removeEventListener\('resize', positionTooltip\)/);
|
|
});
|