BUG: C21: Wrong or misleading diagnostics in 10 filters

未关闭
#1,880 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
cpp
领域
backend

调研方向

Start by reading the ten referenced filter implementations and their associated tests; the checklist links identify each finding and location. Reproduce each finding with a failing test, then run the relevant tests for both Direct and Scanline paths where masks are involved. Done means all ten diagnostics or mask behaviors match the stated rules, tests pass, and the AlignSectionsMutualInformation mask behavior decision is resolved.

由索引模型根据 Issue 内容生成。

描述

bug

Summary

Some filters give diagnostics that are wrong. Two sub-patterns occur:

  • Masked cells validated before the mask test. A per-cell loop validates a value (for example a Phase) or grows a feature before it tests the mask. A cell that the mask excludes can then fail execute or join a feature.
  • Diagnostic message wrong, swapped or misleading. An error, warning or help text formats the wrong variable, swaps arguments or messages, fires on the wrong condition, adds counts across arrays, or gives advice that the user cannot follow.

As of develop 419f9db35 (2026-10-21), there are 10 open findings in 10 filters: 0 CRASH, 0 WRONG_DATA, 10 MINOR. All findings are candidates. They were found and re-checked by reading the code. Nobody ran the code to confirm them.

Mechanism

Most messages are written by hand at each call site. No test asserts on the message text, so a wrong argument or a swapped message is not detected. Example: ReadEnsembleInfo gives the group name where the key name must go, and the key name where the group name must go:

https://github.com/BlueQuartzSoftware/simplnx/blob/419f9db357d0c5e9adbdb0ab4511d36a433aecfb/src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadEnsembleInfo.cpp#L103-L110

    if(inputIni[group].count(k_CrystalStructure) == 0)
    {
      return MakeErrorResult(-13005, fmt::format("Could not find the key {} in phase group {} from the input file '{}'", group, k_CrystalStructure, m_InputValues->InputFile));
    }
    if(inputIni[group].count(k_PhaseType) == 0)
    {
      return MakeErrorResult(-13006, fmt::format("Could not find the key {} in phase group {} from the input file '{}'", group, k_PhaseType, m_InputValues->InputFile));
    }

For the mask sub-pattern, the loop counts a bad value before it reads the mask. In ComputeFZQuaternions the count of out-of-range phases includes cells that the mask excludes. Execute then fails with -49008, although those cells produce no output (ComputeFZQuaternions.cpp#L181-L186).

No filter of this class was fixed on develop or in an open pull request.

Rule

  • In each per-cell loop, test the mask first. Validate, count or grow only the cells that the mask enables. Apply this in every algorithm path (Direct and Scanline).
  • Each diagnostic must name the correct values, in the correct order, and must fire only on the condition that its text describes. Advice in a message must be possible to follow.
  • Each distinct condition gets its own error code and message.
  • Decision needed for AlignSectionsMutualInformationFilter#3. DREAM3D 6.5.171 also lets masked cells join features during neighbor growth, but the filter documentation says that masked cells are excluded. Options:
    1. Add the mask test to neighbor growth (behavior changes from 6.5.171).
    2. Keep the 6.5.171 behavior and correct the documentation (masked cells are only excluded as seeds).

How to fix

  1. Write the failing test first (see "How to test").
  2. For a mask finding, move the mask test before the validation or the counting step. Do this in each algorithm path that has the loop.
  3. For a message finding, correct the fmt::format arguments, the condition, or the text. Keep the existing error code when the condition stays the same.
  4. When you add a new error code, use the range of that filter. Filter error codes are more negative than -10000, and each filter uses one range of 100 codes (first code -47500 gives -47500..-47599). Check that the code is unique with git grep -nE -- "-NNNN([^0-9]|$)". Do not use \b, because git grep -E ignores it. Also check the open pull request branches.
  5. For a help-text-only change (ExtractVertexGeometryFilter#1), a unit test cannot fail on develop. Write this in the pull request.

How to test

  • Write a unit test that fails on develop before you change the code.
  • Message findings: write an error-path test. Assert the error code (or warning code). Also assert that the message contains the correct values, for example the key name and the group name in the correct positions.
  • Mask findings: write an execute test with a masked-out cell that holds a bad value (for example Phase 5 with 2 Crystal Structures tuples). The test must pass, and the output values of the enabled cells must match an independent expected result. Run Direct and Scanline both through the existing algorithm-selection test scope.
  • Warning findings: assert that the warning appears for the condition that it describes and does not appear for the other condition.
  • If you cannot reproduce a finding, write this with the reason in the pull request and on this issue. Do not force a fix.

Conventions

  • Make one pull request for the whole class, with one commit for each filter.
  • Start each commit message with BUG: and add a Signed-off-by line. Do not add AI attribution.
  • Start each fix with a unit test that fails on develop.
  • Value checks need an independent expected result (oracle), not the output of the code under test.
  • Run ctest serially. Never use -j, because the tests depend on each other.
  • Format with clang-format 19.1.1 and the repository .clang-format.
  • Do not add sentences about input requirements to the filter documentation. 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 its V&V package (report, deviations, provenance, test tables). V&V documents reference DREAM3D 6.5.171 only.
  • Rebase on develop. Do not merge develop into the branch.

Checklist

  • MINOR · ReadImageStackFilter · ReadImageStackFilter.cpp:390 — RGB uint8 slices with Set Image Data Type = true and Output Data Type = uint16: error -23506 tells the user to turn on Convert To GrayScale, but then error -23504 rejects the non-uint8 data, so the advice cannot be followed. ReadImageStackFilter#9
  • MINOR · AlignSectionsMutualInformationFilter · AlignSectionsMutualInformation.cpp:125 — With Use Mask Array = true, neighbor growth tests only Feature Ids and Phases, so a masked-out cell joins a feature, or fails with -53703 if its Phase is out of range. Matches 6.5.171; see "Decision needed". AlignSectionsMutualInformationFilter#3
  • MINOR · ComputeBoundaryStrengthsFilter · ComputeBoundaryStrengths.cpp:88 — The Laue class warning fires when the phase index is not 1, not when the crystal structure is not Cubic m-3m. It fires for a cubic phase 2 and is missing for a hexagonal phase 1. Output values are correct. ComputeBoundaryStrengthsFilter#3 — moved to #1861 C01b.
  • MINOR · ComputeFZQuaternionsFilter · ComputeFZQuaternions.cpp:183 — With Apply to Good Elements Only = true, a masked-out cell with Phase 5 and 2 Crystal Structures tuples is counted as out of range, so execute fails with -49008. Fix every algorithm path. ComputeFZQuaternionsFilter#1
  • MINOR · CreateEnsembleInfoFilter · CreateEnsembleInfo.cpp:82 — Errors -10006 and -10007 print the looked-up number (for example 999) instead of the crystal structure or phase type text that the user typed, and do not give the row number. CreateEnsembleInfoFilter#2
  • MINOR · ReadEnsembleInfoFilter · ReadEnsembleInfo.cpp:105 — An INI group without a CrystalStructure or PhaseType key gives error -13005 or -13006 with the key name and group name swapped. ReadEnsembleInfoFilter#3
  • MINOR · ComputeArrayHistogramByFeatureFilter · ComputeArrayHistogramByFeature.cpp:1393 — The overflow counter is declared once outside the per-array loop and never reset, so the message for array B also counts the out-of-range values of array A. ComputeArrayHistogramByFeatureFilter#10
  • MINOR · ComputeFeatureRectFilter · ComputeFeatureRect.cpp:93 — A Feature Id of -1 gives error -31000, which says that the Feature Attribute Matrix has too few tuples. Negative Feature Ids need their own code and message. ComputeFeatureRectFilter#2
  • MINOR · CreateColorMapFilter · ColorTableUtilities.cpp:251 — Errors -36782 and -36783 are swapped: an unknown preset says "Found ... but no 'RGBPoints'", and a preset without RGBPoints (for example 'KAAMS') says "Unable to find". CreateColorMapFilter#3
  • MINOR · ExtractVertexGeometryFilter · ExtractVertexGeometryFilter.cpp:71 — The Array Handling help text says "[0] Move or [1] Copy", but the choices and ArrayHandlingType use 0 = Copy and 1 = Move. A Python or pipeline user who sets 0 gets Copy. ExtractVertexGeometryFilter#1

Out of scope

  • Findings of this class in filters that have a V&V report are not in this issue. There is 1 such finding, in ComputeIPFColorsFilter. It is handled on a separate V&V branch.
主要语言
C++
星标
18
派生
15
平均合并
4 天 23 小时
30 天内合并 PR
42

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

BlueQuartzSoftware/simplnx 的其他 Issue

查看 BlueQuartzSoftware/simplnx 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。