Skip to content

Improve yaml errors readability - #741

Draft
JAuriac wants to merge 4 commits into
pdidev:mainfrom
JAuriac:for_more_errors
Draft

JAuriac wants to merge 4 commits into
pdidev:mainfrom
JAuriac:for_more_errors

Conversation

@JAuriac

@JAuriac JAuriac commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Not aimed at a particular issue, made after user feedback
To improve readability of errors related to the specification tree, on the user side

List of things to check before making a PR

Before merging your code, please check the following:

  • you have added a line describing your changes to the Changelog;
  • you have added unit tests for any new or improved feature;
  • in case you updated dependencies, you have checked pdi/docs/CheckList.md;
  • in case of a change in pdi.h, this same change must be reflected in mock_pdi/pdi.h;
  • in case of a new plugin, make sure the plugin issues the corresponding timer events;
  • you have checked your code format:
    • you have checked that you respect all conventions specified in CONTRIBUTING.md;
    • you have checked that the indentation and formatting conforms to the .clang-format;
    • you have documented with doxygen any new or changed function / class;
  • you have correctly updated the copyright headers:
    • your institution is in the copyright header of every file you (substantially) modified;
    • you have checked that the end-year of the copyright there is the current one;
  • you have updated the AUTHORS file:
    • you have added yourself to the AUTHORS file;
    • if this is a new contribution, you have added it to the AUTHORS file;
  • you have added everything to the user documentation:
    • any new CMake configuration option;
    • any change in the yaml config;
    • any change to the public or plugin API;
    • any other new or changed user-facing feature;
    • any change to the dependencies;
  • you have correctly linked your MR to one or more issues:
    • your MR solves an identified issue;
    • your commit contain the Fix #issue keyword to autoclose the issue when merged.

… messages to indicate the line and column, and fix subtype handling accordingly
context().logger().trace("`{}' will be serialized", desc_name);
std::string serialized_name = PDI::to_string(value);
context().desc(serialized_name);
m_desc_to_serialize.emplace(desc_name, serialized_name);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow dynamically defined member of serialize

Comment thread .gitmodules
[submodule "vendor/run-clang-format"]
path = vendor/run-clang-format
url = https://github.com/Sarcasm/run-clang-format.git
[submodule "vendor/paraconf-X"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PDI branch is based on a specific Paraconf branch

{
string order_str = to_string(PC_get(node, ".order"), "");
if (order_str == "c" && order_str == "C") {
if (order_str == "c" || order_str == "C") {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error, condition could never be matched

Comment thread pdi/src/datatype_template.cxx Outdated
return unique_ptr<Tuple_template>{
new Tuple_template{get_tuple_elements(ctx, elements_node, tuple_buffersize_defined), std::move(tuple_buffersize), node}
};
return std::make_unique<Tuple_template>(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make_unique instead of unique_ptr for modern C++

Comment thread pdi/src/error.cxx
auto& location = *m_location;
return fmt::format(
"{}: {}({}:{} -> {}:{}) {}",
"{}: {} (line {}, column {} to line {}, column {}) {}",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less compact but more explicit

if (type != "array" && node.node) {
if (!PC_status(PC_get(node, ".size"))) {
logger().warn("In line {}: Non-array type with a `size' property", node.node->start_mark.line);
logger().warn("In line {}: Non-array type with a `size' property", node.node->start_mark.line + 1);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solve index issue, as libyaml starts its index at 0 and not 1

Comment on lines -58 to +60
" mpio: INDEPENDENT \n"
" array_data: \n"
" - memory_selection: \n"
" - mpio: INDEPENDENT \n"
" memory_selection: \n"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mpio was previously silently ignored

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change equivalent to change of dnc_file_context.cxx of NetCDF

if (!PC_status(read_node)) {
if (PDI::is_scalar(read_node)) {
std::string read_desc = PDI::to_string(read_node);
descs_to_check.emplace_back(read_node, read_desc);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change needed to load data and metadata sections during the parsing, so that we can check the specification tree in an 'on_init' callback
Change equivalent to change of file_op.cxx for HDF5

…y, update git link of fork of Paraconf, fix indent
@JAuriac

JAuriac commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Will not pass CI as it uses default Paraconf (and not its specific branch)
Ok locally

@JAuriac

JAuriac commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Made PR #742, #743, #744, #745 to split this PR
What remains here and is not included in those PRs is the PDI change requiring the Paraconf change (change needed to load data and metadata sections during the parsing, so that we can check the specification tree in an 'on_init' callback), whose trade-off is to impact performance but output more explicit errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant