Repository navigation
BUG: Combine the EBSD fixes that need the next EbsdLib release - #1973
imikejackson wants to merge 14 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
…Software#1967) Originally simplnx BlueQuartzSoftware#1967 (branch fix/ebsd-vv-filter-items), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…uartzSoftware#1962) Originally simplnx BlueQuartzSoftware#1962 (branch topic/gm3d_space_group_laue), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…ftware#1965) Originally simplnx BlueQuartzSoftware#1965 (branch topic/hex_to_square_ang_extension_case), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…lueQuartzSoftware#1968) Originally simplnx BlueQuartzSoftware#1968 (branch fix/read_h5ebsd_preflight_errors), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…ions (BlueQuartzSoftware#1969) Originally simplnx BlueQuartzSoftware#1969 (branch fix/orientation-axis-direction-validation), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…BCD GMT (BlueQuartzSoftware#1970) Originally simplnx BlueQuartzSoftware#1970 (branch fix/writegbcdgmt-crystal-structure-check), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…QuartzSoftware#1971) Originally simplnx BlueQuartzSoftware#1971 (branch fix/ebsd-reader-phase-table-checks), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…Software#1972) Originally simplnx BlueQuartzSoftware#1972 (branch fix/twin-boundaries-acos-clamp), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…lueQuartzSoftware#1961) Originally simplnx BlueQuartzSoftware#1961 (branch topic/rename_simplnx_h5support_mutex_macro), combined into this branch for the EbsdLib 3.1.4 update. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
- The merge of BlueQuartzSoftware#1962 into the combined branch joined the last BlueQuartzSoftware#1967 test case and the first BlueQuartzSoftware#1962 test case without the closing brace between them, so ReadGrainMapper3DTest.cpp did not compile. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
…ter checks The combined EbsdLib rejects three malformed inputs in the reader, before the simplnx check that the test expected can run: - ReadAngData HeaderValidation steps: AngReader reports an XSTEP or YSTEP of "nan" or "1e999" as a header parse error (-115, EbsdLib "Report an error when an ANG header number cannot be parsed"). The filter check (-67602) still rejects -1 and 0. - ReadChannel5Data Empty phase list: CprReader reports a .cpr file without phases (-102300, EbsdLib "Report an error when a .cpr file defines no phases") before the filter check (-66502). - ReadH5Ebsd Phase table validation: EbsdLib rejects a LatticeConstants dataset without 6 values, so the volume reader returns no phases (-50027) before the lattice-constant check (-50028). Each input is still rejected with an error that names the file and the value. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
* When EbsdLib returns no phases, error -50027 now gives the reader's error code and message, for example the EbsdLib -90350 message for a LatticeConstants dataset that does not hold 6 values. Before, the message said only that the phase information could not be read. * The phase-table test checks that the message contains -90350. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
841677f to
20b4e06
Compare
Fill the grayscale pipeline fixture by index instead of growing it with vector::insert, which triggers a gcc 13 -Wstringop-overflow false positive. The pixel bytes are unchanged. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
| { | ||
| using PhaseValuesType = std::vector<std::array<uint32, 2>>; | ||
| ini::IniFile inputIni; | ||
| inputIni.load(file); |
There was a problem hiding this comment.
[Important] ReadEnsembleFile() can throw in preflight on a malformed INI file
ReadEnsembleInfoFilter::preflightImpl() now calls ReadEnsembleFile(). That function calls inputIni.load(file) (line 101) and .as<int32>() (line 110) from utilities/inicpp.h.
- The parser throws
std::logic_errorfor a line without=, an unclosed[section, or a field before any section. Convert<int>throwsstd::invalid_argumentforNumber_Phases=twoorNumber_Phases=1.5.
IFilter::preflight() does not convert exceptions to errors, so a malformed .ini can end the GUI. This breaks the knowledge-base rule "Never throw in preflight". as<int32>() also narrows long to int without a check: Number_Phases=4294967297 becomes 1.
Fix: wrap the load and each conversion in try/catch and return new distinct codes (for example -13010 for an INI parse failure that names the line, and -13011 for a Number_Phases value that is not a whole number). Parse Number_Phases with std::from_chars into int64 and range-check it. Add both cases to ReadEnsembleInfo: EBSD regression preflight validation.
| // ----------------------------------------------------------------------------- | ||
| Result<> ComputeGBCDPoleFigureDirect::operator()() | ||
| { | ||
| if(Result<> axisResult = ComputeGBCDPoleFigureDirect::ValidateMisorientationAxis(m_InputValues->MisorientationRotation); axisResult.invalid()) |
There was a problem hiding this comment.
[Minor] Algorithms repeat parameter checks that preflight already makes, and tests call the algorithms to reach them
These new static validators run in both preflightImpl() and operator()():
ValidateLoadingDirection(ComputeBoundaryStrengths.cpp:48)ValidateMisorientationRotation(ComputeGBCDMetricBased.cpp:364)ValidateMisorientationAxis(ComputeGBCDPoleFigureDirect.cpp:284, Scanline.cpp:241, WriteGBCDGMTFile.cpp:110, together withValidatePhaseOfInterest)ValidateReferenceAxis(ComputeMisorientations.cpp:251)
The knowledge-base entry "Run a filter, not its algorithm" names this exact shape as a violation. It also names the matching test shape, which three new test sections use: ComputeGBCDPoleFigureTest, ComputeMisorientationsTest and ReadChannel5DataTest call operator()() to reach an input check.
Fix: keep the validators for preflight. In each algorithm, replace the call with a @pre in its Doxygen (for example @pre MisorientationRotation[1..3] is finite and not (0, 0, 0).) and keep the NormalizeDirection(...).value() call. Remove the algorithm-direct test sections.
| // Each phase writes one tuple of the Ensemble arrays at its phase index and reads six lattice constants. | ||
| for(const auto& phase : phases) | ||
| { | ||
| const int32 phaseID = phase->getPhaseIndex(); |
There was a problem hiding this comment.
[Minor] The H5EBSD phase-index check runs only in execute, and two fallback codes have no test that reaches them
ReadH5EbsdFilter::preflightImpl() already reads the phases for its preview, but the phase-index check -50029 runs only in LoadInfo during execute. A file with phase index 3 out of 2 phases passes preflight and fails at run time; the test ReadH5Ebsd: Phase table validation calls only execute(). This breaks "Put each check at the earliest point that can see its data".
The target EbsdLib now rejects the inputs for -50028 (lattice constants) and -66502 (Channel5 empty phase list) first, and the tests assert the EbsdLib codes. No test reaches either simplnx branch, which cpp-best-practices requires for each failure branch.
Fix:
- Move -50029 (and -50028) into a helper that preflight calls. Keep an execute recheck only for a file that changed after preflight.
- For -50028 and -66502, remove the unreachable branches or add tests that reach them.
| if(!std::isfinite(pOriginValue[component])) | ||
| { | ||
| return MakePreflightErrorResult( | ||
| -9592, fmt::format("File '{}' has Origin component '{}' = {}. Set this component to a finite float32 value.", inputFilePath, k_Axes[component], pOriginValue[component])); |
There was a problem hiding this comment.
[Minor] The OINA Origin error says the file holds the value, but Origin is a user parameter
pOriginValue comes from k_Origin_Key, a user parameter, not from the file. The message "File '{}' has Origin component 'x' = nan" sends the user to look in the .h5oina file, and docs/ReadH5OinaDataFilter.md lists the rule under "Header validation".
Fix: use fmt::format("The Origin parameter has component '{}' = {}. Enter a finite value.", k_Axes[component], pOriginValue[component]), and move the doc sentence out of "Header validation" into the parameter discussion.
| { | ||
| return result; | ||
| } | ||
| auto first = T::New(); |
There was a problem hiding this comment.
[Minor] One code (-8970) for three read failures, and the first scan's header is read again for every scan
-8970 now covers three failures: the current scan's header read (line 163), the first scan's header read (line 176) and readFile() (line 216). This breaks "Give every condition its own error code".
readData() also creates a new reader and calls readHeaderOnly() on the first selected scan once for each scan. A 200-slice import opens and parses the first header 200 extra times.
Fix: read the first scan's header once in execute() before the loop and pass it to readData(). Give the two header-read failures their own named constants.
| } | ||
| } | ||
|
|
||
| TEST_CASE("OrientationAnalysis::ReadAngData: HeaderValidation symmetry", "[OrientationAnalysis][ReadAngData]") |
There was a problem hiding this comment.
[Nit] New test tags differ from the existing tags in the same files
New cases use [ReadAngData], [ReadCtfData], [ReadChannel5Data], [ReadH5Ebsd], [ComputeMisorientations] and [WriteGBCDGMTFile]. The existing cases in the same files use [ReadAngDataFilter], [ReadCtfDataFilter], [WriteGBCDGMTFileFilter] and so on (see ReadAngDataTest.cpp:171). A selection by the existing tag skips the new tests. Use the filter tag that the file already uses.
| constexpr int32 k_InvalidAbsorptionVirtualShift = -38617; | ||
| constexpr int32 k_InvalidCompletenessInfo = -38618; | ||
| constexpr int32 k_InvalidCompletenessRank = -38619; | ||
| constexpr int32 k_InvalidSpaceGroup = -67600; |
There was a problem hiding this comment.
[Nit] -67600 is declared twice, and preflight checks the GrainMapper space groups twice
k_InvalidSpaceGroup (GrainMapper3DUtilities.cpp:41) and EbsdReaderUtilities::k_InvalidPhaseSymmetry (EbsdReaderUtilities.hpp:103) both hold -67600, so one of them can drift. ReadGrainMapper3DFilter.cpp:149 validates all space groups, then GeneratePreflightPhaseInformation validates each one again.
Fix: use k_InvalidPhaseSymmetry in ValidateSpaceGroups(), and drop one of the two checks.
|
|
||
| TEST_CASE("OrientationAnalysis::ReadH5EspritData: StructuralValidation", "[OrientationAnalysis][ReadH5EspritDataFilter]") | ||
| { | ||
| const std::string field = GENERATE("columns", "rows", "xstep", "ystep", "phases", "material", "width", "height", "short", "type", "rank", "components"); |
There was a problem hiding this comment.
[Nit] Some header-validation test cases return before they assert the expected code
In the OIM and Esprit HeaderValidation tests, the zero-pattern cases return before they assert -9583 or -9683. In the Esprit StructuralValidation case (line 551), the GENERATE list leaves out "missing", so -67609 is tested only through OIM.
Fix: assert the missing-pattern code before the return, and add "missing" to the Esprit list.
| ConvertHexGridToSquareGrid& operator=(ConvertHexGridToSquareGrid&&) noexcept = delete; | ||
|
|
||
| /** @brief Returns true when the file extension is .ang, regardless of case. */ | ||
| static bool IsAngFile(const std::filesystem::path& inputPath); |
There was a problem hiding this comment.
[Nit] Doxygen and comment accuracy
IsAngFilehas no tags. Replace its block with:/** @brief Reports whether a path has the .ang extension in any letter case. @param inputPath Path to test. @return True for .ang, .ANG or another case variant. */- The comment at ReadGrainMapper3D.cpp:458 is inaccurate: the converted datasets also reach the
switchand fall todefault. Replace it with:// The conversion blocks above erased their datasets from the type sets. Those datasets are uint8 or float32 and fall to default, so they are not read again.
| other inputs, scan the minimum and maximum. A masked filter checks only the ids it uses, with the same mask and sentinel | ||
| rules as execute. A negative value is out of range unless the code skips it before it indexes. An index that comes from | ||
| a parameter value (for example **Phase Index**) is checked in preflight. | ||
| a parameter value (for example **Phase Index**) is checked in preflight. Header values are also available in preflight. |
There was a problem hiding this comment.
[Nit] Knowledge-base edit: the header-step rule is in the wrong entry
The added sentences about signed dimensions, finite positive steps and format-specific zero defaults describe file values. They are in "Range-check every index that comes from data", which is about array-value indices, and they add no "What to look for" bullet.
Fix: move them to the "Values read from a file" bullet of "Decide NaN and infinity handling by where the value comes from". Add a bullet such as "a header dimension or step passed to CreateImageGeometryAction without a sign and finiteness check".
joeykleingers
left a comment
There was a problem hiding this comment.
This is the summary of my review of 2026-11-16. GitHub removed it when the review was submitted, so I post it here.
PR 1973 Code Review
Source: review of commit
841677f(#1973, "BUG: Combine the EBSD fixes that need the next EbsdLib release", author imikejackson,topic/next_ebsdlib_fixes→developat1f04ff1). Coverage: all 99 changed files and the complete diff (source, headers, tests, filter docs, V&V files, the knowledge-base edit, CMake, the pipeline and the Python example).
1. Findings
-
1.1 [Important]
ReadEnsembleFile()can throw in preflight on a malformed INI file
File:src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadEnsembleInfo.cpp:101,:110(ReadEnsembleInfo::ReadEnsembleFile)
CONFIRMED.ReadEnsembleInfoFilter::preflightImpl()now callsReadEnsembleFile(). That function callsinputIni.load(file)and.as<int32>()fromutilities/inicpp.h. The parser throwsstd::logic_errorfor a line without=, an unclosed[section, or a field before any section (inicpp.h:647/654/673/691).Convert<int>throwsstd::invalid_argumentwhenNumber_Phases=twoorNumber_Phases=1.5.IFilter::preflight()does not convert exceptions to errors, so in the GUI, editing the file path to a slightly wrong.inican end the application. The knowledge base forbids this ("Never throw in preflight"). The old preflight had the same calls, but this PR rewrote them as the new validation entry point, and the filter page now says preflight "validates all required phase groups". Also,as<int32>()narrowslongtointwithout a check, soNumber_Phases=4294967297becomes 1.
Fix: wrap the load and each conversion intry/catch, and return new distinct codes (for example -13010 "File '{}' is not a valid INI file at line {}: {}" and -13011 "Number_Phases '{}' is not a whole number"). ReadNumber_Phasesas a string and parse it withstd::from_charsintoint64, then range-check it. Add the two cases toReadEnsembleInfo: EBSD regression preflight validation. -
1.2 [Minor] Algorithms repeat parameter checks that preflight already makes, and tests call the algorithms to reach them
Files:ComputeBoundaryStrengths.cpp:48,ComputeGBCDMetricBased.cpp:364,ComputeGBCDPoleFigureDirect.cpp:284,ComputeGBCDPoleFigureScanline.cpp:241,ComputeMisorientations.cpp:251,WriteGBCDGMTFile.cpp:110(and itsValidatePhaseOfInterestcall)
CONFIRMED. Each new staticValidate*()is called from bothpreflightImpl()andoperator()(). The knowledge base's "Run a filter, not its algorithm" lists this exact shape as a violation ("a staticValidateInputs()that bothpreflightImpl()andoperator()()call"). It also lists the matching test shape: the new sections inComputeGBCDPoleFigureTest("Each executor rejects the axis…"),ComputeMisorientationsTest("The algorithm rejects the axis without the filter") andReadChannel5DataTest("The algorithm reports the empty phase list without the filter") calloperator()()to reach an input check. Every run checks the inputs twice, and each condition gets a second error path to maintain.
Fix: keep the static validators for preflight. In each algorithm, replace the call with a@prein its Doxygen (for example@pre MisorientationRotation[1..3] is finite and not (0, 0, 0).). Keep theNormalizeDirection(...).value()call, which relies on that precondition. Remove the algorithm-direct test sections. File re-reads after preflight (Channel5 fields, OEM headers) are allowed by the rule and can stay. -
1.3 [Minor] The H5EBSD phase-index check runs only in execute, and two fallback codes have no test that reaches them
File:src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/Algorithms/ReadH5Ebsd.cpp:78(LoadInfo);ReadChannel5DataFilter.cppandReadChannel5Data.cpp(-66502)
CONFIRMED. Phase indices are header metadata, andReadH5EbsdFilter::preflightImpl()already reads the phases for its preview. Even so, -50029 (a phase index outside 1..N) fires only in execute: the testReadH5Ebsd: Phase table validationcalls onlyexecute(). A pipeline with such a file passes preflight and fails at run time. This breaks "Put each check at the earliest point that can see its data". The PR also keeps -50028 and -66502 as "fallbacks", but the target EbsdLib rejects those inputs first (-50027/-90350 and -102300), and the tests assert the EbsdLib codes. No test reaches either simplnx branch, which cpp-best-practices requires for each failure branch.
Fix: move the -50029 check (and -50028) into a helper that preflight calls. Keep an execute recheck only for a file that changed after preflight. For -50028 and -66502, either remove the unreachable branches or add a test that reaches them, for example by constructing a reader result directly. -
1.4 [Minor] The OINA Origin error says the file holds the value, but Origin is a user parameter
File:src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/ReadH5OinaDataFilter.cpp:140
CONFIRMED.pOriginValuecomes fromk_Origin_Key, not from the file. The message "File '{}' has Origin component 'x' = nan" sends the user to look in the.h5oinafile.docs/ReadH5OinaDataFilter.mdalso puts this rule under "Header validation".
Fix:fmt::format("The Origin parameter has component '{}' = {}. Enter a finite value.", k_Axes[component], pOriginValue[component]). Move the doc sentence out of "Header validation" into the parameter discussion. -
1.5 [Minor] The main V&V reports do not list the new preflight branches
Files:src/Plugins/OrientationAnalysis/vv/ReadAngDataFilter.md,vv/ReadCtfDataFilter.md,vv/ReadH5OinaDataFilter.md
CONFIRMED. simplnx-best-practices requires a V&V row for each new preflight branch.vv/ReadAngDataFilter.mdhas no rows for -67600, -67601 or -67602 and no entry for D6; only the deviations sidecar changed.vv/ReadCtfDataFilter.mdadds -67601 and -67602 but has no code-path row for -67600 (symmetry), and its deviation list stops at D4 (D6 and D7 are missing).vv/ReadH5OinaDataFilter.mdlists -9592 and D16 but not the -67600 path or D15.
Fix: add the code-path rows, the test-inventory rows and the deviation-list entries for those codes and IDs. -
1.6 [Minor] One code (-8970) for three read failures, and the first scan's header is read again for every scan
File:src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/IEbsdOemReader.hpp:163,:170-176,:216
CONFIRMED. -8970 now covers three failures: the current scan's header read, the first scan's header read and the fullreadFile(). The knowledge base requires one code per condition ("Give every condition its own error code"). In addition,readData()creates a new reader and callsreadHeaderOnly()on the first selected scan once for each scan, so a 200-slice import opens and parses the first header 200 extra times.
Fix: read the first scan's header once inexecute()before the loop and pass it toreadData(). Give the two header-read failures their own named constants. -
1.7 [Minor] Pre-existing, wrong data: yes. AbsorptionCT spacing and extent reach a
size_tcast unchecked
File:src/Plugins/OrientationAnalysis/src/OrientationAnalysis/utilities/GrainMapper3DUtilities.cpp:351(GrainMapperReader::readAbsorptionHeader)
CONFIRMED, pre-existing, surfaced by this PR. The PR validates LabDCTSpacing(finite, positive) andExtent(finite). The sibling/AbsorptionCTblock validates only the value counts, then computesstatic_cast<size_t>(extents[i] / m_AbsorptionCTSpacing[i]). A file withSpacing = [0, 1, 1]or a NaN or negativeExtentmakes this cast undefined behavior. Preflight then creates an Image Geometry with arbitrary dimensions and zero spacing, without an error. The testReadGrainMapper3D: EBSD regression finite headerreturns early for this case ("Inferred absorption dimensions are a separate issue."), but that comment names no issue. The knowledge-base text this PR adds ("require finite, positive steps before geometry creation") covers this path.
Fix: callEbsdReaderUtilities::ValidateHeaderSpacing()on each AbsorptionCT spacing component. Check that each extent is finite and positive and that each quotient is finite, at least 1 and belowstd::numeric_limits<usize>::max()before the cast. Then remove the early return in the test. If it stays deferred, put the tracking issue number in the test comment and in the filter documentation. -
1.8 [Nit]
UnitTest::LoadPlugins()in tests that look up no filter
Files:src/Plugins/SimplnxCore/test/HierarchicalSmoothTest.cpp:619,626,632,638;ConvertHexGridToSquareGridTest.cpp(Unsupported extensions in any letter case are rejected, line 476);ReadAngDataTest.cpp(HeaderValidation dimensions, line 555);ReadEnsembleInfoTest.cpp(Direct algorithm clears extra tuples, line 273);ReadH5OimDataTest.cpp:708,750;ReadH5EspritDataTest.cpp(Scans With Different Dimensions);ReadGrainMapper3DTest.cpp(Large finite headers can cancel);WritePoleFigureTest.cpp(composite dimensions use the measured X width)
These tests construct the filter directly. The knowledge base ("Call UnitTest::LoadPlugins() only when the test looks up filters by UUID") says an unneeded call makes a test fail when an unrelated plugin does not load. Remove the calls. TheReadH5Ebsdtests need them and are correct. -
1.9 [Nit] Include placement and duplicate includes in the test files
Files:ReadAngDataTest.cpp:1,ReadCtfDataTest.cpp:1andReadH5OinaDataTest.cpp:1put#include "simplnx/Common/ScopeGuard.hpp"above the file's header comment.ReadH5OimDataTest.cppincludesReadH5OimData.hpp,ScopeGuard.hppand threeH5Supportheaders twice.ReadH5EspritDataTest.cppincludesScopeGuard.hppand theH5Supportheaders twice.ConvertHexGridToSquareGridTest.cppandReadEnsembleInfoTest.cppmix the include groups (one include followsnamespace fs = …). Group the includes in the simplnx order and remove the duplicates. -
1.10 [Nit] New test tags differ from the existing tags in the same files
New cases use[ReadAngData],[ReadCtfData],[ReadChannel5Data],[ReadH5Ebsd],[ComputeMisorientations]and[WriteGBCDGMTFile]. The existing cases in the same files use[ReadAngDataFilter],[ReadCtfDataFilter],[WriteGBCDGMTFileFilter]and so on (for exampleReadAngDataTest.cpp:171vs:504). A tag filter such as[ReadAngDataFilter]therefore skips the new header-validation tests. Use the filter tag that the file already uses. -
1.11 [Nit] -67600 is declared twice, and preflight checks the GrainMapper space groups twice
Files:GrainMapper3DUtilities.cpp:41(k_InvalidSpaceGroup = -67600) andEbsdReaderUtilities.hpp:103(k_InvalidPhaseSymmetry = -67600);ReadGrainMapper3DFilter.cpp:149andEbsdReaderUtilities.hpp(GeneratePreflightPhaseInformation, GrainMapper branch)
Two constants hold one value, so one of them can drift.preflightImpl()callsValidateSpaceGroups()on all phases, thenGeneratePreflightPhaseInformation()calls it again on each phase. UseEbsdReaderUtilities::k_InvalidPhaseSymmetryinValidateSpaceGroups(), and drop the second call or the first. -
1.12 [Nit] Some header-validation test cases return before they assert the expected code
Files:ReadH5OimDataTest.cppandReadH5EspritDataTest.cpp(HeaderValidation, thewidth/heightzero cases);ReadH5EspritDataTest.cpp:551
For zero pattern dimensions, the tests compare the preflight and direct codes and thenreturnwithout asserting -9583 or -9683, so a wrong shared code would pass. In the EspritStructuralValidationcase, theGENERATElist leaves out"missing", although the fixture and the expected-code map support it. As a result, -67609 is tested only through OIM. Assertfield == "width" || field == "height" ? k_*MissingPatternDimensions : …before the return, and add"missing"to the Esprit list. -
1.13 [Nit] Doxygen and comment accuracy
ConvertHexGridToSquareGrid.hpp(IsAngFile) has no tags. Replace it with:
/** @brief Reports whether a path has the .ang extension in any letter case. @param inputPath Path to test. @return True for .ang, .ANG or another case variant. */ReadGrainMapper3D.cpp:458: the comment says only the remaining mapped types reach theswitch. The converted datasets reach it too, and theiruint8/float32type falls todefault. Replace it with:
// The conversion blocks above erased their datasets from the type sets. Those datasets are uint8 or float32 and fall to default, so they are not read again.- The comment-audit script (
audit_cpp_comments.py) did not run (no shell; see 3.3).
-
1.14 [Nit] A raw choice index stays next to the new named-value comparison
File:src/Plugins/OrientationAnalysis/src/OrientationAnalysis/Filters/WritePoleFigureFilter.cpp(preflightImpl, marker-radius block after the new sampling checks)
The new code compares withto_underlying(WritePoleFigure::Algorithm::LambertProjection). The next block still compares with== 1ULL(pre-existing), which the knowledge base forbids ("Compare a choice with its named value"). Use the named Discrete enum value for consistency. -
1.15 [Nit] Knowledge-base edit: the header-step rule is in the wrong entry
File:docs/Coding_Knowledge_Base.md("Range-check every index that comes from data")
The added sentences "Check signed dimensions before conversion to shapes and require finite, positive steps before geometry creation. Preserve an explicit format-specific zero default…" are about file values that are not indices. That entry is about array-value indices. The text also adds no "What to look for" bullet, so the knowledge-base pass would not find the rule. Move these sentences to the "Values read from a file" bullet of "Decide NaN and infinity handling by where the value comes from". Add a "What to look for" bullet such as "a header dimension or step passed toCreateImageGeometryActionwithout a sign and finiteness check". The addition to "Check tuple counts in preflight" (stacked scans) is accurate and well placed.
2. C++, tests and documentation
The checks covered correctness, CPU and memory, language practice, design, defensive programming, maintainability, generated-code failures, tests and documentation. Their findings are in section 1. The thread-safety and out-of-core checks found nothing beyond the questions in 3.6 and 3.7.
Check 12 (where each check runs): every check that this PR adds to preflight reads either a parameter or file metadata: the axis and loading-direction validators, the WritePoleFigure ranges, the reader header grid, symmetry, slice-range, sample-transform, pattern-dataset and scan-compatibility checks, the ReadEnsembleInfo file checks, the ConvertHexGrid output path, and the WriteGBCDGMT phase bounds. The WriteGBCDGMT phase bounds use the tuple counts of the GBCD and Crystal Structures arrays. Readers size those ensemble matrices from file headers in preflight, so the counts are final, not placeholders. No new preflight check rejects a placeholder count.
Knowledge-base pass: the review checked each entry's "What to look for" list. It found matches for "Run a filter, not its algorithm" (1.2), "Put each check at the earliest point" (1.3), "Never throw in preflight" (1.1), "Give every condition its own error code" (1.6), "Call UnitTest::LoadPlugins() only when…" (1.8) and "Compare a choice with its named value" (1.14). "Never drop a Result" is now satisfied in ReadH5Ebsd::operator()() (see 4.6).
3. Missing or failed evidence
- 3.1 No build, test or clang-tidy run was possible in this review: read-only tools only, no shell.
clang-format.txtreports every changed C/C++ file clean. clang-tidy did not run. - 3.2 The PR depends on EbsdLib#86, which is not in this checkout. The review could not verify these EbsdLib APIs or their behavior:
LaueOps::GetLaueOpsFromSpaceGroupNumber,GetLaueOpsIndexFromSpaceGroupNumber,CprReader::createFieldParsers, the-115,-102300and-90350reader codes, andphaseInfo->getIT(). As the PR says, CI will fail until the EbsdLib release reachessimplnx-registry. - 3.3
audit_cpp_comments.pyand the ASD-STE100 check were not run (no shell). The prose was checked by reading only. - 3.4 Validation that the author deferred, as stated in the PR: no macOS build, no out-of-core run, the full suite not run on Windows, and the WritePoleFigure 128×128 out-of-core oracle not re-run (as
vv/WritePoleFigureFilter.mdstates). Pending validation is not a pass. - 3.5 Test results quoted in the PR (3972/3972 on Linux, 496/496 on Windows) were reported by the author and were not observed here.
- 3.6 Question: the PUBLIC compile definition changed from
H5Support_USE_MUTEXtoSIMPLNX_H5Support_USE_MUTEX. No old name is left in this repository (verified by search). Do SimplnxOoc, DREAM3D-NX or the vendored H5Support headers test the old macro? A consumer that does will silently lose its lock. - 3.7 Question:
H5Support.hppsays "Direct HDF5 call sites must explicitly acquire the same mutex".EbsdReaderUtilities::ValidateOemPatternDataset()adds directH5Dopen2/H5Dget_type/H5Sget_*calls in preflight withoutApiLock(). The other plugin readers make direct HDF5 calls without the lock too (pre-existing), so is this an accepted plugin-wide gap with a tracking issue? - 3.8 Question:
WritePoleFigureTestcomposite dimensions use the measured X widthasserts preflight dimensions{1, 176, 565}. The test itself says these differ from the executed{580, 176, 1}(issue #1867). The test therefore pins a known preflight/execute mismatch. Consider asserting only the X-width oracle value.
4. Confirmed correct
- 4.1
OrientationUtilities::NormalizeDirection()rejects nonfinite and all-zero vectors. It scales by the largest absolute component before the square root, so finite float32 inputs such as1e20do not overflow. TheMisorientation Axis Scaletests compare these inputs with the unit-axis output on both the Direct and Scanline paths. - 4.2 In
ComputeTwinBoundaries, the clamps beforestd::acosare correct for both cosines. The testExact Sigma 3 Twin With Parallel Normaluses a hand-derived oracle: twin flag 1 and incoherence 0. - 4.3
WriteGBCDGMTFilechecks the Laue index againstGetAllOrientationOps().size()before it indexes (-96717). The phase checks run in preflight and cover the GBCD and Crystal Structures counts separately (-96712 and -96716). - 4.4
WritePoleFigureFilter::GetXCharWidth()now measures on a 1×1 canvas. Before, preflight allocated animageSize²canvas, up to 8000² RGBA. The new sampling ranges are tested at, below and above both limits for both algorithms. - 4.5
HierarchicalSmoothchecks the reference length before any smoothing or write-back. The test confirms that the vertex coordinates stay unchanged on error and that the face-0 node ids in the message are correct. - 4.6
ReadH5Ebsd::operator()()now returns a child filter's preflight errors withnonstd::make_unexpected(...). Before, it pushed them into a validResult<>, a pattern the knowledge base forbids ("Never pass result.errors() of a valid Result"). - 4.7
ConvertHexGridToSquareGridnow returns the single-file converter'sResult, which the old code discarded.ValidateHexOutputPath()comparesweakly_canonicalpaths and also callsstd::filesystem::equivalent, so a relative or symlinked output that is the input is rejected in both preflight and execute. - 4.8 The new -676xx codes and -38609 to -38619 are unique in the repository. The H5Support macro rename is complete in the repository.
- 4.9 The OIM and Esprit readers validate every selected scan in preflight. They recheck each loaded scan against the destination geometry, the pattern array and the ensemble arrays before they copy (-67616 to -67618). The tests cover a file that changes after preflight.
- 4.10
ImportEdaxOIMData.d3dpipelinenow readsData/OrientationAnalysis/EdaxOIMData.h5, whichOrientationAnalysis/CMakeLists.txt:428-435extracts from the existing6_6_ImportH5Dataarchive. Its registration inPREBUILT_PIPELINE_NAMESis therefore satisfied.
5. Verdict
REQUEST CHANGES: finding 1.1 (Important) is open. The new ReadEnsembleFile() preflight path can throw on a malformed INI file, which can end the application. Findings 1.2 to 1.15 are Minor or Nit. The verdict covers only commit 841677f. The checks that depend on EbsdLib#86 (3.2) and the deferred platform and out-of-core runs (3.4) are still open.
Summary
This branch combines the simplnx pull requests that are tied to the next EbsdLib release into one branch, so that simplnx and EbsdLib each have one branch to build and test together. It builds and passes its tests against BlueQuartzSoftware/EbsdLib#86 (branch
topic/next_release_fixes).Each original pull request is merged with
--no-ff, so its commits and history are kept. The original pull requests are closed with a link to this one.Merged pull requests
Closes #1953
Closes #1882
Closes #1906
Closes #1946
Closes #1957
Conflict resolutions and decisions
ValidateSpaceGroupsfrom BUG: Use one EbsdLib space-group mapping in Read GrainMapper3D #1962 (-67600, the code both pull requests use) and thenGetLaueOpsFromSpaceGroupNumber, so there is one space-group check and no call to the removedGetOrientationOpsFromSpaceGroupNumber. For the header vector sizes, the codes of BUG: Use one EbsdLib space-group mapping in Read GrainMapper3D #1962 (-38610 to -38613) are kept; BUG: Validate EBSD reader headers, scans and slice ranges #1967's -67622 check stays insideValidateOriginHeaderbut file data no longer reaches it. BUG: Validate EBSD reader headers, scans and slice ranges #1967's testHeader vector sizeexpects the BUG: Use one EbsdLib space-group mapping in Read GrainMapper3D #1962 codes.ValidateOemScanCompatibilityfrom BUG: Validate EBSD reader headers, scans and slice ranges #1967 (-67606), with the message wording of BUG: Fix input validation in four EBSD and mesh filters #1965. BUG: Fix input validation in four EBSD and mesh filters #1965's -9592 and -9684 are removed. The execute-side -8972 check now runs only for readers other than OIM and Esprit (in practice H5OINA). Three assertions in BUG: Fix input validation in four EBSD and mesh filters #1965's tests expect -67606.IsAngFile(BUG: Fix input validation in four EBSD and mesh filters #1965) is built onNormalizedExtension(BUG: Validate EBSD reader headers, scans and slice ranges #1967); BUG: Fix input validation in four EBSD and mesh filters #1965's -44602 message and -44603 fix and BUG: Validate EBSD reader headers, scans and slice ranges #1967's -44604 output-path check are kept.}between test cases; they are fixed. Every changed test file has develop's test cases plus each pull request's additions, with no duplicate names.Changes needed for the combined EbsdLib
ReadAngData: HeaderValidation steps: an XSTEP or YSTEP ofnanor1e999gives -115 fromAngReader(EbsdLib#82), not -67602.ReadChannel5Data: Empty phase list: -102300 fromCprReader(EbsdLib#75), not -66502.ReadH5Ebsd: Phase table validation, short lattice constants: -50027 (EbsdLib#84), not -50028.Test Plan
ci-linux-x64preset withSIMPLNX_USE_LOCAL_EBSD_LIB=ON, EbsdLibtopic/next_release_fixes, H5Support v1.0.14): full ctest passes serially, 3972/3972. After the last two commits (the -50027 message and the EbsdLibH5CtfVolumeReaderfix), the OrientationAnalysis tests pass again, 520/520.x64-windows-v143, local EbsdLib#86 and H5Support v1.0.14): all 1478 targets build. The only warnings are 6 existing C4244 warnings in test files that this branch does not change. EbsdLib tests pass 516/516 and^OrientationAnalysis::tests pass 496/496, the same count as Linux for that pattern. The full simplnx suite was not run on Windows.simplnx-registryupdate).The
bluequartz-skillsplugin skills that AGENTS.md lists were not available in this environment; the changes followdocs/Coding_Knowledge_Base.md.🤖 Generated with Claude Code