diff --git a/scripts/kernel-test.sh b/scripts/kernel-test.sh index 256de380c1..4176c620fc 100755 --- a/scripts/kernel-test.sh +++ b/scripts/kernel-test.sh @@ -31,15 +31,11 @@ IMAGE="${IMAGE:-orcacad-deps}" # this fork at it makes the two silently trade build artefacts. docker-iter-build.sh had the # identical defect and was fixed to orcacad_buildcache; this script was missed. VOL="${BUILD_VOL:-orcacad_kerneltest}" -# ONE pre-existing failure is excluded by default (see [known-broken] in -# test_caddocument.cpp): it SIGABRTs inside the vendored solver and takes the -# whole process down, so without this exclusion a green run is simply unreachable and the -# suite stops after ~12 of 32 cases. It is also tagged [NotWorking], the ctest label the -# mainline fork's CI excludes, so it no longer reddens the Unit Tests job on every commit; -# it stays tracked as snaporca-tkz rather than as CI noise. The internal-thread case that -# used to sit alongside it is gone from this exclusion: its geometry was correct and the -# test's reference was wrong (snaporca-kzy), so it now runs like any other. -TAGS="${TAGS:-[CadDocument]~[known-broken]}" +# No exclusions. Both cases that used to be quarantined now run: the solver SIGABRT on +# circle-line tangency is fixed (snaporca-tkz), and the internal-thread case turned out to have +# correct geometry and a wrong reference in the test (snaporca-kzy). A green run here now means +# the whole CAD suite passed, not "everything except the two we gave up on". +TAGS="${TAGS:-[CadDocument]}" HOST="" while [[ $# -gt 0 ]]; do diff --git a/src/libslic3r/SketchSolver.cpp b/src/libslic3r/SketchSolver.cpp index 09666ea297..f13f02b371 100644 --- a/src/libslic3r/SketchSolver.cpp +++ b/src/libslic3r/SketchSolver.cpp @@ -236,9 +236,31 @@ static SketchSolveResult solve_impl(std::vector& entities, if (aCurve && bCurve) b.C(SLVS_C_CURVE_CURVE_TANGENT, 0, 0, 0, primOf(c.ea), primOf(c.eb)); else { - const Slvs_hEntity arc = aCurve ? primOf(c.ea) : primOf(c.eb); - const Slvs_hEntity line = aCurve ? primOf(c.eb) : primOf(c.ea); - b.C(SLVS_C_ARC_LINE_TANGENT, 0, 0, 0, arc, line); + const int ci = aCurve ? c.ea : c.eb; // the curve + const int li = aCurve ? c.eb : c.ea; // the line + if (valid(ci) && entities[ci].type == SketchEntity::Type::Circle) { + // A FULL circle cannot use SLVS_C_ARC_LINE_TANGENT. That constraint reads + // arc->point[1] / point[2] — the arc's endpoints (see constrainteq.cpp, + // Type::ARC_LINE_TANGENT) — and a circle entity only has point[0], its + // centre. The zero handles send FindById into "Cannot find handle", which + // ABORTS the process rather than failing the solve, taking every later test + // with it. It is also the wrong equation for a circle: it only makes the + // line perpendicular to the radius AT AN ENDPOINT that does not exist. + // + // For a circle, tangency is exactly "the centre sits one radius away from + // the line", which slvs expresses directly. + // + // ponytail: the radius is captured here rather than tied as a variable — + // the C API takes a constant distance and offers no way to reference the + // circle's radius parameter. Exact whenever the radius is fixed or simply + // not being changed by another constraint in the same solve; if some other + // constraint drives the radius, re-solving restores tangency. Tying them + // would need an auxiliary point constrained onto both circle and line. + b.C(SLVS_C_PT_LINE_DISTANCE, entities[ci].radius, + ptOf(ci, Role::Center), 0, primOf(li), 0); + } else { + b.C(SLVS_C_ARC_LINE_TANGENT, 0, 0, 0, primOf(ci), primOf(li)); + } } break; } diff --git a/tests/libslic3r/test_caddocument.cpp b/tests/libslic3r/test_caddocument.cpp index d2bbf2e144..21ee86e268 100644 --- a/tests/libslic3r/test_caddocument.cpp +++ b/tests/libslic3r/test_caddocument.cpp @@ -608,18 +608,12 @@ TEST_CASE("entity constraints: point-on-line positions a centre onto an axis", " } } -// [known-broken]: the "tangent line to circle" SECTION below aborts inside the vendored -// solver (slvs/dsc.h FindById, "Cannot find handle"). SIGABRT is fatal to the whole Catch2 -// process, so this one case takes the entire suite down with it and no later test runs. -// [known-broken] lets the delegated dev loop (scripts/kernel-test.sh) exclude it and still -// reach a green baseline. [NotWorking] is the ctest label the mainline-based fork's CI already -// excludes (run_unit_tests.sh passes -LE NotWorking, and catch_discover_tests registers Catch2 -// tags as ctest labels via ADD_TAGS_AS_LABELS) — so its Unit Tests job stops being red on every -// single commit, which was training everyone to ignore it and would have hidden the next real -// regression. The tag is inert on the Snapmaker fork, which has neither that runner nor -// catch_discover_tests; the two files are kept identical because they are ported wholesale -// between the forks. The bug stays visible in the tracker instead — see snaporca-tkz. -TEST_CASE("entity constraints: tangent/midpoint/symmetric/angle", "[CadDocument][known-broken][NotWorking]") +// The "tangent line to circle" SECTION used to abort the whole Catch2 process inside the +// vendored solver (slvs/dsc.h FindById, "Cannot find handle"), taking every later test with +// it, and was quarantined for it. Fixed in SketchSolver: a full circle can no longer be handed +// to SLVS_C_ARC_LINE_TANGENT, which dereferences arc endpoints a circle does not have. See +// snaporca-tkz. +TEST_CASE("entity constraints: tangent/midpoint/symmetric/angle", "[CadDocument][sketch]") { using R = SketchPointRole; using T = SketchConstraintType;