From a4974e72c1946fda8b2f030878ed768d942216ee Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 21 Oct 2026 09:55:40 +0200 Subject: [PATCH] Run the pull request's natvis generator in the amalgamation check (#5873) The check ran generate_natvis.py from the develop checkout and took only the template from the pull request, so a pull request that changes the generator (such as #5868, which limits the namespaces to two ABI tags) could never pass: develop's generator rewrote the committed file. The check now runs the pull request's generator, which loads its own template, as the macro_builder step already does. Signed-off-by: Niels Lohmann --- .github/workflows/check_amalgamation.yml | 29 ++++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check_amalgamation.yml b/.github/workflows/check_amalgamation.yml index 43b6d5cc5..cb2d93b52 100644 --- a/.github/workflows/check_amalgamation.yml +++ b/.github/workflows/check_amalgamation.yml @@ -77,13 +77,12 @@ jobs: cd $MAIN_DIR # Built from this PR's own tools/macro_builder/main.cpp, not a - # develop checkout: unlike amalgamate.py and generate_natvis.py, - # this tool has no other source of truth to check against (its - # own README documents that it must reproduce macro_scope.hpp - # byte for byte), so there is nothing to gain from checking out a - # separate copy, and doing so would make this step fail on a PR - # that adds support for a new dispatch table until that PR itself - # merges to develop. + # develop checkout: unlike amalgamate.py, this tool has no other + # source of truth to check against (its own README documents that + # it must reproduce macro_scope.hpp byte for byte), so there is + # nothing to gain from checking out a separate copy, and doing so + # would make this step fail on a PR that adds support for a new + # dispatch table until that PR itself merges to develop. TMPDIR=$(mktemp -d ./macro_builder_check.XXXXXX) c++ -std=c++11 tools/macro_builder/main.cpp -o "$TMPDIR/macro_builder" "$TMPDIR/macro_builder" > "$TMPDIR/paste.hpp" @@ -143,14 +142,14 @@ jobs: - name: Regenerate nlohmann_json.natvis run: | cd $MAIN_DIR - # The template is what this check verifies the committed natvis - # file against, so take it from this PR rather than from the - # develop checkout: generate_natvis.py loads the template from its - # own directory, and with develop's copy a PR that changes the - # template could never pass. Like the macro_builder step above, - # this only renders PR content in a job without credentials. - cp tools/generate_natvis/nlohmann_json.natvis.j2 $NATVIS_TOOL_DIR/ - python3 $NATVIS_TOOL_DIR/generate_natvis.py $MAIN_DIR + # The generator and its template are what this check verifies the + # committed natvis file against (which namespaces it lists, and + # what each entry looks like), so run this PR's copy rather than + # the develop checkout's: with develop's, a PR that changes either + # could never pass. generate_natvis.py loads the template from its + # own directory. Like the macro_builder step above, this only runs + # PR content in a job without credentials. + python3 tools/generate_natvis/generate_natvis.py $MAIN_DIR - name: Build patch and check for differences id: diff