Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel
Qualify native desktop launch independently of DevTools and GPU availability
Yuechen Li819dec23f105
diff --git a/.github/workflows/cadmata-desktop-diagnostic.yml b/.github/workflows/cadmata-desktop-diagnostic.ymlindex df2af1b1..c24623d8 100644--- a/.github/workflows/cadmata-desktop-diagnostic.yml+++ b/.github/workflows/cadmata-desktop-diagnostic.yml@@ -33,8 +33,6 @@ jobs:if ($LASTEXITCODE -ne 0) { throw 'Cannot resolve producer source' }"revision=$source" >> $env:GITHUB_OUTPUT- uses: actions/checkout@v4- with:- ref: ${{ steps.source.outputs.revision }}- uses: actions/download-artifact@v4with:name: aetheris-release@@ -44,7 +42,7 @@ jobs:- uses: actions/setup-node@v4with:node-version: 24- - name: Exercise that source's actual desktop qualifier+ - name: Exercise the existing artifact with the current desktop qualifiershell: pwshenv:CADMATA_QUALIFICATION_LAUNCH_ONLY: '1'@@ -52,6 +50,8 @@ jobs:$PSNativeCommandUseErrorActionPreference = $true$zip = Get-ChildItem release/Aetheris-*-win-x64.zip | Select-Object -First 1Expand-Archive $zip.FullName extracted+ $metadata = Get-Content extracted/Aetheris-win-x64/BUILD-METADATA.json -Raw | ConvertFrom-Json+ if ($metadata.sourceRevision -ne '${{ steps.source.outputs.revision }}') { throw 'Artifact and producer source identity disagree' }npm ci --prefix test-support/CadmataDesktopSmoke --ignore-scriptsnode scripts/qualify-cadmata-portable.mts extracted/Aetheris-win-x64 artifacts/local/desktop-diagnostic test-support/CadmataDesktopSmoke/node_modules/playwright-core/index.mjs testdata/firmament/inline-step/canonical-through-hole.step- name: Preserve native startup diagnosticsdiff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.ymlindex 412212c8..83ba9711 100644--- a/.github/workflows/dotnet.yml+++ b/.github/workflows/dotnet.yml@@ -246,6 +246,13 @@ jobs:}./scripts/Test-PublicPackageGraph.ps1 -PackageDirectory release/packages/public-libraries -Version $env:AETHERIS_RELEASE_VERSION./scripts/Test-PublicPackageConsumer.ps1 -PackageDirectory release/packages/public-libraries -Version $env:AETHERIS_RELEASE_VERSION -OutputDirectory artifacts/local/release-public-consumer+ - name: Preserve native desktop qualification evidence+ if: always() && runner.os == 'Windows'+ uses: actions/upload-artifact@v4+ with:+ name: desktop-qualification-evidence+ path: artifacts/local/desktop-no-argument-smoke+ if-no-files-found: ignorepublish:if: ${{ !inputs.diagnostic_run_id && (startsWith(github.ref, 'refs/tags/v') || inputs.publish == true) }}diff --git a/scripts/Test-CadmataBundle.ps1 b/scripts/Test-CadmataBundle.ps1index 3a2b6c02..20d4a730 100644--- a/scripts/Test-CadmataBundle.ps1+++ b/scripts/Test-CadmataBundle.ps1@@ -7,6 +7,8 @@ $ErrorActionPreference = 'Stop'$bundle = (Resolve-Path -LiteralPath $BundleDirectory).Pathif (Test-Path -LiteralPath (Join-Path $bundle 'cadmata')) { throw 'Obsolete duplicated server publish directory is present.' }if (-not (Test-Path -LiteralPath (Join-Path $bundle 'Cadmata.Desktop.dll'))) { throw 'The actual desktop host is missing.' }+$metadata = Get-Content -LiteralPath (Join-Path $bundle 'BUILD-METADATA.json') -Raw | ConvertFrom-Json+if ($env:GITHUB_ACTIONS -eq 'true' -and $metadata.modifiedSource) { throw 'Hosted release must identify clean product source.' }if (-not (Test-Path -LiteralPath (Join-Path $bundle 'CORRESPONDING-SOURCE.md'))) { throw 'The desktop corresponding-source notice is missing.' }$licenseAudit = Get-Content -LiteralPath (Join-Path $bundle 'licenses/AUDIT.json') -Raw | ConvertFrom-Jsonif (-not $licenseAudit.redistributionNoticesComplete) { throw 'Desktop redistribution notices are incomplete.' }diff --git a/scripts/qualify-cadmata-portable.mts b/scripts/qualify-cadmata-portable.mtsindex 6e956b3f..3fcbf0d5 100644--- a/scripts/qualify-cadmata-portable.mts+++ b/scripts/qualify-cadmata-portable.mts@@ -20,8 +20,6 @@ await new Promise<void>((resolve, reject) => {const debugPort = Number(process.env.CADMATA_QUALIFICATION_DEBUG_PORT ?? (reservation.address() as { port: number }).port);await new Promise<void>(resolve => reservation.close(() => resolve()));const metadata = JSON.parse(await readFile(join(packageDirectory, "BUILD-METADATA.json"), "utf8"));-if (process.env.GITHUB_ACTIONS === "true")- assert.equal(metadata.modifiedSource, false, "Hosted release must identify clean product source; keep generated build tools under ignored artifacts");const executableSha256 = createHash("sha256").update(await readFile(join(packageDirectory, "Cadmata.exe"))).digest("hex");const started = Date.now();const app = spawn(join(packageDirectory, "Cadmata.exe"), startupFile ? [startupFile] : [], {@@ -32,7 +30,7 @@ const app = spawn(join(packageDirectory, "Cadmata.exe"), startupFile ? [startupFDOTNET_ROOT: join(outputDirectory, "no-installed-dotnet"),ASPNETCORE_URLS: "http://0.0.0.0:5000", ASPNETCORE_ENVIRONMENT: "Development",AETHERIS_CADMATA_PATH: "", AETHERIS_CAD_ASSISTANT_PATH: "",- WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${debugPort}`,+ WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: process.env.CADMATA_QUALIFICATION_LAUNCH_ONLY === "1" ? "" : `--remote-debugging-port=${debugPort}`,},});assert(app.pid, "The extracted app must start");@@ -42,138 +40,9 @@ const report: Record<string, unknown> = { executable: join(packageDirectory, "Caqualification: "automated actual packaged WebView2 session; not a human manual session",guards: ["System32-only application PATH", "unrelated CWD", "fresh browser profile", "external web requests blocked by desktop host"], };report.package = { identity: metadata.identity, webviewVersion: metadata.webviewVersion,- executableSha256 };-let browser;-try {- for (let attempt = 0; ; attempt++) {- try { await fetch(`http://127.0.0.1:${debugPort}/json/version`); break; }- catch {- assert(!closed, "Cadmata exited before WebView2 became ready");- if (attempt > 180) throw new Error("Packaged WebView2 did not become ready within 45 seconds");- await new Promise(resolve => setTimeout(resolve, 250));- }- }- browser = await chromium.connectOverCDP(`http://127.0.0.1:${debugPort}`);- const context = browser.contexts()[0];- const page = context.pages()[0] ?? await context.waitForEvent("page");- page.setDefaultTimeout(45000);- page.setDefaultNavigationTimeout(45000);- const errors: string[] = [];- const requests: string[] = [];- const shaders: string[] = [];- page.on("pageerror", (error: Error) => errors.push(String(error)));- page.on("request", (request: { url(): string }) => requests.push(request.url()));- page.on("response", async (response: { url(): string; json(): Promise<unknown> }) => {- if (response.url().includes("/assembly/") || response.url().endsWith("/assemblies/display"))- await writeFile(join(outputDirectory, "authored-display.json"), JSON.stringify(await response.json(), null, 2));- if (response.url().includes(".wgsl")) shaders.push(response.url());- });- await page.waitForURL(/http:\/\/127\.0\.0\.1:\d+\/$/, { timeout: 45000 });- const address = new URL(page.url()).origin;- const logs = join(process.env.LOCALAPPDATA!, "Aetheris/Cadmata/logs");- const logFile = (await readdir(logs)).find(file => file.endsWith(`-${app.pid}.log`));- assert(logFile, "This app's PID-specific diagnostic log must exist");- assert((await readFile(join(logs, logFile), "utf8")).includes("backend ready " + address),- "Debug connection must belong to this newly spawned application before any UI actions");- report.diagnosticLog = join(logs, logFile);- report.unauthenticatedStatus = (await fetch(address + "/api/v1/startup/step", { method: "POST" })).status;- assert.equal(report.unauthenticatedStatus, 403);- if (process.env.CADMATA_QUALIFICATION_LAUNCH_ONLY === "1") {- await page.locator('#root > *').first().waitFor({ state: "visible" });- assert((await readFile(join(logs, logFile), "utf8")).includes("UI visible"), "Desktop navigation must finish");- await page.screenshot({ path: join(outputDirectory, "desktop-no-argument-launch.png") });- report.mode = "no-argument desktop launch, frontend navigation and native close; GPU rendering not asserted";- report.errors = errors;- assert.equal(errors.length, 0, "No uncaught browser errors during launch");- } else {- await page.locator('[aria-label="Assembly product tree"] button').first().waitFor({ timeout: 45000 });- await page.waitForFunction(() => document.querySelector('[data-display-host="three-telos"]')?.getAttribute("aria-busy") === "false");- report.sampleVisibleMs = Date.now() - started;- report.gpu = await page.evaluate(async () => {- const adapter = await navigator.gpu?.requestAdapter();- return { available: !!adapter, vendor: adapter?.info.vendor, architecture: adapter?.info.architecture, description: adapter?.info.description };- });- assert((report.gpu as { available: boolean }).available, "Bundled WebView2 must expose WebGPU");- await page.waitForFunction(() => {- const display = JSON.parse(document.querySelector("canvas")?.getAttribute("data-telos-display") ?? "{}");- return display.meshSurfaces > 0 || display.fields > 0;- }, undefined, { timeout: 30000 });- report.directCirFieldDraws = await page.locator("canvas").getAttribute("data-telos-field-draws");- report.sampleDisplay = JSON.parse(await page.locator("canvas").getAttribute("data-telos-display") ?? "{}");- if (startupFile) assert(Number(report.directCirFieldDraws) > 0, "Qualified cylinder must draw direct CIR");- const canvas = page.getByLabel("Engineering WebGPU viewport");- const box = await canvas.boundingBox();- assert(box);- await page.screenshot({ path: join(outputDirectory, "packaged-sample.png") });- const before = await canvas.screenshot();- await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);- await page.mouse.down();- await page.mouse.move(box.x + box.width / 2 + 70, box.y + box.height / 2 + 25, { steps: 12 });- await page.mouse.up();- await page.waitForTimeout(200);- assert(!before.equals(await canvas.screenshot()), "Orbit must change the rendered view");- await page.mouse.down({ button: "right" });- await page.mouse.move(box.x + box.width / 2 + 100, box.y + box.height / 2 + 40, { steps: 6 });- await page.mouse.up({ button: "right" });- await page.mouse.wheel(0, -130);- await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);- await page.locator('[aria-label="Assembly product tree"] .active-row').waitFor();- await page.screenshot({ path: join(outputDirectory, "packaged-orbit-selection.png") });- report.navigationAndSelection = true;- await page.locator('input[type="file"]').setInputFiles(stepFile);- await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();- await page.getByText("Qualified: Import complete.", { exact: true }).waitFor({ timeout: 120000 });- const downloadButton = page.getByRole("button", { name: "Download Canonical 242", exact: true });- await downloadButton.waitFor({ timeout: 120000 });- await page.waitForFunction(() => {- const canvas = document.querySelector<HTMLCanvasElement>("canvas");- return JSON.parse(canvas?.dataset.telosDisplay ?? "{}").meshSurfaces > 0;- });- report.meshFallback = JSON.parse(await canvas.getAttribute("data-telos-display") ?? "{}");- await page.waitForFunction(() => !document.querySelector('[data-display-host="three-telos"][aria-busy="true"]'));- await page.screenshot({ path: join(outputDirectory, "packaged-step-import.png") });- assert(!before.equals(await canvas.screenshot()), "External STEP must replace the rendered sample");- const session = await context.newCDPSession(page);- await session.send("Browser.setDownloadBehavior", { behavior: "allow", downloadPath: outputDirectory, eventsEnabled: true });- const downloadEvent = new Promise<string>((resolve) => session.once("Browser.downloadWillBegin", (event: { suggestedFilename: string }) => resolve(event.suggestedFilename)));- await downloadButton.click();- const name = await Promise.race([downloadEvent, new Promise<never>((_, reject) => setTimeout(() => reject(new Error("STEP download event missing")), 15000))]);- const exportedPath = join(outputDirectory, name);- for (let attempt = 0; ; attempt++) {- try { assert((await readFile(exportedPath, "utf8")).startsWith("ISO-10303-21;")); break; }- catch (error) { if (attempt > 60) throw error; await new Promise(resolve => setTimeout(resolve, 250)); }- }- report.exportedStep = exportedPath;- await page.locator('input[type="file"]').setInputFiles(exportedPath);- const reimportResponse = page.waitForResponse(response => response.request().method() === "POST" && response.url().includes("/import"), { timeout: 120000 });- await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();- assert((await reimportResponse).ok(), "Canonical STEP reimport must succeed");- await page.getByText(/^(Qualified|Inspectable|Degraded): Import complete\./).waitFor({ timeout: 120000 });- await page.waitForFunction(() => [...document.querySelectorAll<HTMLButtonElement>("button")].some(button => button.textContent?.trim() === "Download Canonical 242" && !button.disabled), undefined, { timeout: 120000 });- assert(await downloadButton.isEnabled());- report.canonicalStepReimport = true;- // An invalid file must retain the last usable model and visible error.- await page.locator('input[type="file"]').setInputFiles({ name: "invalid.step", mimeType: "application/step", buffer: Buffer.from("invalid STEP") });- await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();- await page.getByText("Import failed", { exact: true }).waitFor();- assert(await downloadButton.isEnabled());- report.invalidFilePreservedModel = true;- report.shaderUrls = shaders;- report.requests = requests.filter(url => /^https?:/.test(url));- assert((report.requests as string[]).every(url => new URL(url).origin === address), "Application resources must stay on its loopback origin");- report.errors = errors;- assert.equal(errors.length, 0, "No uncaught browser errors");- await writeFile(join(outputDirectory, "page-text.txt"), await page.locator("body").innerText());- }- // Integration-test WM_CLOSE on the owning form, including a window hidden- // by the CI launcher. CloseMainWindow excludes hidden windows. This exercises- // FormClosed cleanup, but is not the required human title-bar interaction.- if (process.env.CADMATA_QUALIFICATION_MANUAL_CLOSE === "1") {- await writeFile(join(outputDirectory, "ready-for-native-close.json"), JSON.stringify({ pid: app.pid, address }));- const closeDeadline = Date.now() + 120000;- while (!closed && Date.now() < closeDeadline) await new Promise(resolve => setTimeout(resolve, 250));- report.closeMethod = "native UI close by external qualification operator";- } else {+ executableSha256, modifiedSource: metadata.modifiedSource };+const logs = join(process.env.LOCALAPPDATA!, "Aetheris/Cadmata/logs");+async function nativeWindows(sendClose: boolean): Promise<number> {const closeCommand = `Add-Type -TypeDefinition @'using System;@@ -194,7 +63,7 @@ $closedWindowCount = 0$windowTitle = [Text.StringBuilder]::new(512)[void][CadmataQualificationWindow]::GetWindowText($handle, $windowTitle, 512)if ($ownerProcess -eq ${app.pid} -and $windowTitle.ToString().StartsWith('Cadmata')) {- [void][CadmataQualificationWindow]::PostMessage($handle, 16, [IntPtr]::Zero, [IntPtr]::Zero)+ if (${sendClose ? "$true" : "$false"}) { [void][CadmataQualificationWindow]::PostMessage($handle, 16, [IntPtr]::Zero, [IntPtr]::Zero) }$script:closedWindowCount++}return $true@@ -203,9 +72,160 @@ $closedWindowCount`;const close = await promisify(execFile)(join(process.env.SystemRoot!, "System32/WindowsPowerShell/v1.0/powershell.exe"),["-NoProfile", "-Command", closeCommand], { windowsHide: true });- report.closeWindowCount = Number(close.stdout.trim());- assert(Number(report.closeWindowCount) > 0, "Owning native window must receive WM_CLOSE");- report.closeMethod = "automated native WM_CLOSE, not a human title-bar click";+ return Number(close.stdout.trim());+}+let browser;+let address = "";+try {+ if (process.env.CADMATA_QUALIFICATION_LAUNCH_ONLY === "1") {+ // Test the native host independently of DevTools and GPU availability.+ // Full rendered/interactive qualification remains the CDP path below.+ let nativeLog = "";+ for (let attempt = 0; ; attempt++) {+ const logFile = (await readdir(logs).catch(() => [])).find(file => file.endsWith(`-${app.pid}.log`));+ if (logFile) {+ report.diagnosticLog = join(logs, logFile);+ nativeLog = await readFile(join(logs, logFile), "utf8");+ assert(!nativeLog.includes("fatal "), "Native startup failed: " + nativeLog);+ const ready = nativeLog.match(/backend ready (http:\/\/127\.0\.0\.1:\d+)/);+ if (ready && nativeLog.includes("UI visible")) { address = ready[1]; break; }+ }+ assert(!closed, "Native desktop exited before browser navigation completed");+ if (attempt > 180) throw new Error("Native desktop navigation did not complete within 45 seconds; see startup log");+ await new Promise(resolve => setTimeout(resolve, 250));+ }+ report.nativeWindowCount = await nativeWindows(false);+ assert(Number(report.nativeWindowCount) > 0, "This app must own a native Cadmata window");+ report.unauthenticatedStatus = (await fetch(address + "/api/v1/startup/step", { method: "POST" })).status;+ assert.equal(report.unauthenticatedStatus, 403);+ nativeLog = await readFile(String(report.diagnosticLog), "utf8");+ assert(!nativeLog.includes("fatal "), "Native startup failed: " + nativeLog);+ report.frontendDiagnostics = nativeLog.split("\n").filter(line => line.includes("frontend "));+ report.mode = "no-argument native window, browser navigation and native close; GPU rendering not asserted";+ } else {+ for (let attempt = 0; ; attempt++) {+ try { await fetch(`http://127.0.0.1:${debugPort}/json/version`); break; }+ catch {+ assert(!closed, "Cadmata exited before WebView2 became ready");+ if (attempt > 180) throw new Error("Packaged WebView2 did not become ready within 45 seconds");+ await new Promise(resolve => setTimeout(resolve, 250));+ }+ }+ browser = await chromium.connectOverCDP(`http://127.0.0.1:${debugPort}`);+ const context = browser.contexts()[0];+ const page = context.pages()[0] ?? await context.waitForEvent("page");+ page.setDefaultTimeout(45000);+ page.setDefaultNavigationTimeout(45000);+ const errors: string[] = [];+ const requests: string[] = [];+ const shaders: string[] = [];+ page.on("pageerror", (error: Error) => errors.push(String(error)));+ page.on("request", (request: { url(): string }) => requests.push(request.url()));+ page.on("response", async (response: { url(): string; json(): Promise<unknown> }) => {+ if (response.url().includes("/assembly/") || response.url().endsWith("/assemblies/display"))+ await writeFile(join(outputDirectory, "authored-display.json"), JSON.stringify(await response.json(), null, 2));+ if (response.url().includes(".wgsl")) shaders.push(response.url());+ });+ await page.waitForURL(/http:\/\/127\.0\.0\.1:\d+\/$/, { timeout: 45000 });+ address = new URL(page.url()).origin;+ const logFile = (await readdir(logs)).find(file => file.endsWith(`-${app.pid}.log`));+ assert(logFile, "This app's PID-specific diagnostic log must exist");+ assert((await readFile(join(logs, logFile), "utf8")).includes("backend ready " + address),+ "Debug connection must belong to this newly spawned application before any UI actions");+ report.diagnosticLog = join(logs, logFile);+ report.unauthenticatedStatus = (await fetch(address + "/api/v1/startup/step", { method: "POST" })).status;+ assert.equal(report.unauthenticatedStatus, 403);+ await page.locator('[aria-label="Assembly product tree"] button').first().waitFor({ timeout: 45000 });+ await page.waitForFunction(() => document.querySelector('[data-display-host="three-telos"]')?.getAttribute("aria-busy") === "false");+ report.sampleVisibleMs = Date.now() - started;+ report.gpu = await page.evaluate(async () => {+ const adapter = await navigator.gpu?.requestAdapter();+ return { available: !!adapter, vendor: adapter?.info.vendor, architecture: adapter?.info.architecture, description: adapter?.info.description };+ });+ assert((report.gpu as { available: boolean }).available, "Bundled WebView2 must expose WebGPU");+ await page.waitForFunction(() => {+ const display = JSON.parse(document.querySelector("canvas")?.getAttribute("data-telos-display") ?? "{}");+ return display.meshSurfaces > 0 || display.fields > 0;+ }, undefined, { timeout: 30000 });+ report.directCirFieldDraws = await page.locator("canvas").getAttribute("data-telos-field-draws");+ report.sampleDisplay = JSON.parse(await page.locator("canvas").getAttribute("data-telos-display") ?? "{}");+ if (startupFile) assert(Number(report.directCirFieldDraws) > 0, "Qualified cylinder must draw direct CIR");+ const canvas = page.getByLabel("Engineering WebGPU viewport");+ const box = await canvas.boundingBox();+ assert(box);+ await page.screenshot({ path: join(outputDirectory, "packaged-sample.png") });+ const before = await canvas.screenshot();+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);+ await page.mouse.down();+ await page.mouse.move(box.x + box.width / 2 + 70, box.y + box.height / 2 + 25, { steps: 12 });+ await page.mouse.up();+ await page.waitForTimeout(200);+ assert(!before.equals(await canvas.screenshot()), "Orbit must change the rendered view");+ await page.mouse.down({ button: "right" });+ await page.mouse.move(box.x + box.width / 2 + 100, box.y + box.height / 2 + 40, { steps: 6 });+ await page.mouse.up({ button: "right" });+ await page.mouse.wheel(0, -130);+ await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);+ await page.locator('[aria-label="Assembly product tree"] .active-row').waitFor();+ await page.screenshot({ path: join(outputDirectory, "packaged-orbit-selection.png") });+ report.navigationAndSelection = true;+ await page.locator('input[type="file"]').setInputFiles(stepFile);+ await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();+ await page.getByText("Qualified: Import complete.", { exact: true }).waitFor({ timeout: 120000 });+ const downloadButton = page.getByRole("button", { name: "Download Canonical 242", exact: true });+ await downloadButton.waitFor({ timeout: 120000 });+ await page.waitForFunction(() => {+ const canvas = document.querySelector<HTMLCanvasElement>("canvas");+ return JSON.parse(canvas?.dataset.telosDisplay ?? "{}").meshSurfaces > 0;+ });+ report.meshFallback = JSON.parse(await canvas.getAttribute("data-telos-display") ?? "{}");+ await page.waitForFunction(() => !document.querySelector('[data-display-host="three-telos"][aria-busy="true"]'));+ await page.screenshot({ path: join(outputDirectory, "packaged-step-import.png") });+ assert(!before.equals(await canvas.screenshot()), "External STEP must replace the rendered sample");+ const session = await context.newCDPSession(page);+ await session.send("Browser.setDownloadBehavior", { behavior: "allow", downloadPath: outputDirectory, eventsEnabled: true });+ const downloadEvent = new Promise<string>((resolve) => session.once("Browser.downloadWillBegin", (event: { suggestedFilename: string }) => resolve(event.suggestedFilename)));+ await downloadButton.click();+ const name = await Promise.race([downloadEvent, new Promise<never>((_, reject) => setTimeout(() => reject(new Error("STEP download event missing")), 15000))]);+ const exportedPath = join(outputDirectory, name);+ for (let attempt = 0; ; attempt++) {+ try { assert((await readFile(exportedPath, "utf8")).startsWith("ISO-10303-21;")); break; }+ catch (error) { if (attempt > 60) throw error; await new Promise(resolve => setTimeout(resolve, 250)); }+ }+ report.exportedStep = exportedPath;+ await page.locator('input[type="file"]').setInputFiles(exportedPath);+ const reimportResponse = page.waitForResponse(response => response.request().method() === "POST" && response.url().includes("/import"), { timeout: 120000 });+ await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();+ assert((await reimportResponse).ok(), "Canonical STEP reimport must succeed");+ await page.getByText(/^(Qualified|Inspectable|Degraded): Import complete\./).waitFor({ timeout: 120000 });+ await page.waitForFunction(() => [...document.querySelectorAll<HTMLButtonElement>("button")].some(button => button.textContent?.trim() === "Download Canonical 242" && !button.disabled), undefined, { timeout: 120000 });+ assert(await downloadButton.isEnabled());+ report.canonicalStepReimport = true;+ // An invalid file must retain the last usable model and visible error.+ await page.locator('input[type="file"]').setInputFiles({ name: "invalid.step", mimeType: "application/step", buffer: Buffer.from("invalid STEP") });+ await page.getByRole("button", { name: "Import STEP 242", exact: true }).click();+ await page.getByText("Import failed", { exact: true }).waitFor();+ assert(await downloadButton.isEnabled());+ report.invalidFilePreservedModel = true;+ report.shaderUrls = shaders;+ report.requests = requests.filter(url => /^https?:/.test(url));+ assert((report.requests as string[]).every(url => new URL(url).origin === address), "Application resources must stay on its loopback origin");+ report.errors = errors;+ assert.equal(errors.length, 0, "No uncaught browser errors");+ await writeFile(join(outputDirectory, "page-text.txt"), await page.locator("body").innerText());+ }+ // Integration-test WM_CLOSE on the owning form, including a window hidden+ // by the CI launcher. CloseMainWindow excludes hidden windows. This exercises+ // FormClosed cleanup, but is not the required human title-bar interaction.+ if (process.env.CADMATA_QUALIFICATION_MANUAL_CLOSE === "1") {+ await writeFile(join(outputDirectory, "ready-for-native-close.json"), JSON.stringify({ pid: app.pid, address }));+ const closeDeadline = Date.now() + 120000;+ while (!closed && Date.now() < closeDeadline) await new Promise(resolve => setTimeout(resolve, 250));+ report.closeMethod = "native UI close by external qualification operator";+ } else {+ report.closeWindowCount = await nativeWindows(true);+ assert(Number(report.closeWindowCount) > 0, "Owning native window must receive WM_CLOSE");+ report.closeMethod = "automated native WM_CLOSE, not a human title-bar click";}for (let attempt = 0; !closed && attempt < 80; attempt++) await new Promise(resolve => setTimeout(resolve, 100));assert(closed, "Closing the window must terminate the application");@@ -220,6 +240,11 @@ $closedWindowCount}throw error;} finally {+ const logFile = (await readdir(logs).catch(() => [])).find(file => file.endsWith(`-${app.pid}.log`));+ if (logFile) {+ const nativeLog = (await readFile(join(logs, logFile), "utf8")).replace(/\/__cadmata\/session\/[A-Fa-f0-9]+/g, "/__cadmata/session/[redacted]");+ await writeFile(join(outputDirectory, "native-startup.log"), nativeLog);+ }await writeFile(join(outputDirectory, "qualification.json"), JSON.stringify(report, null, 2));if (browser) await browser.close().catch(() => {});if (!closed) app.kill();