-
Notifications
You must be signed in to change notification settings - Fork 1
feat(SFLW-47): React 18 → 19 ecosystem upgrade (dashboard frontend) #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
852666f
test(SFLW-47): add seeded dashboard smoke harness + behavior-pinning …
lbruton 746f269
build(SFLW-47): add dashboard type-check foundation (typecheck:dashbo…
lbruton 5039ea4
refactor(SFLW-47): vendor react-text-annotate-blend, drop dead npm dep
lbruton 1fd830d
feat(SFLW-47): bump commit 1 - React core to 19.2.7
lbruton 5792c4a
feat(SFLW-47): bump commit 2 - react-router-dom 7.17.0 (library mode)
lbruton 84b1053
feat(SFLW-47): bump commit 3 - i18next 26.3.1 + react-i18next 17.0.8
lbruton 4ba916c
feat(SFLW-47): bump commit 4 - @mdxeditor/editor 4.0.2
lbruton 340e513
test(SFLW-47): extract shared selectProject helper (CodeRabbit review)
lbruton 0e64313
test(SFLW-47): finish smoke-helper dedup + poll diagnostics (CodeRabb…
lbruton 5a86548
build(SFLW-47): harden dashboard tsconfig (CodeRabbit r3)
lbruton bf83a26
chore(SFLW-47): release 3.10.0 - version bump + changelog
lbruton 62f11a7
refactor(SFLW-47): deduplicate e2e harness infrastructure (Codacy dup…
lbruton 3df0292
chore(SFLW-47): exclude vendored third-party source from Codacy analysis
lbruton 752f23e
chore(SFLW-47): exclude vendor from Codacy metric/duplication engines
lbruton 36b8523
Merge origin/main into feat/SFLW-47-react-19-upgrade
lbruton 47b7793
fix(SFLW-47): address PR review round 2 (Copilot + CodeRabbit + Codacy)
lbruton a010afc
revert(SFLW-47): restore LogsPage.tsx to main - type fix obsolete und…
lbruton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { | ||
| DashboardSmokeHarness, | ||
| RegisteredProject, | ||
| SMOKE_SPEC_NAME, | ||
| bootSmokeHarness, | ||
| openSeededDashboard, | ||
| } from './helpers/dashboard-smoke-harness'; | ||
|
|
||
| // The app uses HashRouter — client routes live in the URL hash. | ||
| const ROUTES: Array<{ path: string; hash: string }> = [ | ||
| { path: '/', hash: '#/' }, | ||
| { path: '/steering', hash: '#/steering' }, | ||
| { path: '/specs', hash: '#/specs' }, | ||
| { path: '/specs/view', hash: `#/specs/view?name=${SMOKE_SPEC_NAME}` }, | ||
| { path: '/tasks', hash: '#/tasks' }, | ||
| { path: '/logs', hash: '#/logs' }, | ||
| { path: '/approvals', hash: '#/approvals' }, | ||
| { path: '/settings', hash: '#/settings' }, | ||
| ]; | ||
|
|
||
| test.describe.serial('Dashboard route sweep (seeded backend)', () => { | ||
| test.skip( | ||
| process.env.SPECFLOW_SMOKE_CONFIG !== '1', | ||
| 'Requires the seeded backend from playwright.smoke.config.ts (npm run test:e2e:smoke)', | ||
| ); | ||
|
|
||
| test.setTimeout(180000); | ||
|
|
||
| let harness: DashboardSmokeHarness; | ||
| let project: RegisteredProject; | ||
|
|
||
| test.beforeAll(async ({}, testInfo) => { | ||
| testInfo.setTimeout(180000); | ||
| ({ harness, project } = await bootSmokeHarness('smoke-routes')); | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| test.afterAll(async () => { | ||
| if (harness) { | ||
| await harness.cleanup(); | ||
| } | ||
| }); | ||
|
|
||
| test('all 8 routes render seeded content with no console errors', async ({ page }) => { | ||
| const consoleErrors = await openSeededDashboard(page, project.projectId); | ||
|
|
||
| for (const route of ROUTES) { | ||
| await page.goto(`/${route.hash}`); | ||
|
|
||
| const main = page.locator('main'); | ||
| await expect(main, `route ${route.path} should render a main region`).toBeVisible(); | ||
|
|
||
| // A blank frame or an unregistered-project fallback is a failure, never a pass. | ||
| await expect( | ||
| main.getByText('No Projects Available'), | ||
| `route ${route.path} must not fall back to "No Projects Available"`, | ||
| ).toHaveCount(0); | ||
|
|
||
| await expect(async () => { | ||
| const text = (await main.innerText()).trim(); | ||
| expect(text.length, `route ${route.path} rendered a blank frame`).toBeGreaterThan(0); | ||
| }, `route ${route.path} should render visible content`).toPass({ timeout: 15000 }); | ||
| } | ||
|
|
||
| // The seeded spec must actually appear on /specs — proves the sweep ran | ||
| // against real data rather than empty pages. | ||
| await page.goto('/#/specs'); | ||
| await expect(page.getByTestId(`spec-table-row-${SMOKE_SPEC_NAME}`)).toBeVisible({ | ||
| timeout: 15000, | ||
| }); | ||
|
|
||
| expect( | ||
| consoleErrors, | ||
| `Console must stay clean across all routes. Captured:\n${consoleErrors.join('\n')}`, | ||
| ).toHaveLength(0); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,268 @@ | ||
| import { expect, Page } from '@playwright/test'; | ||
| import { ChildProcess } from 'child_process'; | ||
| import { mkdtemp, mkdir, realpath, rm, writeFile } from 'fs/promises'; | ||
| import { tmpdir } from 'os'; | ||
| import { basename, join } from 'path'; | ||
| import { | ||
| GIT_CMD, | ||
| NPM_CMD, | ||
| RegisteredProject, | ||
| cleanupProcessesAndTemp, | ||
| pollProjectsList, | ||
| runCommand, | ||
| spawnMcpProcess, | ||
| } from './process-utils'; | ||
|
|
||
| export type { RegisteredProject } from './process-utils'; | ||
|
|
||
| interface DashboardSmokeHarnessOptions { | ||
| serverRoot: string; | ||
| dashboardApiBaseUrl: string; | ||
| specWorkflowHome: string; | ||
| /** Directory name for the seeded project — becomes the dashboard projectName. */ | ||
| projectDirName: string; | ||
| } | ||
|
|
||
| /** Spec fixture name the smoke specs assert against. */ | ||
| export const SMOKE_SPEC_NAME = 'smoke-fixture-spec'; | ||
|
|
||
| /** Dashboard backend base URL — must match DASHBOARD_PORT in playwright.smoke.config.ts. */ | ||
| export const DASHBOARD_API_BASE_URL = 'http://127.0.0.1:5085'; | ||
|
|
||
| // SFLW-51 (pre-existing on React 18, dev mode only): the vite dev proxy | ||
| // targets ws://localhost:<port> while the backend binds 127.0.0.1, so every | ||
| // /ws upgrade fails with a handshake 500 and the provider retries forever. | ||
| // This exact pattern is filtered with justification; ALL other console errors | ||
| // (render errors, React warnings-as-errors, route failures) still fail tests. | ||
| export const PRE_EXISTING_WS_PROXY_ERROR = /WebSocket connection to 'ws:\/\/[^']*\/ws[^']*' failed/; | ||
|
|
||
| /** Attaches console.error + pageerror collectors, filtering only the SFLW-51 pattern. */ | ||
| export function collectConsoleErrors(page: Page, sink: string[]): void { | ||
| page.on('console', (message) => { | ||
| if (message.type() === 'error' && !PRE_EXISTING_WS_PROXY_ERROR.test(message.text())) { | ||
| sink.push(`[console.error] ${message.text()}`); | ||
| } | ||
| }); | ||
| page.on('pageerror', (error) => { | ||
| sink.push(`[pageerror] ${error.message}`); | ||
| }); | ||
| } | ||
|
|
||
| /** Selects a project in the dashboard header dropdown (shared by the smoke specs). */ | ||
| export async function selectProject(page: Page, projectId: string): Promise<void> { | ||
| const toggle = page.getByTestId('project-dropdown-toggle'); | ||
| await toggle.click(); | ||
| await expect(page.getByTestId('project-dropdown-menu')).toBeVisible(); | ||
|
|
||
| await page.getByTestId(`project-dropdown-item-${projectId}`).click(); | ||
| await expect(page.getByTestId('project-dropdown-menu')).toBeHidden(); | ||
| } | ||
|
|
||
| /** | ||
| * Standard smoke-spec opening: start collecting console errors (SFLW-51 | ||
| * pattern filtered) BEFORE the first navigation so app-boot errors are | ||
| * captured too, then load the dashboard and select the seeded project. | ||
| * Returns the console-error sink for the spec's final assertion. | ||
| */ | ||
| export async function openSeededDashboard(page: Page, projectId: string): Promise<string[]> { | ||
| const consoleErrors: string[] = []; | ||
| collectConsoleErrors(page, consoleErrors); | ||
|
|
||
| await page.goto('/'); | ||
| await expect(page.getByTestId('project-dropdown-toggle')).toBeVisible(); | ||
| await selectProject(page, projectId); | ||
|
|
||
| return consoleErrors; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
|
Copilot marked this conversation as resolved.
|
||
|
|
||
| /** Unique strings the smoke specs look for in rendered output. */ | ||
| export const SMOKE_HEADING = 'Smoke Fixture Requirements'; | ||
| export const SMOKE_LIST_ITEM = 'SmokeListItemAlpha'; | ||
| export const SMOKE_TABLE_CELL = 'SmokeCellAlpha'; | ||
|
|
||
| const FIXTURE_REQUIREMENTS = `# ${SMOKE_HEADING} | ||
|
|
||
| ## Introduction | ||
|
|
||
| Seeded fixture document for the SFLW-47 dashboard smoke suite. | ||
|
|
||
| ## Checklist | ||
|
|
||
| - ${SMOKE_LIST_ITEM} | ||
| - SmokeListItemBeta | ||
|
|
||
| ## Matrix | ||
|
|
||
| | Column A | Column B | | ||
| |----------|----------| | ||
| | ${SMOKE_TABLE_CELL} | SmokeCellBeta | | ||
|
|
||
| ## Flow | ||
|
|
||
| \`\`\`mermaid | ||
| graph TD | ||
| A[Seeded Start] --> B[Seeded End] | ||
| \`\`\` | ||
| `; | ||
|
|
||
| const FIXTURE_DESIGN = `# Smoke Fixture Design | ||
|
|
||
| ## Overview | ||
|
|
||
| Design fixture body for the route sweep. | ||
| `; | ||
|
|
||
| const FIXTURE_TASKS = `# Smoke Fixture Tasks | ||
|
|
||
| - [ ] 1. Seeded fixture task | ||
| - File: src/service.ts | ||
| - _Requirements: REQ-1_ | ||
| `; | ||
|
|
||
| /** | ||
| * Single-project simplification of WorktreeHarness (e2e/helpers/worktree-harness.ts). | ||
| * | ||
| * Seeds ONE git project containing one spec fixture (markdown headings, a list, | ||
| * a table, and a fenced mermaid block) plus one pending approval, then boots one | ||
| * MCP instance for it. The dashboard under test therefore always has real data — | ||
| * a "No Projects Available" render is a harness failure, never a vacuous pass. | ||
| */ | ||
| export class DashboardSmokeHarness { | ||
| private readonly options: DashboardSmokeHarnessOptions; | ||
| private readonly mcpProcesses: ChildProcess[] = []; | ||
| private readonly mcpLogs: string[] = []; | ||
| private tempRoot = ''; | ||
| private projectPath = ''; | ||
|
|
||
| constructor(options: DashboardSmokeHarnessOptions) { | ||
| this.options = options; | ||
| } | ||
|
|
||
| getProjectPath(): string { | ||
| return this.projectPath; | ||
| } | ||
|
|
||
| getCapturedLogs(): string { | ||
| return this.mcpLogs.join('\n'); | ||
| } | ||
|
|
||
| async setup(): Promise<void> { | ||
| this.tempRoot = await mkdtemp(join(tmpdir(), 'specwf-e2e-smoke-')); | ||
| this.projectPath = join(this.tempRoot, this.options.projectDirName); | ||
|
|
||
| await mkdir(this.projectPath, { recursive: true }); | ||
| await runCommand(GIT_CMD, ['init'], this.projectPath); | ||
| await runCommand(GIT_CMD, ['config', 'user.email', 'e2e@example.com'], this.projectPath); | ||
| await runCommand(GIT_CMD, ['config', 'user.name', 'E2E'], this.projectPath); | ||
|
|
||
| await writeFile(join(this.projectPath, 'README.md'), '# e2e smoke repo\n', 'utf-8'); | ||
| await runCommand(GIT_CMD, ['add', 'README.md'], this.projectPath); | ||
| await runCommand(GIT_CMD, ['commit', '-m', 'Initial commit'], this.projectPath); | ||
|
|
||
| this.tempRoot = await realpath(this.tempRoot); | ||
| this.projectPath = await realpath(this.projectPath); | ||
|
|
||
| // SFLW-50: the MCP auto-detects a sibling DocVault via | ||
| // `resolve(projectPath, '..', 'DocVault')`. Without it the server boots in | ||
| // degraded mode and registers no projects. | ||
| await mkdir(join(this.tempRoot, 'DocVault'), { recursive: true }); | ||
|
|
||
| await this.seedProject(); | ||
| } | ||
|
|
||
| private async seedProject(): Promise<void> { | ||
| await mkdir(join(this.projectPath, 'src'), { recursive: true }); | ||
| await writeFile( | ||
| join(this.projectPath, 'src', 'service.ts'), | ||
| 'export const source = "smoke";\n', | ||
| 'utf-8', | ||
| ); | ||
|
|
||
| const specDir = join(this.projectPath, '.specflow', 'specs', SMOKE_SPEC_NAME); | ||
| const approvalsDir = join(this.projectPath, '.specflow', 'approvals', SMOKE_SPEC_NAME); | ||
| await mkdir(specDir, { recursive: true }); | ||
| await mkdir(approvalsDir, { recursive: true }); | ||
|
|
||
| await writeFile(join(specDir, 'requirements.md'), FIXTURE_REQUIREMENTS, 'utf-8'); | ||
| await writeFile(join(specDir, 'design.md'), FIXTURE_DESIGN, 'utf-8'); | ||
| await writeFile(join(specDir, 'tasks.md'), FIXTURE_TASKS, 'utf-8'); | ||
|
|
||
| const approval = { | ||
| id: 'approval-smoke', | ||
| title: 'Requirements: Smoke Fixture', | ||
| filePath: 'src/service.ts', | ||
| type: 'document', | ||
| status: 'pending', | ||
| createdAt: new Date().toISOString(), | ||
| category: 'spec', | ||
| categoryName: SMOKE_SPEC_NAME, | ||
| }; | ||
| await writeFile( | ||
| join(approvalsDir, 'approval-smoke.json'), | ||
| JSON.stringify(approval, null, 2), | ||
| 'utf-8', | ||
| ); | ||
| } | ||
|
|
||
| async startMcpServer(): Promise<RegisteredProject> { | ||
| const child = spawnMcpProcess({ | ||
| command: NPM_CMD, | ||
| args: ['run', 'dev', '--', this.projectPath], | ||
| cwd: this.options.serverRoot, | ||
| env: { | ||
| ...process.env, | ||
| SPEC_WORKFLOW_HOME: this.options.specWorkflowHome, | ||
| }, | ||
| logs: this.mcpLogs, | ||
| logLabel: this.projectPath, | ||
| }); | ||
|
|
||
| this.mcpProcesses.push(child); | ||
|
|
||
| const expectedName = basename(this.projectPath); | ||
| // SFLW-50: projectPath is reported as the DocVault specflowRoot, not the | ||
| // seeded path — match on projectName (basename-derived, stable). | ||
| return await pollProjectsList( | ||
| { | ||
| url: `${this.options.dashboardApiBaseUrl}/api/projects/list`, | ||
| timeoutMs: 90000, | ||
| description: `smoke project "${expectedName}"`, | ||
| getLogs: () => this.getCapturedLogs(), | ||
| }, | ||
| (projects) => projects.find((entry) => entry.projectName === expectedName), | ||
| ); | ||
| } | ||
|
|
||
| async cleanup(): Promise<void> { | ||
| await cleanupProcessesAndTemp(this.mcpProcesses, this.tempRoot); | ||
| this.tempRoot = ''; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Boots a fresh seeded smoke environment for a spec file: clears the isolated | ||
| * SPEC_WORKFLOW_HOME, seeds one project, and waits for dashboard registration. | ||
| * Shared by dashboard-route-sweep.spec.ts and spec-viewer-mdx.spec.ts. | ||
| */ | ||
| export async function bootSmokeHarness( | ||
| projectDirName: string, | ||
| ): Promise<{ harness: DashboardSmokeHarness; project: RegisteredProject }> { | ||
| const specWorkflowHome = process.env.SPEC_WORKFLOW_HOME; | ||
| if (!specWorkflowHome) { | ||
| throw new Error('SPEC_WORKFLOW_HOME must be set by playwright.smoke.config.ts'); | ||
| } | ||
|
|
||
| await rm(specWorkflowHome, { recursive: true, force: true }); | ||
| await mkdir(specWorkflowHome, { recursive: true }); | ||
|
|
||
| const harness = new DashboardSmokeHarness({ | ||
| serverRoot: process.cwd(), | ||
| dashboardApiBaseUrl: DASHBOARD_API_BASE_URL, | ||
| specWorkflowHome, | ||
| projectDirName, | ||
| }); | ||
|
|
||
| await harness.setup(); | ||
| const project = await harness.startMcpServer(); | ||
| return { harness, project }; | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.