Skip to content

Commit 64721b1

Browse files
sbryngelsonclaude
andcommitted
Address review feedback: consolidate CMake commands, robustify generators
- Consolidate case_constraints.md and physics_constraints.md into a single CMake custom command to avoid parallel build races - Fall back to sorted stage names instead of "all" for unknown stages - Append extra categories not in CATEGORY_ORDER instead of dropping them - Print error details for failing example validations in CI Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7f64cd5 commit 64721b1

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

.github/workflows/lint-toolchain.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
passed=$((passed + 1))
5050
else
5151
echo "FAIL: $case"
52+
./mfc.sh validate "$case" 2>&1 || true
5253
failed=$((failed + 1))
5354
fi
5455
done

CMakeLists.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -660,27 +660,19 @@ if (MFC_DOCUMENTATION)
660660
VERBATIM
661661
)
662662

663-
# Generate case_constraints.md from case_validator.py and examples/
663+
# Generate case_constraints.md and physics_constraints.md together.
664+
# Both are produced by gen_constraints.sh, so a single command avoids races.
664665
add_custom_command(
665666
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/case_constraints.md"
667+
"${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/physics_constraints.md"
666668
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/gen_case_constraints_docs.py"
669+
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/gen_physics_docs.py"
667670
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/case_validator.py"
668671
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/params/definitions.py"
669672
"${examples_DOCs}"
670673
COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_constraints.sh"
671674
"${CMAKE_CURRENT_SOURCE_DIR}"
672-
COMMENT "Generating case_constraints.md"
673-
VERBATIM
674-
)
675-
676-
# Generate physics_constraints.md from PHYSICS_DOCS + AST-extracted rules
677-
add_custom_command(
678-
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/physics_constraints.md"
679-
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/gen_physics_docs.py"
680-
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/case_validator.py"
681-
COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_constraints.sh"
682-
"${CMAKE_CURRENT_SOURCE_DIR}"
683-
COMMENT "Generating physics_constraints.md"
675+
COMMENT "Generating case_constraints.md and physics_constraints.md"
684676
VERBATIM
685677
)
686678

toolchain/mfc/gen_physics_docs.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ def _wrap_code(match: re.Match) -> str:
110110
def _stages_str(stages: Set[str]) -> str:
111111
order = ["common", "pre_process", "simulation", "post_process"]
112112
ordered = [s for s in order if s in stages]
113-
return ", ".join(ordered) if ordered else "all"
113+
if ordered:
114+
return ", ".join(ordered)
115+
if stages:
116+
return ", ".join(sorted(stages))
117+
return "all"
114118

115119

116120
def _severity_badge(rules: List[Rule]) -> str:
@@ -193,7 +197,8 @@ def render(rules: List[Rule]) -> str:
193197
"@ref case_constraints \"Case Creator Guide\".\n"
194198
)
195199

196-
for category in CATEGORY_ORDER:
200+
extra_categories = [c for c in by_category if c not in CATEGORY_ORDER]
201+
for category in CATEGORY_ORDER + sorted(extra_categories):
197202
methods = by_category.get(category)
198203
if not methods:
199204
continue

0 commit comments

Comments
 (0)