diff --git a/SKILL.md b/SKILL.md index 6508f1d..0f7a6cc 100644 --- a/SKILL.md +++ b/SKILL.md @@ -44,6 +44,7 @@ Read only the branches needed for the current task: 2. Select the branch. - Use standard line extraction for architectural DWG/DXF plans. - Use `detect_sheet_frames.py` for multi-frame sheets. + - Treat detector clips as proposals. If two titles share the same clip, split the common sheet by title/wall clusters; the area and cross-floor gates must pass before modeling. - Model each building separately before campus assembly. - For multi-building/campus requests, write `scope_manifest.json` before modeling. Copy every requested building ID from the user/source inventory; never shrink scope to the easiest drawing set. - Use `--converter oda` plus `extract_3d_solids.py` for known 3DSOLID/ACIS drawings. @@ -65,7 +66,7 @@ Read only the branches needed for the current task: 5. Verify actual deliverables. - Require `verify_showcase.py --strict` and `verify_delivery.py` to pass. - Inspect at least one iso/front/side/plan render personally. - - For served Web output, use `cad_showcase.py run --web`; it starts a temporary local server, runs `web_smoke_test.mjs` at desktop and 390px widths, and feeds the report to final verification automatically. + - For served Web output, use `cad_showcase.py run --web`; it Draco-compresses Trimesh GLBs, starts a temporary local server, runs `web_smoke_test.mjs` at real 1440×900 and 390×844 viewports, and feeds the report to final verification automatically. - Confirm idle `window.__renders` does not grow, GLBs decode, variants exist, controls work, and console errors are zero. 6. Report confidence and limits. @@ -85,7 +86,7 @@ Do not hand over a model unless every applicable item has evidence: 7. Campus output has a `scope_manifest.json` containing every requested building. Every building and the site is `PASS`, with existing artifacts; a `BLOCKED` entry means the campus request is not complete. 8. Campus output has proven transforms, no unexplained overlap, numeric neighbour gaps, boundary containment, and a top-view placement image. 9. `verify_delivery.py` writes `evidence_manifest.json` with overall `PASS`; `BLOCKED`/`FAIL` must never be described as complete, and a human has looked at the render. -10. Served Web delivery includes a passing desktop/mobile browser smoke report. If Chromium cannot run, report `BLOCKED`; do not substitute the offline viewer for the requested Web template. +10. Served Web delivery includes a passing desktop/mobile browser smoke report whose viewport checks prove 1440×900 and 390×844. If Chromium cannot run, report `BLOCKED`; do not substitute the offline viewer for the requested Web template. 11. After any script/schema/template change, run: - `pytest tests/test_contracts.py tests/test_delivery.py` - `python3 tests/test_extraction_pipeline.py` diff --git a/references/multi_frame_tarch.md b/references/multi_frame_tarch.md index b62127a..bfc3caa 100644 --- a/references/multi_frame_tarch.md +++ b/references/multi_frame_tarch.md @@ -22,6 +22,8 @@ The detector: Pass every detector output config to audit with `--frames`. Account for every detected plan frame in extraction config or `discarded_frames` with a nonempty reason. +The detector emits sheet-level proposals. Two different plan titles can sit inside one title-block/frame INSERT and therefore receive the same broad clip (for example `一层平面图` plus `夹层平面图`, or `二层平面图` plus `十六层平面图`). Never duplicate that shared clip across floors. Split it at the wall-cluster gap between title positions, then recompute each floor offset. Use independent declared area/storey evidence to prove the split; a roughly 2× footprint is the characteristic failure signal. + ## Alignment Evidence Prefer structural-grid voting. TArch grids often live on `DOTE`, not `AXIS`. When through grids are absent, accept tick-grid voting. When no axes exist, use wall-profile correlation independently in X/Y. Use clip-corner anchoring only as a weak fallback. @@ -38,7 +40,7 @@ Set explicit `z`, `height`, and `floor_order`. The schema rejects floor-order ga ## Clip Risks -Title-block or refined clips can still swallow adjacent rows, details, legends, or revision tables. Investigate when a footprint dimension is 2-4x its siblings or contains distant sliver polygons. Tighten the clip band or use isolated-cluster filtering; do not simply raise noise thresholds until the artifact disappears. +Title-block or refined clips can still swallow adjacent rows, details, legends, or revision tables. Investigate when a footprint dimension is 2-4x its siblings, exceeds declared area, or contains distant sliver polygons. Tighten both X/Y clip bands or use evidence-backed isolated-cluster filtering; do not simply raise noise thresholds until the artifact disappears. Inspect the final browser screenshot too: repeated floating strips at every storey usually mean off-envelope plan symbols survived the clip. ## TArch Mapping Preset diff --git a/references/web_delivery.md b/references/web_delivery.md index 4e5d6c6..d12ddbd 100644 --- a/references/web_delivery.md +++ b/references/web_delivery.md @@ -18,6 +18,8 @@ Deliver three variants for Web/digital-twin presentation: Generate them with `build_showcase_variants.py` or `cad_showcase.py run`. Validate `variants_manifest.json` and every variant spec. Keep `source_file==site` floors intact across variants. +The Trimesh branch of `cad_showcase.py run` writes a retained `.raw.glb` and then runs `tools/compress.mjs` (weld, dedup, prune, Draco) to produce each delivered `.glb`. The Blender branch uses Blender's Draco export. `verify_showcase.py --strict` must see `draco=True` and every delivered variant within the size budget. + Both GLB backends consume versioned `building_spec.json`. They must preserve `__` names and glTF Y-up. `floor.caps` is canonical; exporters must not independently infer different cap groups. ## Served Viewer @@ -45,7 +47,7 @@ node scripts/web_smoke_test.mjs \ --screenshots-dir outputs//browser_smoke ``` -Install Playwright/Chromium first when needed. The script checks desktop/mobile control visibility, console/page/request failures, and idle render behavior. Feed the report to final verification with `--browser-report`. Supplying `--web-dir` makes the report mandatory: no report is `BLOCKED`, never PASS. +Install Playwright/Chromium first when needed. The script checks real 1440×900/390×844 viewport dimensions, desktop/mobile control visibility, console/page/request failures, and idle render behavior. Feed the report to final verification with `--browser-report`. Supplying `--web-dir` makes the report mandatory: no report is `BLOCKED`, never PASS. When an execution tool already has a `run_in_background` option, launch `python3 -m http.server ...` as the foreground command of that background process. Do not append shell `&`; the child server can die with the wrapper. Before presenting the viewer, probe the URL and keep that server process alive. Present the formal `web/index.html` URL when Web was requested; `viewer.html` is a separate offline fallback, not a substitute. diff --git a/scripts/cad_showcase.py b/scripts/cad_showcase.py index 12c55c4..72c7700 100644 --- a/scripts/cad_showcase.py +++ b/scripts/cad_showcase.py @@ -199,9 +199,12 @@ def wait_for_http(url: str, timeout: float = 20.0) -> None: def run_browser_smoke(pipeline: Pipeline, web_dir: Path, report: Path, screenshots: Path) -> None: """Serve the formal Web bundle and mechanically prove desktop/mobile loading.""" pipeline.run( - "browser_dependencies", + "node_dependencies", ["npm", "install", "--prefix", str(ROOT), "--ignore-scripts"], - [ROOT / "node_modules" / "playwright" / "package.json"], + [ + ROOT / "node_modules" / "playwright" / "package.json", + ROOT / "node_modules" / "@gltf-transform" / "core" / "package.json", + ], ) pipeline.run( "browser_runtime", @@ -295,6 +298,7 @@ def build_with_trimesh(pipeline: Pipeline, bundle: Path) -> list[Path]: for key in ("overview", "standard", "detail"): spec = bundle / "variant_specs" / f"{key}.json" out_dir = bundle / "variants" / key + raw_glb = out_dir / f"{key}.raw.glb" glb = out_dir / f"{key}.glb" metadata = out_dir / "model_metadata.json" pipeline.run( @@ -304,15 +308,20 @@ def build_with_trimesh(pipeline: Pipeline, bundle: Path) -> list[Path]: "--spec", str(spec), "--out", - str(glb), + str(raw_glb), "--metadata-out", str(metadata), "--name", key, ), - [glb, metadata], + [raw_glb, metadata], forbidden_stderr=("WARNING mesh_from_polygons",), ) + pipeline.run( + f"compress_{key}", + ["node", str(ROOT / "tools" / "compress.mjs"), str(raw_glb), str(glb)], + [glb], + ) glbs.append(glb) return glbs @@ -408,6 +417,14 @@ def run_pipeline(args: argparse.Namespace) -> int: variant_cmd.extend(["--blender", args.blender]) pipeline.run("variants", variant_cmd, [manifest, bundle / "variant_specs" / "standard.json"]) if args.backend == "trimesh": + pipeline.run( + "node_dependencies", + ["npm", "install", "--prefix", str(ROOT), "--ignore-scripts"], + [ + ROOT / "node_modules" / "playwright" / "package.json", + ROOT / "node_modules" / "@gltf-transform" / "core" / "package.json", + ], + ) glbs = build_with_trimesh(pipeline, bundle) else: glbs = [bundle / "variants" / key / f"{key}.glb" for key in ("overview", "standard", "detail")] diff --git a/scripts/web_smoke_test.mjs b/scripts/web_smoke_test.mjs index 0b0f4d2..e056de7 100644 --- a/scripts/web_smoke_test.mjs +++ b/scripts/web_smoke_test.mjs @@ -31,7 +31,7 @@ const failedRequests = []; const checks = []; async function inspect(viewport, name) { - const page = await browser.newPage({ viewportSize: viewport }); + const page = await browser.newPage({ viewport }); page.on("console", (message) => { if (message.type() === "error") consoleErrors.push(message.text()); }); @@ -39,6 +39,13 @@ async function inspect(viewport, name) { page.on("requestfailed", (request) => failedRequests.push(`${request.url()} ${request.failure()?.errorText || "failed"}`)); await page.goto(url, { waitUntil: "networkidle", timeout: 60000 }); await page.waitForSelector("#loading", { state: "hidden", timeout: 60000 }); + const actualViewport = await page.evaluate(() => ({ width: window.innerWidth, height: window.innerHeight })); + const viewportMatches = actualViewport.width === viewport.width && actualViewport.height === viewport.height; + checks.push({ + name: `${name}:viewport`, + status: viewportMatches ? "PASS" : "FAIL", + detail: `${actualViewport.width}x${actualViewport.height} expected ${viewport.width}x${viewport.height}`, + }); const selectors = ["#floor-controls", "#category-controls", "#explode", "#section", "#snapshot"]; for (const selector of selectors) { const visible = await page.locator(selector).isVisible(); diff --git a/tests/test_browser_smoke.py b/tests/test_browser_smoke.py index 5ebbf0f..f618074 100644 --- a/tests/test_browser_smoke.py +++ b/tests/test_browser_smoke.py @@ -78,7 +78,11 @@ def test_served_viewer_in_desktop_and_mobile(tmp_path: Path) -> None: capture_output=True, ) assert proc.returncode == 0, proc.stderr - assert json.loads(report.read_text(encoding="utf-8"))["status"] == "PASS" + result = json.loads(report.read_text(encoding="utf-8")) + assert result["status"] == "PASS" + checks = {item["name"]: item for item in result["checks"]} + assert checks["desktop:viewport"]["detail"] == "1440x900 expected 1440x900" + assert checks["mobile:viewport"]["detail"] == "390x844 expected 390x844" finally: server.terminate() server.wait(timeout=10)