Verify frontend builder compose workflow

This commit is contained in:
eust-w 2026-06-24 12:11:16 +08:00
parent a72581a466
commit 1fe8938466
3 changed files with 81 additions and 5 deletions

View File

@ -150,8 +150,9 @@ desktop/mobile screenshots and an auditable
artifact hashes and git provenance. If `127.0.0.1:5173` is not already running,
it starts the Vite dev server for the duration of the check. It does not use
mock scene data: backend checks call the live MotrixSim bridge, and browser
checks load
`http://127.0.0.1:18090/manifest` by default. The browser gate also checks the
checks load `http://127.0.0.1:18090/manifest` by default. The browser gate also
clicks the Scene Builder `Physical Scene` control in an isolated browser
context to prove the product UI triggers backend `/compose`, then checks the
runtime diagnostics panel for manifest/state/control endpoints, external
simulation mode, object bindings, asset health, and control latency.

View File

@ -100,6 +100,8 @@ The product acceptance gate must pass with zero failures. It checks:
- Wuying SSH, remote Python, MotrixSim imports, running bridge, and health.
- Real backend `/compose` for the product G1 + store + primitive physical
scene.
- Frontend Scene Builder `Physical Scene` button triggering backend `/compose`
through the product UI.
- Real backend editing through `/control`, including shelf group pose sync.
- Desktop and mobile browser screenshots.
- Chinese default UI.
@ -142,7 +144,7 @@ The `git` field in both files is used to bind visual evidence to a code state:
Representative product gate baseline for the current thresholds:
- Result: `24 passed / 0 warned / 0 failed`
- Result: `26 passed / 0 warned / 0 failed`
- Frontend mode: `preview`
- Fail on warning: `true`
- Frontend URL:
@ -153,6 +155,9 @@ Representative product gate baseline for the current thresholds:
- Physical compose: `/compose` returned `objectCount=636`, `bodyCount=573`,
and `4/4` product-gate primitive bodies in inline manifest, fetched manifest,
and live state.
- Product UI compose: the Scene Builder `Physical Scene` workflow reaches
`后端物理组合场景`, keeps `4` builder props, exposes `/control`, and shows
`外部仿真 / 后端物理` diagnostics.
- Evidence manifest:
`test-results/product-readiness/product-readiness-evidence.json`.
This generated file is the source of truth for the latest report hash,
@ -187,6 +192,8 @@ Bundle evidence:
Control evidence:
- Compose endpoint: `710ms`, `4/4` composed object bodies synced.
- Scene Builder UI compose: representative run `47123ms` end to end with real
backend diagnostics.
- Composed object body edit: `252ms`.
- Shelf product member edit: `233ms`.
- Full shelf group edit: `951ms`, `151/151` bodies updated.
@ -261,6 +268,8 @@ Current supported product path:
- G1 + store + primitive blocks physical scene.
- Real backend physical composition through `/compose` for built-in primitive
objects.
- Product UI physical composition through the Scene Builder `Physical Scene`
control.
- Real backend pause/resume/reset/step.
- Real backend body pose editing while paused.
- Editable shelf/product groups with batched backend pose sync.
@ -287,6 +296,8 @@ Before calling a build acceptable for demo or review:
3. Desktop screenshot shows a nonblank real 3D scene.
4. The UI shows `外部仿真` and `后端物理`.
5. Pause/resume visible state latency is below `3000ms`.
6. `verify:real-backend` shows real `/compose`, composed object body sync, and
6. The browser gate shows the Scene Builder `Physical Scene` workflow reaches
backend physical composition.
7. `verify:real-backend` shows real `/compose`, composed object body sync, and
real shelf group pose sync.
7. Any new physical asset type has an explicit backend compose/export path.
8. Any new physical asset type has an explicit backend compose/export path.

View File

@ -382,6 +382,9 @@ async function readBrowserStats(page) {
controlStatus: text("#control-status"),
sourceLabel: text("#viewport-source-label"),
projectSource: text("#project-simulation-source"),
builderStatus: text("#builder-status"),
summaryProps: text("#summary-props"),
summaryPhysics: text("#summary-physics"),
manifest: text("#stat-manifest"),
objects: text("#stat-objects"),
bindings: text("#stat-bindings"),
@ -563,6 +566,41 @@ async function runAcceptanceReview(page) {
return { clickMs, elapsedMs: Math.round(performance.now() - started) };
}
async function runBuilderPhysicalCompose(page) {
const started = performance.now();
const clickMs = await clickButton(page, "#builder-load-physical");
await waitForProductScene(page);
await page.waitForFunction(([limits]) => {
const text = (selector) => document.querySelector(selector)?.textContent?.trim() ?? "";
const num = (selector) => Number((text(selector) ?? "0").match(/-?\d+(?:\.\d+)?/)?.[0] ?? "0");
const builderStatus = text("#builder-status");
const controlUrl = text("#diag-control-url");
const source = text("#diag-source");
const physics = text("#stat-physics");
const summaryProps = num("#summary-props");
const statusReady = /后端物理组合|physical backend composed/i.test(builderStatus)
&& !/组合中|composing/i.test(builderStatus);
return statusReady
&& summaryProps >= 4
&& controlUrl.includes("/control")
&& source.includes("外部仿真")
&& physics.includes("后端物理")
&& num("#stat-objects") >= limits.minObjects
&& num("#stat-bindings") >= limits.minBodyBindings
&& num("#stat-meshes") >= limits.minMeshes
&& num("#stat-pixels") > 0;
}, [thresholds], { polling: 100, timeout: thresholds.browserReadyMs });
const stats = await readBrowserStats(page);
return {
clickMs,
elapsedMs: Math.round(performance.now() - started),
builderStatus: stats.builderStatus,
summaryProps: stats.summaryProps,
physics: stats.physics,
diagnostics: stats.diagnostics,
};
}
async function waitForDom(page, predicate, arg) {
const started = performance.now();
try {
@ -666,6 +704,18 @@ async function verifyBrowser() {
await postControl("pause");
const browser = await chromium.launch({ headless: true });
try {
const builderContext = await browser.newContext({ viewport: { width: 1440, height: 820 }, deviceScaleFactor: 1 });
await builderContext.addInitScript(() => {
window.localStorage.removeItem("motrixsim-web-locale");
window.localStorage.removeItem("motrixsim-web-builder-draft");
});
const builderPage = await builderContext.newPage();
await builderPage.goto(frontendUrl.href, { waitUntil: "domcontentloaded" });
await waitForProductScene(builderPage);
const builderCompose = await runBuilderPhysicalCompose(builderPage);
await builderContext.close();
await postControl("pause");
const desktop = await browser.newPage({ viewport: { width: 1440, height: 820 }, deviceScaleFactor: 1 });
await desktop.addInitScript(() => window.localStorage.removeItem("motrixsim-web-locale"));
await desktop.goto(frontendUrl.href, { waitUntil: "domcontentloaded" });
@ -715,6 +765,19 @@ async function verifyBrowser() {
check("browser-no-fallbacks", fallbackCount === 0, `${fallbackCount} fallbacks`, fallbackCount === 0 ? undefined : "warn");
check("browser-external-sim-label", sourceLabel.includes("外部仿真") && !/RX3|GS/i.test(sourceLabel), sourceLabel);
check("browser-backend-physics-label", desktopStats.physics.includes("后端物理"), desktopStats.physics);
check(
"browser-builder-compose-ui",
/后端物理组合|physical backend composed/i.test(builderCompose.builderStatus)
&& numericText(builderCompose.summaryProps) >= 4,
`${builderCompose.elapsedMs}ms ${builderCompose.builderStatus}; props=${builderCompose.summaryProps}`,
);
check(
"browser-builder-compose-backend",
builderCompose.diagnostics.controlUrl.includes("/control")
&& builderCompose.diagnostics.source.includes("外部仿真")
&& builderCompose.physics.includes("后端物理"),
JSON.stringify(builderCompose.diagnostics),
);
check("browser-acceptance-panel", acceptancePassed, desktopStats.acceptanceScore);
check("browser-acceptance-telemetry", acceptanceTelemetryOk, `desktop ${desktopAcceptanceElapsed}ms / mobile ${mobileAcceptanceElapsed}ms`);
check(
@ -741,6 +804,7 @@ async function verifyBrowser() {
return {
desktop: desktopStats,
mobile: mobileStats,
builderCompose,
controlTimings: { resume: resumeControl, pause: pauseControl },
acceptanceTimings: { desktop: desktopAcceptance, mobile: mobileAcceptance },
paused,