5.0 KiB
Part cleanup gap completion
Date: 2026-09-17 (Asia/Shanghai)
Requirements: Part:desktop:Part_RefineShape, Part:desktop:Part_Defeaturing
Problem and Implementation
The legacy detached-BREP branch returned the original shape for both commands and labeled the operation successful. It now refuses that route and directs callers to the current-document cleanup workflow.
- Desktop reference:
freecad-source/src/Mod/Part/Gui/CommandSimple.cpp,CmdPartRefineShapeandCmdPartDefeaturing. - Refinement creates a native
Part::Refinewith itsSourcedependency by default, or a staticPart::Featureusing nativeTopoShape::removeSplitter. The linked result recomputes with its source. Static results remain independent. Source labels follow FreeCAD's duplicate-label policy; uniform display color is copied. - Defeaturing uses the desktop algorithm,
BRepAlgoAPI_Defeaturing, on selected native faces. It runs serially inside the synchronous WASM Worker to avoid nested worker-pool waits. Successful results are staticPart::Featureobjects, matching the desktop command. - Selections are checked before document mutation, repeated source/face selections are deduplicated, and sources are hidden only for successful parametric refinement or defeaturing.
- Unremovable features return explicit failed results. A batch with no successful removal preserves document/history without an empty undo entry. Mixed batches retain valid results and report per-source failures.
- Added current-document task controls for source/face selection, parametric refinement, read/cancel, history, native FCStd save/open, OPFS persistence, and geometry. Read/cancel preserve pending edits.
Files: PartCleanupDocument.h, DocumentProbe.cpp, PartDesktopCommands.cpp, part-document-facade.ts, part-desktop-adapter.ts, part-cleanup-task.tsx, and the workbench integration.
First Acceptance
Command: python3 tools/run_business_acceptance.py --module Part --ids Part:desktop:Part_RefineShape Part:desktop:Part_Defeaturing --reuse
Result: 2 requirements passed; 19 refinement and 22 defeaturing scenario records; 67.483 seconds.
The suite uses one shared DocumentProbe instance for both commands, one PartBox instance to prove rejection of the old placeholder paths, and one shared browser workflow. Existing compiled dependencies were reused. Only the affected DocumentProbe and PartBoxProbe targets were built. TypeScript checking, the production Vite build, and the changed native files' whitespace check passed.
Measured behaviors include:
- Coplanar refinement of adjacent blocks from 10 faces to 6 at volume 1000 mm3.
- Source-height changes updating the parametric result while the static refined copy remains at 1000 mm3.
- Through-hole removal restoring volume from approximately 874.336 mm3 to 1000 mm3 with 6 faces.
- Five-face boss removal reducing volume from 1048 mm3 to 1000 mm3.
- Unremovable and mixed-result batches; invalid, missing and foreign selections; direct native validation; isolation of another document; undo/redo; pending-edit preservation; FCStd and browser storage restoration.
The first attempt stopped at an overly strict test label expectation. App/DocumentObject.cpp applies FreeCAD's duplicate-label policy, yielding Joined blocks001; the assertion was corrected to accept the original label with the native numeric suffix. No geometry assertion was weakened. Both attempts remain recorded.
Visual Inspection
Playwright checked 1440x900 and 390x844 viewports, measured visible model pixels, verified camera rotation changes the canvas, and checked task overflow. Screenshots were also visually inspected.
Scope and Continuation
Snapshot: 197/1508 requirements declare executable coverage; 1311 remain uncovered. This is declared coverage, not a fresh-acceptance total. No historical IFC or other already-passed requirement was revalidated in this work.
The cases prove the documented geometric and document workflows. They do not certify arbitrary defeaturing success, remapping of imported per-face materials after topology reduction, or every desktop selection-container variant. Unsupported selections and impossible removals remain explicit failures rather than fabricated successes.
Keep prioritizeCoverageGaps and deferPreviouslyPassedValidation enabled. These two requirements now have first passing evidence and should not be rerun just to refresh fingerprints. The remaining full-project task is unfinished.
The scheduler was thawed after the shared-file changes and acceptance run. Cycle 9284 started with a live child process (407067), selecting Join Features, Projection on Surface, Section Cut, and Shape Info. The service was verified active and unfrozen.