# Ground truth — rest145 (v2) 394 real defects in 145 PRs. Generated from `rest145.json` — edit the JSON, bump `version`, regenerate. The rest of the benchmark (sets/rest145: every runnable v1.0 PR not in smoke10/dev10/holdout10/fresh10), 2026-09-28. Per PR: an expert hunt from the code (diff, base and head files, the whole repo at head) that also checked every AACR v1.0 reference comment as a lead; then an independent verifier re-checked every candidate against the code — the hunt's defects, every reference, and every comment posted by all three benchmarked reviewers (default, low, open-code-review 1.3.1; anonymised and shuffled, the reviewer key never shown) — merged duplicates, graded high/medium/low on consequence and recorded every rejection with its reason; then an adversarial critic per group of ~15 PRs spot-checked high-severity defects, exclusions, merges and grades against the code and fixed the truth in place. Claude agents throughout (a model family independent of the reviewer's). Extension (2026-09-28): every comment of four more benchmarked reviewers — Codex CLI 0.158.0, OpenCode 1.18.33, pi-review 0.18.0 and Claude Code 2.1.283 (Opus 5.5) — anonymised and shuffled, checked against the code by an independent verifier (matched to an existing defect, added as a new verified defect, or excluded with a restated reason); an adversarial critic per ~17 PRs checked every addition. Existing defects unchanged. ## FreeCAD__FreeCAD@a050e42 TechDraw refactor converting several unscoped enums/ints/strings to scoped enums: ArrowType and BalloonType become enum class; DrawViewDimension::RefType becomes enum class and getRefType()/getRefTypeSubElements return it; the int DimensionGeometryType alias in Gui/DimensionValidators is replaced by enum class DimensionGeometry across the validators, CommandCreateDims, and TaskDimRepair; new ProjDirection/RotationMotion/RotationDirection enums (DrawViewPart.h) replace the string arguments of rotate/spin/getDirsFromFront and the old ProjItemType enum; DrawProjGroup::rotate now delegates to the anchor's DrawViewPart::rotate; preference getters for arrow styles return ArrowType. ### D1 · high · bug — Vertical geometry is now classified as isHorizontal in all four validators, breaking vertical (DistanceY) dimensions While renaming TechDraw::isVertical to DimensionGeometry::isVertical, every `fabs(line.x) < FLT_EPSILON` branch was rewritten to return DimensionGeometry::isHorizontal instead of isVertical: isValidSingleEdge (DimensionValidators.cpp:391-392), isValidSingleEdge3d (:436-437), isValidVertexes (:638-639) and isValidVertexes3d (:676-677). No function returns isVertical any more. Consequences: the Vertical Dimension command (execDistanceY, CommandCreateDims.cpp:1726, accepting {isVertical, isDiagonal, isHybrid}) rejects a vertical edge or two vertically aligned vertices with 'Can not make 2D dimension from selection'; the Horizontal Dimension command (execDistanceX, :1678) now accepts a vertical edge / vertically aligned vertices and creates a meaningless zero-length horizontal dimension; mapGeometryTypeToDimType maps such geometry to DistanceX instead of DistanceY. - **Sites:** `src/Mod/TechDraw/Gui/DimensionValidators.cpp:391-392` (cause); `src/Mod/TechDraw/Gui/DimensionValidators.cpp:436-437` (cause); `src/Mod/TechDraw/Gui/DimensionValidators.cpp:638-639` (cause); `src/Mod/TechDraw/Gui/DimensionValidators.cpp:676-677` (cause); `src/Mod/TechDraw/Gui/CommandCreateDims.cpp:1726-1728` (symptom) - **Evidence:** head DimensionValidators.cpp:391 `} else if (fabs(line.x) < FLT_EPSILON) {` :392 `return DimensionGeometry::isHorizontal;` (base: `return TechDraw::isVertical;`); same pattern at :436-437, :638-639 (base `return isVertical;`), :676-677. `grep 'return DimensionGeometry::isVertical'` finds nothing. execDistanceY acceptable list {isVertical, isDiagonal, isHybrid}. - **Counts if:** Any comment flagging that the x≈0 branch returns isHorizontal instead of isVertical (at any of the four sites) counts. Dataset refs R11/R12/R13 point at three of the four sites. ### D2 · low · performance — DrawProjGroup::rotate now recomputes the anchor view twice per rotation DrawProjGroup::rotate (DrawProjGroup.cpp:1147-1151) now calls getAnchor()->rotate(), i.e. DrawViewPart::rotate, which ends with recompute() on the anchor (DrawViewPart.cpp:1294), and then updateSecondaryDirs(), which ends with recomputeChildren() calling recomputeFeature() on every item including the anchor (:946-957). The base implementation only set the anchor's Direction/XDirection before updateSecondaryDirs, so each rotate-button click now runs the anchor's (potentially expensive HLR) recompute an extra time. - **Sites:** `src/Mod/TechDraw/App/DrawProjGroup.cpp:1147-1151` (cause); `src/Mod/TechDraw/App/DrawViewPart.cpp:1292-1294` (other-site) - **Evidence:** DrawProjGroup.cpp:1149 `getAnchor()->rotate(rotationdirection);` ; DrawViewPart.cpp:1294 `recompute();` ; recomputeChildren loops Views incl. anchor with view->recomputeFeature(). - **Counts if:** Must note the delegation to DrawViewPart::rotate adds an extra anchor recompute (double recompute). Comments about the TODO (R3) do not count. Kept at low severity: DrawViewPart::rotate calls recompute() on the anchor and updateSecondaryDirs() then recomputeFeature()s every DPGI including the anchor; base only set properties before updateSecondaryDirs. ## FreeCAD__FreeCAD@eb761fd Replaces the boolean parameters of Part::Feature::getShape()/getTopoShape() (needSubElement, resolveLink, transform, noElementMap) with an `int options` bitmask (GetShapeOptions: NeedSubElement, ResolveLink, Transform, NoElementMap, DontSimplifyCompound), moving pmat/owner ahead of it. The single-subshape compound simplification is extracted into Feature::simplifyCompound(). About 25 call sites across Part, PartDesign, Measure, Import, Surface and TechDraw are rewritten. ProfileBased::getProfileShape() gains an options parameter, and Hole::execute() passes DontSimplifyCompound so a lone point is not collapsed when a hole is centered on points. ### D1 · high · bug — simplifyCompound lists TopAbs_SHELL twice and drops TopAbs_EDGE, so single-edge compounds are no longer reduced to their edge The new Feature::simplifyCompound (src/Mod/Part/App/PartFeature.cpp:1326-1343) iterates {SOLID, COMPSOLID, FACE, SHELL, SHELL, WIRE, VERTEX}; the replaced inline code checked SOLID, COMPSOLID, FACE, SHELL, EDGE, WIRE, VERTEX. With EDGE missing, getTopoShape(..., NeedSubElement) on a sub-object that resolves to a compound holding one edge now returns the whole compound (an open edge has no wire and two vertices), and for a single closed edge (one vertex) it returns that VERTEX instead of the edge. Edge-expecting callers (extrusion/revolution axis links, blend curves, sweep/ruled-surface edge checks) then reject the shape or use the wrong geometry. It runs on every NeedSubElement call unless DontSimplifyCompound is set. - **Sites:** `src/Mod/Part/App/PartFeature.cpp:1326-1343` (cause); `src/Mod/Part/App/PartFeature.cpp:1306-1308` (other-site) - **Evidence:** head PartFeature.cpp:1328-1335 `std::array simplificationPriority = { TopAbs_SOLID, TopAbs_COMPSOLID, TopAbs_FACE, TopAbs_SHELL, TopAbs_SHELL, TopAbs_WIRE, TopAbs_VERTEX};`; the deleted base code had `else if (shape.countSubShapes(TopAbs_EDGE) == 1) shape = shape.getSubTopoShape(TopAbs_EDGE, 1);` between SHELL and WIRE. - **Counts if:** Must identify the duplicated SHELL / missing EDGE in the simplification list, or equivalently that single-edge compounds are no longer simplified to the edge. Comments only about initializer_list/find_if/renaming (R9, R11) or about consolidating with TopoShapeExpansion (C8) do not count. ### D2 · low · bug — Part RuledSurface command assigns the first selected sub-element to curve2 instead of curve1, so curve1 is never set for sub-element selections In CmdPartRuledSurface::activated (src/Mod/Part/Gui/Command.cpp:1973-1982) the rewrite changed `curve1 = getTopoShape(docobj1, subnames1[0]...)` into `curve2 = ...`, so curve1 is only set when subnames1 is empty (line 1995) and, for two sub-elements of one object, curve2 is written twice. The practical effect is small: `ok` starts true (line 1951) and the edge/wire check at 2026-2031 can only set ok=true, never false, so the command still creates the RuledSurface from link1/link2/obj1/obj2 (2041-2045), which are set correctly. What is lost is the (already weak) shape-type check: it can no longer confirm the first curve, e.g. to re-enable ok after a null whole-object shape. A clear copy/paste slip that leaves curve1 dead for sub-element selections. - **Sites:** `src/Mod/Part/Gui/Command.cpp:1974-1980` (cause); `src/Mod/Part/Gui/Command.cpp:2026-2031` (symptom) - **Evidence:** head Command.cpp:1973-1974 `if (!subnames1.empty()) { curve2 = Part::Feature::getTopoShape(docobj1, subnames1[0].c_str(), ...` vs base `curve1 = Part::Feature::getTopoShape(docobj1, subnames1[0].c_str(), true /*need element*/).getShape();`; :1951 `bool ok = true;`; :2026-2031 `if (!curve1.IsNull() && !curve2.IsNull()) { if (...EDGE/WIRE...) { ok = true; } }` (never sets false); :2041-2045 Curve1/Curve2 built from obj1/link1, obj2/link2. - **Counts if:** Must say the first sub-element result is assigned to curve2 instead of curve1 (curve1 left unset). Graded low: because the validation block never sets ok=false, the command still runs with the correct links; claims that it now always rejects the selection overstate the effect but still identify the defect. ### D3 · medium · bug — Selected up-to faces now lose their element map: getTopoShape was swapped for getShape, which forces NoElementMap In ProfileBased::getUpToShapeFromLinkSubList (src/Mod/PartDesign/App/FeatureSketchBased.cpp:730-736) the per-subelement call was changed from getTopoShape(ref, sub, true) to Part::Feature::getShape(...). getShape (PartFeature.cpp:855-858) always ORs in NoElementMap and returns a raw TopoDS_Shape, which is then wrapped in a fresh TopoShape and passed to makeElementFace(). The selected face's element map, Tag and Hasher are discarded, so the up-to face built for Pad/Pocket 'up to shape' with explicit face selections no longer carries mapped names into the feature result, unlike the neighbouring whole-object branch (714-720) which still uses getTopoShape. This silently degrades toponaming for that path; nothing in the PR's intent calls for it. - **Sites:** `src/Mod/PartDesign/App/FeatureSketchBased.cpp:730-738` (cause); `src/Mod/Part/App/PartFeature.cpp:855-858` (other-site) - **Evidence:** head FeatureSketchBased.cpp:730 `auto shape = Part::Feature::getShape(ref, subString.c_str(), nullptr, nullptr, NeedSubElement | ResolveLink | Transform);` then :737-738 `TopoShape face = shape; face = face.makeElementFace();`; base `auto shape = Part::Feature::getTopoShape(ref, subString.c_str(), true);`; PartFeature.cpp:858 `return getTopoShape(obj,subname, pmat,powner, options | NoElementMap).getShape();`. - **Counts if:** Must say the switch to getShape at the selected-face up-to-shape site drops the element map / topological naming. A comment that merely asks about the getShape/getTopoShape difference elsewhere does not count. ### D4 · low · maintainability — getShape/getTopoShape doc comment still documents the removed bool parameters and says nothing about `options` PartFeature.h:123-142 still describes `@param needSubElement`, `@param resolveLink` and `@param transform` as separate parameters directly above signatures that now take `(obj, subname, pmat, owner, int options)` (143-150). The options bitmask, its flags (including DontSimplifyCompound) and the defaults are undocumented, and the comment misdescribes the argument order every caller must get right. - **Sites:** `src/Mod/Part/App/PartFeature.h:123-150` (cause) - **Evidence:** PartFeature.h:128 ` * @param needSubElement: whether to ignore the non-object subelement`, :137 `@param resolveLink`, :140 `@param transform`, followed by :143-145 `static TopoDS_Shape getShape(const App::DocumentObject *obj, const char *subname=nullptr, Base::Matrix4D *pmat=nullptr, App::DocumentObject **owner=nullptr, int options = ResolveLink | Transform);` - **Counts if:** Must point at the stale parameter documentation of getShape/getTopoShape. Suggestions to reorder parameters or use a strongly typed enum (R12, R13) do not count. ## FreeCAD__FreeCAD@82fef4a ParameterManager::LoadDocument(InputSource&) in src/Base/Parameter.cpp now owns the XercesDOMParser and DOMTreeErrorReporter through std::unique_ptr instead of raw new/delete, installs a new NoOpEntityResolver (returns nullptr for every entity) alongside the existing setDisableDefaultEntityResolution(true), replaces std::endl with "\n" in the three parse-error messages, and fixes the errorsOccured typo. PreCompiled.h gains the EntityResolver include. ### D1 · low · maintainability — NoOpEntityResolver's 'Block all external entity resolution' comment is false: returning nullptr falls back to default resolution The new NoOpEntityResolver::resolveEntity (src/Base/Parameter.cpp:1863-1870) returns nullptr with the comment 'Block all external entity resolution', and the PR presents the resolver as what 'completely block[s]' entity resolution. In Xerces-C, an EntityResolver returning a null InputSource means 'no custom source — use the parser's default resolution'; the only thing actually preventing external entity loading is the pre-existing parser->setDisableDefaultEntityResolution(true) at :1886. The resolver adds no protection, and the comment credits it with the safeguard, inviting a future maintainer to drop the real setting and reintroduce XXE. - **Sites:** `src/Base/Parameter.cpp:1866-1869` (cause); `src/Base/Parameter.cpp:1886-1887` (other-site) - **Evidence:** Parameter.cpp:1868 `return nullptr; // Block all external entity resolution`; :1886 `parser->setDisableDefaultEntityResolution(true);` (pre-existing); Xerces EntityResolver contract: a null return lets the parser open the entity itself unless default resolution is disabled. - **Counts if:** Must say the null-returning resolver does not itself block entities (null = default resolution) and the comment/stated purpose is misleading, the real safeguard being setDisableDefaultEntityResolution. Tests-only requests (C3) do not count. ## FreeCAD__FreeCAD@ec3da2e TechDraw refactor that moves the three predicates isCosmeticVertex / isCosmeticEdge / isCenterLine out of DrawUtil (static helpers taking an owner DocumentObject*) into DrawViewPart. The DrawUtil definitions and declarations are deleted, new definitions are added to DrawViewPart.cpp as one-argument member functions, and declarations are added to DrawViewPart.h. ### D1 · high · build — DrawViewPart.h declares static two-argument functions but DrawViewPart.cpp defines one-argument non-static members, so TechDraw does not compile DrawViewPart.h:242-244 declares `static bool isCosmeticVertex(App::DocumentObject* owner, std::string element);` (and the same for isCosmeticEdge / isCenterLine). DrawViewPart.cpp:1502, 1513 and 1523 define `bool DrawViewPart::isCosmeticVertex(std::string element)` and the other two as one-argument members that call getProjVertexByIndex/getEdge on `this`. No declaration in the class matches these out-of-class definitions, so the compiler reports 'no declaration matches' / 'member function not declared', and the TechDraw App library fails to build. Even if the header were fixed to make them static, the bodies use `this`. - **Sites:** `src/Mod/TechDraw/App/DrawViewPart.h:242-244` (cause); `src/Mod/TechDraw/App/DrawViewPart.cpp:1502-1530` (symptom) - **Evidence:** DrawViewPart.h:242 `static bool isCosmeticVertex(App::DocumentObject* owner, std::string element);` vs DrawViewPart.cpp:1502 `bool DrawViewPart::isCosmeticVertex(std::string element)` and 1505 `auto vertex = getProjVertexByIndex(vertexIndex);`, which is an implicit this-> call. - **Counts if:** The comment must point out the mismatch between the header declaration (static, owner parameter) and the cpp definition (non-static, one parameter), or say the definitions don't match any declaration. Just saying 'the refactor might not compile' without naming the signature mismatch does not count. ### D2 · high · build — CosmeticExtension.cpp still calls the deleted DrawUtil::isCosmeticVertex/isCosmeticEdge/isCenterLine, so the build breaks The PR removes DrawUtil::isCosmeticVertex, isCosmeticEdge and isCenterLine from DrawUtil.h and DrawUtil.cpp (base DrawUtil.h:252-254). CosmeticExtension::deleteCosmeticElements still calls `DU::isCosmeticVertex(getOwner(), name)`, `DU::isCosmeticEdge(getOwner(), name)` and `DU::isCenterLine(getOwner(), name)` at CosmeticExtension.cpp:71, 77 and 78 (a file the PR does not touch). DU is DrawUtil, so these are now undeclared identifiers and compilation fails. The caller should have moved to getOwner()->isCosmeticVertex(name) and so on. - **Sites:** `src/Mod/TechDraw/App/CosmeticExtension.cpp:70-78` (symptom); `src/Mod/TechDraw/App/DrawUtil.h:249-251` (cause) - **Evidence:** git grep at head: CosmeticExtension.cpp:71 `DU::isCosmeticVertex(getOwner(), name)`, :77 `DU::isCosmeticEdge(getOwner(), name) ||`, :78 `DU::isCenterLine(getOwner(), name)`. No DrawUtil declaration of these remains at head. - **Counts if:** The comment must name the unchanged caller in CosmeticExtension (or say that the remaining DU:: call sites were not migrated). The DrawUtil.h line numbers are base-side for the deleted declarations. Distinct from D1, the header/cpp mismatch. C7 also mentions the declaration/definition mismatch in passing, but it leads with the unmigrated CosmeticExtension callers, so it is credited here. ## FreeCAD__FreeCAD@a440ff7 A spelling/grammar sweep across 105 files done with sed and reviewed by hand: 'allow(s) to X' becomes 'allow(s) one to X' (or a gerund), "let's you" becomes 'lets you', 'segements' becomes 'segments'. Nearly all changes are comments/docstrings; a few user-visible strings change (a salomesmesh error message, FEM Netgen property tooltips, labels in several .ui files, and the matching / entries in two CAM .ts files). No code logic changes. No defects. ## FreeCAD__FreeCAD@f8cd643 Pure UI-string consistency pass over the ReverseEngineering workbench: menu texts become Title Case with a Unicode ellipsis, tooltips switch to third-person verbs, 'Please select…' warnings drop 'Please', .ui dialog titles/labels are re-cased, the 'Surface reconstruction' submenu becomes 'Surface Reconstruction', and two console log lines plus one exception message are reworded. No logic changes. No defects. ## FreeCAD__FreeCAD@290bdc7 A set of small Coverity-driven fixes: updateLinkSubs no longer std::forwards its arguments repeatedly inside a loop; PropertyEnumeration::getPyPathValue returns false when the enumeration's maxValue() is negative; the Python workbench manipulator refuses to remove the menubar/toolbar root item itself; and TechDraw's WalkerEdge gets a constructor and in-class initializers for its members. ### D1 · low · bug — Empty PropertyEnumeration's .Enum/.All path now fails instead of returning an empty tuple Enumeration::maxValue() returns -1 for an enumeration with no entries (src/App/Enumeration.cpp:260-267), so the old `Py::Tuple res(_enum.maxValue() + 1)` built a valid empty tuple. The new guard in PropertyEnumeration::getPyPathValue (src/App/PropertyStandard.cpp:604-607) returns false for exactly that case. Callers then diverge: getPathValue (PropertyStandard.cpp:581-589) ignores the bool and converts the untouched default Py::Object (None) instead of an empty tuple, and ObjectIdentifier::getPyValue (ObjectIdentifier.cpp:1976-1985) falls through to generic attribute access, which fails for `.Enum`/`.All`. So expressions/bindings reading `Prop.Enum` or `Prop.All` of a not-yet-populated enumeration change from `()` to None/an error. The Coverity 'negative size' concern was only real for values below -1, which maxValue cannot return. - **Sites:** `src/App/PropertyStandard.cpp:604-608` (cause); `src/App/PropertyStandard.cpp:581-589` (symptom) - **Evidence:** Enumeration.cpp:262-266 `int num = -1; if (!enumArray.empty()) num = size-1; return num;`; head PropertyStandard.cpp `if (maxEnumValue < 0) { return false; }`; getPathValue: `Py::Object res; getPyPathValue(path, res); return pyObjectToAny(res, false);`. - **Counts if:** Must point out that maxValue() is -1 for an empty enumeration (a legitimate state that previously produced an empty tuple) and that the new early return changes that result. A const-correctness remark (R1) does not count. ### D2 · low · incomplete-fix — Toolbar-root guard sits in an unreachable branch; the path that can actually delete the root toolbar is left unguarded (incomplete Coverity 513838 fix) The new `if (item == toolBar) return;` (src/Gui/WorkbenchManipulatorPython.cpp:317-320) is inside the else branch that searches `it->findItem(command)` for each child `it`; ToolBarItem::findItem (src/Gui/ToolBarManager.cpp:84-97) returns `it` itself or one of its direct children, never the root `toolBar`, so the guard can never fire. The root can only be matched by the preceding `toolBar->findItem(command)` (WorkbenchManipulatorPython.cpp:310-313), which returns `this` when the root's own name equals the command (the root ToolBarItem is created with an empty command) and then runs `toolBar->removeItem(item); delete item;` — deleting the caller-owned root and leaving a dangling pointer. The fix protects the wrong branch and leaves the case it was meant to close open. - **Sites:** `src/Gui/WorkbenchManipulatorPython.cpp:310-313` (cause); `src/Gui/WorkbenchManipulatorPython.cpp:317-320` (other-site) - **Evidence:** ToolBarManager.cpp:84-88 `ToolBarItem* ToolBarItem::findItem(const std::string& name) { if ( _name == name ) { return this; } ...`; WorkbenchManipulatorPython.cpp:310-313 `if (ToolBarItem* item = toolBar->findItem(command)) { toolBar->removeItem(item); delete item; }` with no root check; the new guard at 317 compares a result of `it->findItem` (it = child of toolBar) against toolBar. - **Counts if:** Must say the item==toolBar guard is in the wrong/unreachable branch and the first `toolBar->findItem(command)` branch can still delete the root. A comment saying only that the guard is dead code and should be removed (without noting the root is still deletable) is a near-miss; the menubar guard (C6/C8) is a different site and is reachable. ## FreeCAD__FreeCAD@870d7f5 Adds ModelManagerExternal, an LRU-cached front for the Python external materials interface built under BUILD_MATERIAL_EXTERNAL, and wires it into ModelManager behind a 'UseExternal' preference watched through a ParameterGrp observer. External libraries and models take precedence over local ones, and migrate/validate/hit-rate helpers are added. ModelLibrary is split into a base ModelLibrary (with an isLocal flag) and ModelLibraryLocal, which owns the path map and addModel/getModelByPath; the loader and local manager switch to ModelLibraryLocal. ModelLibrary::getModelTree is rebuilt from ModelManager::libraryModels() (uuid, directory, name) instead of the library's own path map. Library gains a copy constructor. ### D1 · medium · bug — With UseExternal on and the external interface unavailable, ModelManager::libraryModels lets ConnectionError escape, so building any library's model tree fails ModelManager::libraryModels (src/Mod/Material/App/ModelManager.cpp:205-221) calls _externalManager->libraryModels when _useExternal is set and catches only LibraryNotFound and InvalidModel. ModelManagerExternal::libraryModels (src/Mod/Material/App/ModelManagerExternal.cpp:115-118) forwards straight to ExternalManager::libraryModels, whose connect() throws ConnectionError whenever the external module is not configured ('Current' defaults to 'None') or fails to instantiate (ExternalManager.cpp:136-145, 453). That ConnectionError is not caught, so instead of falling back to the local models it escapes through ModelLibrary::getModelTree (src/Mod/Material/App/ModelLibrary.cpp:75) into ModelSelect::fillTree. Every library tree in the model selector fails whenever a user turns UseExternal on without a reachable interface. The sibling paths show what was intended: getLibraries and getModel in ModelManagerExternal do catch ConnectionError (src/Mod/Material/App/ModelManagerExternal.cpp:86, 141). - **Sites:** `src/Mod/Material/App/ModelManager.cpp:205-221` (cause); `src/Mod/Material/App/ModelManagerExternal.cpp:115-118` (cause); `src/Mod/Material/App/ModelLibrary.cpp:75-75` (symptom) - **Evidence:** src/Mod/Material/App/ModelManager.cpp:210-219: `auto models = _externalManager->libraryModels(libraryName); ... catch (const LibraryNotFound& e) {} catch (const InvalidModel& e) {}`. ExternalManager.cpp:136-143 `if (!_instantiated) { instantiate(); if (!_instantiated) { throw ConnectionError(); } }`, and ExternalManager::libraryModels calls connect() first (line 453). getModelTree (src/Mod/Material/App/ModelLibrary.cpp:75) is reached for every library by Gui/ModelSelect.cpp:342-349 fillTree, which has no try/catch. - **Counts if:** A finding must say that ConnectionError (or 'other exceptions from the external manager') is not handled in ModelManager::libraryModels / the external libraryModels path, so the local fallback does not happen. Generic 'empty catch blocks should log' comments (R28) do not count. ### D2 · low · bug — Models at a library's root now sit under a folder with an empty name in the rebuilt model tree getModelTree now splits the model's directory (the second tuple element, model->getDirectory()) on '/' (src/Mod/Material/App/ModelLibrary.cpp:83) and then adds the model under that folder chain (src/Mod/Material/App/ModelLibrary.cpp:104). For a model file at the library root, addModel sets the directory to getLibraryPath('Foo.yml', 'Foo.yml') == '' (Library.cpp getLibraryPath; ModelLibrary.cpp addModel). QString('').split('/') returns [''] (KeepEmptyParts), so the loop creates a folder node keyed '' and puts the model inside it. Before this PR the relative file name was split, so a root-level model became a direct leaf. In a User or Custom model library, root-level models therefore show up under an unnamed folder in ModelSelect. - **Sites:** `src/Mod/Material/App/ModelLibrary.cpp:83-104` (cause) - **Evidence:** src/Mod/Material/App/ModelLibrary.cpp:78 `auto path = std::get<1>(it);` :83 `QStringList list = path.split(QStringLiteral("/"));` (no SkipEmptyParts), :86-97 create a folder for each element, :104 `(*node)[filename] = child;`. ModelManagerLocal.cpp:166-168 builds the tuple from `it.second->getDirectory()`. Library.cpp getLibraryPath strips the filename, returning '' for a root file. - **Counts if:** Counts if a comment points out that splitting an empty/leading/trailing-slash path produces empty segments and hence empty folder nodes (R7's SkipEmptyParts suggestion lands on this). A pure style comment about the split does not count. C12/C22/C46 state it directly (empty directory -> empty-name folder). ### D3 · low · maintainability — ModelManagerLocal::getLibraries reinterpret_casts shared_ptr>> to shared_ptr>>, which is undefined behaviour Once _libraryList becomes a list of shared_ptr, getLibraries (src/Mod/Material/App/ModelManagerLocal.cpp:99-103) returns it by reinterpret_cast to a reference to a different, unrelated template instantiation. That is a strict-aliasing violation and undefined behaviour. It only 'works' because ModelLibrary is the first, non-virtual base, so the pointers happen to coincide. The returned list also claims to hold ModelLibrary: any caller that inserts a non-local ModelLibrary into it corrupts the local manager's list, which is later static_cast to ModelLibraryLocal. - **Sites:** `src/Mod/Material/App/ModelManagerLocal.cpp:99-103` (cause) - **Evidence:** src/Mod/Material/App/ModelManagerLocal.cpp:101 `return reinterpret_cast>>&>(_libraryList);` with ModelManagerLocal.h:80 `static std::shared_ptr>> _libraryList;`. - **Counts if:** Must name the reinterpret_cast between the two list types as unsafe/UB, or say a proper copy/conversion is needed. R32's generic 'prefer polymorphism' design remark does not identify the cast and does not count. ### D4 · low · bug — validateMigration dereferences a null external model when a migrated model is missing, crashing instead of reporting a validation failure ModelManagerExternal::getModel swallows ModelNotFound and ConnectionError and returns nullptr (src/Mod/Material/App/ModelManagerExternal.cpp:137-144). ModelManager::validateMigration passes that result straight to model->validate(externalModel) (src/Mod/Material/App/ModelManager.cpp:353-354), and Model::validate dereferences it immediately (`*(other->_library)`, Model.cpp:208). Exactly the case the validation exists to catch, a model that did not reach the external store, becomes a null-pointer crash rather than an InvalidModel. - **Sites:** `src/Mod/Material/App/ModelManager.cpp:353-354` (cause); `src/Mod/Material/App/ModelManagerExternal.cpp:137-144` (other-site) - **Evidence:** src/Mod/Material/App/ModelManager.cpp:353-354 `auto externalModel = _externalManager->getModel(uuid); model->validate(externalModel);`. src/Mod/Material/App/ModelManagerExternal.cpp:137-140 `catch (const ModelNotFound& e) { _cache.emplace(uuid.toStdString(), nullptr); return nullptr; }`. Model.cpp:205-208 `void Model::validate(const std::shared_ptr& other) const { ... _library->validate(*(other->_library));`. - **Counts if:** Needs the null result of the external getModel reaching validate() in validateMigration. R30 (null check on the `model` parameter of addModel/migrateModel) is a different site and does not count. There are no in-tree callers yet (the API is being laid down for the migration tooling), hence low. ### D5 · low · bug — ModelManager::getLibrary's local fallback is unreachable with UseExternal on: the external getLibrary throws LibraryNotFound instead of returning null ModelManager::getLibrary (src/Mod/Material/App/ModelManager.cpp:168-179) calls _externalManager->getLibrary(name) and falls back to _localManager->getLibrary only if the result is null. ModelManagerExternal::getLibrary (src/Mod/Material/App/ModelManagerExternal.cpp:92-105) never returns null: it rethrows LibraryNotFound and maps ConnectionError to LibraryNotFound (ExternalManager::getLibrary raises CreationError on a Python error, which also escapes). So with UseExternal on, looking up any local-only library (e.g. User, workbench libraries) or any library while the provider is unreachable throws, whereas before this PR getLibrary was local-only and succeeded. - **Sites:** `src/Mod/Material/App/ModelManager.cpp:170-178` (cause); `src/Mod/Material/App/ModelManagerExternal.cpp:92-105` (other-site) - **Evidence:** ModelManager.cpp:172-175 `auto library = _externalManager->getLibrary(name); if (library) { return library; }` with no try/catch; ModelManagerExternal.cpp:99-104 `catch (const LibraryNotFound& e) { throw LibraryNotFound(e); } catch (const ConnectionError& e) { throw LibraryNotFound(e.what()); }`. Base ModelManager.cpp:161-164 was `return _localManager->getLibrary(name);`. isLocalLibrary (ModelManager.cpp:228-235) shows the intended try/catch shape. No in-tree caller of ModelManager::getLibrary was found, hence low. - **Counts if:** Must say the external getLibrary throws (LibraryNotFound) rather than returning null, so the null check/local fallback never runs. Comments about precedence of same-named libraries do not count. ### D6 · low · bug — A transient ConnectionError is cached as a permanent 'model missing' (nullptr) in the external model cache ModelManagerExternal::getModel (src/Mod/Material/App/ModelManagerExternal.cpp:141-144) stores nullptr in the process-wide LRU cache when the provider raises ConnectionError, and line 128-129 returns any cached entry without retrying. After the outage ends, the UUID keeps resolving to null from the external source (ModelManager::getModel then falls back to local, or throws ModelNotFound for external-only models) until LRU eviction; nothing in normal operation clears the cache (resetCache is reached only via ModelManagerExternal::refresh, which ModelManager::refresh does not call). - **Sites:** `src/Mod/Material/App/ModelManagerExternal.cpp:128-144` (cause) - **Evidence:** ModelManagerExternal.cpp:128-130 `if (_cache.contains(uuid.toStdString())) { return _cache.lookup(uuid.toStdString()); }`; :141-143 `catch (const ConnectionError& e) { _cache.emplace(uuid.toStdString(), nullptr); return nullptr; }`. grep: resetCache is called only from ModelManagerExternal::refresh (line 65). - **Counts if:** Must say the connection-failure branch caches null (negative caching of a transient error) so later lookups don't retry. A comment only asking to log the error does not count. ### D7 · low · incomplete-fix — ModelManager::refresh refreshes only the local manager; the new external cache is never invalidated The PR adds ModelManagerExternal::refresh (src/Mod/Material/App/ModelManagerExternal.cpp:63-66, clears the LRU cache) but ModelManager::refresh (src/Mod/Material/App/ModelManager.cpp:119-122) still only calls _localManager->refresh(). With UseExternal on, a public refresh leaves stale external models (and cached nulls) in place; the external refresh is dead code. - **Sites:** `src/Mod/Material/App/ModelManager.cpp:119-122` (cause); `src/Mod/Material/App/ModelManagerExternal.cpp:63-66` (other-site) - **Evidence:** ModelManager.cpp:121 `_localManager->refresh();` only; grep shows no caller of ModelManagerExternal::refresh or resetCache. OnChange (ModelManager.cpp:100) even has `// _dbManager->refresh();` commented out. - **Counts if:** Must say ModelManager::refresh should also refresh/clear the external manager/cache. ### D8 · low · bug — External model-library discovery uses libraries() instead of modelLibraries(), so material-only libraries appear in the model selector ModelManagerExternal::getLibraries (src/Mod/Material/App/ModelManagerExternal.cpp:78) calls ExternalManager::libraries(), which the external API documents as returning all libraries; modelLibraries() exists precisely to return only libraries containing models (MaterialAPI/MaterialManagerExternal.py modelLibraries docstring; ExternalManager::modelLibraries). ModelManager::getLibraries feeds ModelSelect, so libraries with no models are offered as model libraries. - **Sites:** `src/Mod/Material/App/ModelManagerExternal.cpp:78-78` (cause) - **Evidence:** ModelManagerExternal.cpp:78 `auto externalLibraries = ExternalManager::getManager()->libraries();`. MaterialManagerExternal.py: `def modelLibraries(self)` ... 'This differs from the libraries() function in that it only returns libraries containing model objects.' - **Counts if:** Must name libraries() vs modelLibraries() (or 'material-only libraries listed as model libraries'). ### D9 · low · maintainability — ModelManager::cleanup returns before the new external cleanup block, making it unreachable src/Mod/Material/App/ModelManager.cpp:111 `return ModelManagerLocal::cleanup();` precedes the newly added `#if defined(BUILD_MATERIAL_EXTERNAL) if (_externalManager) _externalManager->cleanup();` block (lines 112-116), so the external cleanup never runs. ModelManagerExternal::cleanup is empty today, so there is no runtime effect yet, but the added code is dead and will silently not run once cleanup gains content. - **Sites:** `src/Mod/Material/App/ModelManager.cpp:109-117` (cause) - **Evidence:** ModelManager.cpp:111-116 as quoted; ModelManagerExternal.cpp:59-61 `void ModelManagerExternal::cleanup() {}`. - **Counts if:** Must point out the early return making the external cleanup unreachable. ### D10 · low · bug — getModelTree aborts the whole library tree when one listed external model cannot be fetched ModelLibrary::getModelTree (src/Mod/Material/App/ModelLibrary.cpp:75-82) calls ModelManager::getModel for each UUID the (external) library lists. If ModelManagerExternal::getModel returns null (ModelNotFound or a cached ConnectionError, ModelManagerExternal.cpp:137-144), ModelManager::getModel falls back to _localManager->getModel, which throws ModelNotFound for an external-only UUID (ModelManagerLocal.cpp:184-185). Nothing in getModelTree or ModelSelect::fillTree catches it, so one unavailable entry prevents the entire library's tree from being built. - **Sites:** `src/Mod/Material/App/ModelLibrary.cpp:75-82` (cause); `src/Mod/Material/App/ModelManager.cpp:278-290` (other-site) - **Evidence:** ModelManager.cpp:282-289 `auto model = _externalManager->getModel(uuid); if (model) return model; ... return _localManager->getModel(uuid);`; ModelManagerLocal.cpp:184-185 `catch (std::out_of_range const&) { throw ModelNotFound(); }`; ModelLibrary.cpp:81 no try/catch. - **Counts if:** Must say that an unavailable listed model leads to an exception (ModelNotFound) that aborts tree construction. Comments claiming a null dereference at ModelLibrary.cpp:82 (C15, C49) are wrong about the mechanism: ModelManager::getModel never returns null. ### D11 · low · behavior-regression — ModelManager::getLibraries now returns libraries in alphabetical order (and drops same-named local libraries) even with the external interface off ModelManager::getLibraries (src/Mod/Material/App/ModelManager.cpp:130-153) now routes every library, including the local ones, through a std::map> keyed by name and then flattens the map. Before the PR it returned _localManager->getLibraries() unchanged, i.e. in the loader's configured order (System, then workbench/module libraries, then User and Custom; ModelLoader::getModelLibraries). The map sorts by name, so the model selector (ModelSelect.cpp:342-350, which adds a tree node per library in list order) and the Python getLibraries now show libraries alphabetically, and try_emplace silently drops a second local library sharing a name. This happens in every build, even with BUILD_MATERIAL_EXTERNAL off or UseExternal false. - **Sites:** `src/Mod/Material/App/ModelManager.cpp:130-153` (cause); `src/Mod/Material/Gui/ModelSelect.cpp:342-350` (symptom) - **Evidence:** auto libMap = std::map>(); ... for (auto& local : *localLibraries) { libMap.try_emplace(local->getName(), local); } ... for (auto libEntry : libMap) { libraries->push_back(libEntry.second); } (base: return _localManager->getLibraries();) - **Counts if:** A review counts if it says the merged getLibraries reorders libraries (alphabetical via the std::map) relative to the previous System/modules/User/Custom order, or that same-named local libraries are collapsed, including when the external interface is off. Near-misses that do NOT count: external-over-local precedence for a same-named pair (by design, excluded C31), or the reinterpret_cast in ModelManagerLocal::getLibraries (D3). ## FreeCAD__FreeCAD@39c5968 Static-analyzer tidy-up of src/App/Application.cpp with no intended behaviour change. It switches Base::Interpreter().addType to the static InterpreterSingleton::addType, replaces the repetitive custom Python exception setup with a local `setup` lambda, uses auto/if-init/ternaries, adds vector reserve() calls, replaces std::endl with '\n', renames shadowing locals (obj→obj2, args→args2), adds static_casts, and restructures the macOS FindHomePath buffer allocation into an if-with-initializer. Verified: InterpreterSingleton::addType is static (Base/Interpreter.h:288); the if-init buffer in FindHomePath is freed in both branches; std::string(RESOURCEDIR) is equivalent to the old .c_str() round-trip (both stop at the first NUL). No defects. ## FreeCAD__FreeCAD@e596925 Adds a C++ CalculiX .frd reader (namespace FRDReader in src/Mod/Fem/App/FemVTKTools.cpp) that parses the node block, element block and nodal result blocks into a vtkMultiBlockDataSet with one vtkUnstructuredGrid per (step, analysis type), writes it as a .vtm next to the input with vtkXMLMultiBlockDataWriter, and exposes it as FemVTKTools::frdToVTK and the Python function Fem.frdToVTK(filename). ### D1 · medium · bug — Result loop exits on the node count before the last node's ' -2' continuation line is read readResults loops `while (countNodes < info.numNodes && std::getline(...))` (FemVTKTools.cpp:1453) and increments countNodes when it reads each node's first ' -1' record (1482). The tuple is written only when vecValues+scaValues reach numComps (1498). For datasets with more than 6 components the remaining values are on ' -2' continuation lines; after the LAST node's ' -1' line countNodes == numNodes, the tuple is not yet complete, and the loop terminates before the continuation is consumed. The last node's result silently stays at the 0.0 fill. - **Sites:** `src/Mod/Fem/App/FemVTKTools.cpp:1453-1453` (cause); `src/Mod/Fem/App/FemVTKTools.cpp:1482-1482` (cause); `src/Mod/Fem/App/FemVTKTools.cpp:1498-1511` (symptom) - **Evidence:** 1453 `while (countNodes < info.numNodes && std::getline(ifstr, line))`; 1482 `++countNodes;` at the end of the code1 (' -1') branch; 1484 `else if (view.rfind(code2, 0) == 0)` handles continuations; 1498 `if ((vecValues.size() + scaValues.size()) == numComps)`. A ' -1' record carries at most 6 E12.5 values (node lines in box_static.frd are 85 chars = 3+10+6*12). - **Counts if:** Must say the loop stops on the node counter after the final ' -1' record so the final node's ' -2' continuation is never read and its tuple is missing/zero for >6-component datasets. The countScaPos classification bug (D2) is a different defect. ### D2 · low · bug — countScaPos not advanced on ' -2' continuation lines, misrouting scalar/vector components In the code2 branch (FemVTKTools.cpp:1486-1496) the loop over continuation values is `it += 12` without `++countScaPos`, unlike the code1 loop at 1467. Every continuation value is looked up in scalarPos at the same position, so in a >6-component dataset that mixes scalar and vector/tensor entities values go to the wrong collection (vecValues vs scaValues) and the arrays are filled with misplaced components. - **Sites:** `src/Mod/Fem/App/FemVTKTools.cpp:1486-1496` (cause) - **Evidence:** 1467 `for (auto it = sub.begin(); it != sub.end(); it += 12, ++countScaPos)`; 1486 `for (auto it = sub.begin(); it != sub.end(); it += 12)`; 1489 `std::find(scalarPos.begin(), scalarPos.end(), countScaPos)`. - **Counts if:** Must identify the missing countScaPos increment in the continuation branch. Comments that ALSO claim skipping `digits` chars on the ' -2' line loses the first value count for this defect only via the countScaPos part (the skip itself is correct: CalculiX writes the node-width field blank on continuation records). ### D3 · low · bug — valueFromLine parses with strtof, rounding doubles to float The double specialisation of valueFromLine (FemVTKTools.cpp:1098-1102) uses std::strtof, so every node coordinate, result value and the result header's time/frequency value (read from a 12-char field with up to 10 decimals, 1339) is rounded through 32-bit float before being stored in double/vtkDoubleArray, adding float-rounding noise and losing precision in e.g. time values. - **Sites:** `src/Mod/Fem/App/FemVTKTools.cpp:1098-1102` (cause) - **Evidence:** 1101 `value = std::strtof(sub.data(), nullptr);` inside `void valueFromLine(..., double& value)`. - **Counts if:** Must say strtof (float) is used where strtod is needed. Generic 'no error checking on strtol/strtof' remarks do not count. ### D4 · high · build — vtkXMLMultiBlockDataWriter missing from PreCompiled.h, breaking precompiled-header builds The new `#include ` is added only inside the `#ifndef _PreComp_` block of FemVTKTools.cpp (61). With FREECAD_USE_PCH (default ON, MSVC PCH set up in src/Mod/Fem/App/CMakeLists.txt:194-197) that block is skipped and PreCompiled.h does not include the header, so vtkXMLMultiBlockDataWriter is undeclared at 1606 and the Fem module fails to compile. - **Sites:** `src/Mod/Fem/App/FemVTKTools.cpp:61-61` (cause); `src/Mod/Fem/App/FemVTKTools.cpp:1606-1606` (symptom); `src/Mod/Fem/App/PreCompiled.h:155-194` (other-site) - **Evidence:** FemVTKTools.cpp:26 `#ifndef _PreComp_`; PreCompiled.h VTK list (155-194) has vtkXMLDataSetWriter/vtkXMLUnstructuredGridWriter but no vtkXMLMultiBlockDataWriter; InitializeFreeCADBuildOptions.cmake:31 `option(FREECAD_USE_PCH ... ON)`. - **Counts if:** Must mention the precompiled-header (PreCompiled.h / _PreComp_) build. Generic include-hygiene remarks do not count. Severity raised to high by critic: FREECAD_USE_PCH defaults ON under MSVC (InitializeFreeCADBuildOptions.cmake:31, inside if(MSVC)) and Fem's CMakeLists adds -D_PreComp_, so the default Windows build of the Fem module fails to compile; a build break on a primary platform is merge-blocking. ## microsoft__typescript-go@ae447d3 Removes NewLine() from the CompilerHost, execute.System, api.APIHost, project.ServiceHost and project.ProjectHost interfaces and implementations, drops the options parameter/field and SetOptions from compiler.NewCompilerHost/NewCachedFSCompilerHost and updates callers/tests. CLI output (help, version, list-files, watch messages) now uses hard-coded "\n" (literals or fmt.Fprintln) instead of the platform newline, intentionally changing Windows output from CRLF to LF. ### D1 · low · bug — Watch-mode status lines print a doubled space after switching Fprint to Fprintln with trailing-space literals internal/execute/watch.go:45 and :48 changed fmt.Fprint(w, "build starting at ", now, newline) to fmt.Fprintln(w.sys.Writer(), "build starting at ", w.sys.Now()) (likewise "build finished in ", duration). fmt.Fprint adds a space between operands only when neither is a string, so the old output had one space; fmt.Fprintln always adds a space between operands, so the new output is "build starting at