BUG: C08: Sub-call results and warnings discarded in 22 filters
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with the 22 findings in the issue checklist and inspect each named source location, beginning with the dropped Result or unchecked stream described there. Add a failing unit test for each finding before fixing it, following the issue’s test guidance; run the relevant tests serially. Done means each finding is verified and fixed while preserving error codes, messages, and earlier warnings, with writer failures preventing AtomicFile commits.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Many filters call a function that returns a Result<> (or a stream that has an error state) and then do not use what it returns. Errors are lost and the filter reports success, or warnings are lost because a later Result replaces the earlier one. For file writers, an unchecked stream lets AtomicFile commit a truncated file as a success.
As of develop 419f9db35 (2026-10-21) there are 22 open findings in 22 filters: 2 CRASH, 7 WRONG_DATA and 13 MINOR. Each finding is a candidate. It was found and re-checked by reading code, not by running it.
Mechanism
Result<> is not marked [[nodiscard]] (src/simplnx/Common/Result.hpp), and AbstractDataStore::copyFrom is not either. The compiler does not warn when a caller drops the value. The pattern has these forms:
- Result discarded. The call's return value is ignored (
converter(...),copyFrom(...),ExecuteDataFunction(...),algorithm.operator()(false),rename(...)), or a worker's stored error is never returned. - Result replaced. The code returns a new warning or error (
return MakeWarningVoidResult(...),result = MakeWarningVoidResult(...)in a loop,return MakeErrorResult(-50011, ...)) instead of merging it into the existingResult. Earlier warnings and the real error text are lost. - Wrong or zero error code. A sub-call's error code is passed on even when it is 0, so the caller treats the failure as success.
- Stream state not checked. A writer never checks
fail()/bad()after writing, then commits theAtomicFile. A disk-full or I/O error gives a truncated file and success. - Preflight result not returned.
MakePreflightErrorResult(...)is called withoutreturn.
Example (SurfaceNetsDirect::operator()). windingResult can hold warning -56730 (unrepairable triangles). The two early returns send only the new warning, so -56730 is lost:
if(m_InputValues->BoundingBoxSkinMode == BoundingBoxSkinMode::k_BackgroundBackedWallsOnly && windingResult.valid())
{
if(triangleGeom.getNumberOfFaces() == 0)
{
return MeshingUtilities::MakeEmptyMeshWarning(m_InputValues->TriangleGeometryPath, m_DataStructure.getDataRefAs<Int32Array>(m_InputValues->FeatureIdsArrayPath).getNumberOfTuples(),
triangleGeom.getNumberOfVertices());
}
if(suppressedFaceCount == 0)
{
return MeshingUtilities::MakeNoFacesPrunedWarning(m_InputValues->TriangleGeometryPath);
}
}
Source: src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/SurfaceNetsDirect.cpp#L593-L604
Fixed form. PR #1767 (commit 53c678dfe) fixed the same code in QuickSurfaceMesh with MergeResults:
if(suppressedFaceCount == 0)
{
return MergeResults(std::move(windingResult), MeshingUtilities::MakeNoFacesPrunedWarning(m_InputValues->TriangleGeometryPath));
}
Source: src/Plugins/SimplnxCore/src/SimplnxCore/Filters/Algorithms/QuickSurfaceMeshDirect.cpp#L311-L314
Rule
- Never drop a
Result. Return it, or merge it into theResultthat the function returns. Keep earlier warnings. - An error from a sub-call keeps its own code and message. You can add context, but do not replace it with a generic code.
- A file writer checks the stream state after the last write (and after
flush/close). On failure it returns an error, so theAtomicFileis not committed. - Every
MakePreflightErrorResult(...)is returned. - Checks belong in preflight unless they need DataArray values. Remove execute-time checks that a new preflight check makes unreachable.
Decision needed:
- ExecuteProcessFilter, nonzero exit status: (a) return an error, or (b) return a warning with the exit code. See #1811.
- DeleteDataFilter, multi-parented object: (a) keep building the delete actions and add warning -61501, or (b) return an error.
How to fix
- Find each dropped value. Search the algorithm for calls whose return value is not assigned, and for
return Make...Result(after aResult resultwas filled. - Merge with
MergeResults(src/simplnx/Common/Result.hpp, line 259 at 419f9db35). For a warning in a loop, useresult.warnings().push_back({code, msg}). - Return a stored worker result. In
GeometryTransformation.cpp, the image path already returnsfilterProgressCallback.takeResult()(line 499); do the same inapplyNodeGeometryTransformation(line 517).takeResult()is in src/simplnx/Utilities/ImageRotationUtilities.hpp. - In parallel tasks (PadImageGeometry), keep the first failed
copyFromResultin the task and return it after the loop. - For writers: after the last write, call
flush(), then checkfail()/bad(). Return an error beforeAtomicFile::commit(). - When a sub-call can return code 0 on failure (ReadChannel5Data), return a fixed negative code from the filter's own range.
- New error codes: use the filter's existing error-code range. Codes are more negative than -10000, and each filter uses one range of 100 codes. Check uniqueness with
git grep -nE -- "-NNNN([^0-9]|$)"(not\b) on develop and on open pull request refs. - Do not add
[[nodiscard]]toResultin this work. That change affects the whole code base and needs its own issue.
How to test
Write a unit test that fails on develop first. Then fix the code.
- Lost warning: set up input that gives both warnings. Assert that the result holds both warning codes.
- Lost or replaced error: set up input that makes the sub-call fail. Assert that the execute (or preflight) result is invalid and holds the sub-call's own error code.
- Missing
returnin preflight: a preflight test with the invalid value. Assert the expected error code. - Writer stream state: if you can make the stream fail in a test (for example, an output path to a full or read-only location that opens but fails on write), assert an error and that the destination file is not replaced. If you cannot make the failure in a portable test, write that in the pull request with the reason.
- Out-of-core I/O failure (ApplyTransformationToGeometry, PadImageGeometry, ComputeEuclideanDistMap): use a test data store that fails
copyIntoBuffer/copyFromBufferor creation, if one exists. If none exists, say so in the pull request. - If the filter has Direct and Scanline algorithms (SurfaceNets, ComputeEuclideanDistMap, CreateColorMap), test both through the existing algorithm-selection test scope.
- Value checks need an independent expected result (oracle), not the output of the code under test.
Conventions
- One pull request for the whole class. One commit per filter.
- Commit prefix
BUG:. Add aSigned-off-byline. Do not add AI attribution. - Every fix starts with a unit test that fails on develop. If you cannot reproduce a finding, write that in the pull request and on this issue with the reason. Do not force a fix.
- Value checks need an independent expected result (oracle).
- Run ctest serially. Never use
-j; the tests depend on each other. - Format with clang-format 19.1.1 and the repository
.clang-format. - Do not add per-filter documentation sentences about input requirements. The generated parameter table documents them.
- If a fix touches a filter that has a V&V report (
src/Plugins/<Plugin>/vv/<Filter>.md), update every file of that filter's V&V package (report, deviations, provenance, test tables). V&V documents reference DREAM3D 6.5.171 only. - Rebase on develop. Never merge develop into the branch.
Checklist
- CRASH · ComputeEuclideanDistMapFilter · ComputeEuclideanDistMapScanline.cpp:898 — On the Scanline path with float output,
DataStoreUtilities::CreateDataStore<int64>can return nullptr for the scratch store, and line 899 dereferences it with no check.ComputeEuclideanDistMapFilter#3 - CRASH · ReadGrainMapper3DFilter · GrainMapper3DUtilities.cpp:188 — The return of
getDatasetInfois ignored anddims[2],dims[1],dims[0]are read from a possibly empty vector; lines 206-208 index Extent/Center/VirtualShift with no size check. Undefined behavior in preflight.ReadGrainMapper3DFilter#3 - WRONG_DATA · ApplyTransformationToGeometryFilter · GeometryTransformation.cpp:517 —
applyNodeGeometryTransformationreturns{}and drops the errors stored infilterProgressCallback, so a failed out-of-core chunk reports success with vertices only partly transformed.ApplyTransformationToGeometryFilter#12 - WRONG_DATA · DeleteDataFilter · DeleteDataFilter.cpp:99 — For a multi-parented object, preflight returns only warning -61501 and drops every delete action already added, so the pipeline runs and deletes nothing. The message names a "Delete DataPath" mode that does not exist.
DeleteDataFilter#1 - WRONG_DATA · ExtractPipelineToFileFilter · ExtractPipelineToFile.cpp:65 — The stream state is not checked after the write, and
atomicFile.commit()replaces the destination with a possibly truncated file and reports success.ExtractPipelineToFileFilter#1 - WRONG_DATA · PadImageGeometryFilter · PadImageGeometry.cpp:65 — The
copyFromResultis discarded in a parallel task, so failed row copies (for example negative X Min & Max Padding {-1,0}) are skipped and execute reports success.PadImageGeometryFilter#4 - WRONG_DATA · ReadChannel5DataFilter · ReadChannel5Data.cpp:103 — For a .cpr with no phases, the reader's error code (0) is returned, so the filter continues with CrystalStructures[0]=0 (Hexagonal_High, not 999) and an empty MaterialName[0].
ReadChannel5DataFilter#3 - WRONG_DATA · RenameDataObjectFilter · RenameDataAction.cpp:140 — The bool from
rename()is ignored. With Allow Overwrite on and an existing sibling (preflight) or an invalid New Name, the rename fails butapply()reports success.RenameDataObjectFilter#2 - WRONG_DATA · WriteGBCDTriangleDataFilter · WriteGBCDTriangleData.cpp:98 —
outStream.write()is never checked and the filter commits theAtomicFile, so an I/O error (for example a full disk) gives a truncated .ph file and success.WriteGBCDTriangleDataFilter#2 - MINOR · ComputeBiasedFeaturesFilter · ComputeBiasedFeatures.cpp:36 —
operator()drops theResultoffindBoundingBoxFeatures()/2D()and returns{}. Error -54900 is reachable only when the algorithm is called outsideIFilter.ComputeBiasedFeaturesFilter#4 - MINOR · ComputeTwinBoundariesFilter · ComputeTwinBoundaries.cpp:503 —
return MakeWarningVoidResult(-93213, ...)dropsresult, which can hold the -93211 non-cubic warning.ComputeTwinBoundariesFilter#3 - MINOR · ConditionalSetValueFilter · ConditionalSetValueFilter.cpp:126 — When
CheckValueConvertsfails, its errors are dropped, and the message prints the DataObject type enum as an integer, not the DataType name (for example New Value "300" on uint8).ConditionalSetValueFilter#4 - MINOR · ConvertHexGridToSquareGridFilter · ConvertHexGridToSquareGrid.cpp:362 — The converter
Resultis ignored, so real errors become generic -77751. IfAtomicFile::Createfails,m_Validstays true andcommitAllFilescalls.value()on an errorResult.ConvertHexGridToSquareGridFilter#4 - MINOR · CreateColorMapFilter · CreateColorMapDirect.cpp:339 — The
ExecuteDataFunctionresult is discarded, so the empty-array error -34381 is never reported and the filter succeeds with an empty RGB output.CreateColorMapFilter#5 - MINOR · ExecuteProcessFilter · ExecuteProcess.cpp:136 —
statusfromprocess.waitis never read, so a command that exits with a nonzero code (for examplefalse) reports success. (related: #1811)ExecuteProcessFilter#6 - MINOR · MergeTwinsFilter · MergeTwins.cpp:248 —
result = MakeWarningVoidResult(-23500, ...)in the loop replaces earlier warnings, so only the last non-m3m phase is reported.MergeTwinsFilter#4 - MINOR · ReadDeformKeyFileV12Filter · ReadDeformKeyFileV12Filter.cpp:127 —
algorithm.operator()(false)in preflight discards theResult, so parse errors (for example -2013) and warnings appear only at execute.ReadDeformKeyFileV12Filter#4 - MINOR · ReadH5EbsdFilter · ReadH5Ebsd.cpp:427 — An error from the RotateEulerRefFrame sub-filter is replaced by generic -50011, and warnings from both sub-filters are never passed on.
ReadH5EbsdFilter#7 - MINOR · SurfaceNetsFilter · SurfaceNetsDirect.cpp:602 — The empty-mesh and no-faces-pruned returns drop winding warning -56730. Scanline has the same code at lines 1104-1115.
SurfaceNetsFilter#3 - MINOR · WriteNodesAndElementsFilesFilter · WriteNodesAndElementsFiles.cpp:76 — The write loop never checks the stream state and returns
{}, so a disk-full or I/O error leaves a truncated file and success.WriteNodesAndElementsFilesFilter#2 - MINOR · WriteSPParksSitesFilter · WriteSPParksSites.cpp:151 —
flush/closeare not followed by a stream-state check, and the filter commits throughAtomicFile, so a disk-full truncation is committed as success.WriteSPParksSitesFilter#2 - MINOR · WriteStatsGenOdfAngleFileFilter · WriteStatsGenOdfAngleFileFilter.cpp:118 —
MakePreflightErrorResult(-9400/-9401, ...)is called withoutreturn, so an invalid Default Weight or Default Sigma passes preflight. Also fix the InValid test so that it sets the Phases argument.WriteStatsGenOdfAngleFileFilter#1
Already fixed or in progress
- PR #1767 (merged, commit 53c678dfe):
ReadImageStackFilter#7(dropped warnings in ReadImageStackFilter) andQuickSurfaceMeshFilter#6(winding warning dropped, fixed withMergeResults).
Related issues
- #1811 — BUG: Execute Process ignores nonzero child exit status (same as
ExecuteProcessFilter#6)
Out of scope
- Findings in filters that have a V&V report are excluded from this issue. There is 1 such filter: RegularizeZSpacingFilter. A separate V&V branch handles it.
- Marking
Resultas[[nodiscard]]across the code base. That needs its own issue.
- Ngôn ngữ chính
- C++
- Star
- 18
- Fork
- 15
- Merge trung bình
- 4 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của BlueQuartzSoftware/simplnx
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
BlueQuartzSoftware/simplnx#1987 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
BlueQuartzSoftware/simplnx#1980 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
BlueQuartzSoftware/simplnx#1979 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
BlueQuartzSoftware/simplnx#1978 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
BlueQuartzSoftware/simplnx#1945 ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của BlueQuartzSoftware/simplnx
Issue tương tự
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
26.04 bug dark-mode Easy Hack impress symptom: visual
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CollaboraOnline/online#16421 · 1 bình luận ·
-
area/cs bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ydb-platform/ydb#59881 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation enhancement lua server
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100