Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test-toolchain-compat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Toolchain Compatibility

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

jobs:
test-toolchain:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
Comment on lines +13 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Remove the unreleased Python version 3.14 from the CI matrix to prevent workflow failures. [possible issue, importance: 6]

Suggested change
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']

Copy link
Member Author

Choose a reason for hiding this comment

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

Python 3.14 is available in actions/setup-python and passes in CI — all 5 matrix versions (3.10–3.14) are green. No change needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Question:

Python 3.14 is available in actions/setup-python and passes in CI — all 5 matrix versions (3.10–3.14) are green. No change needed.

Answer:

This is a “speculative CI hygiene” suggestion (it assumed 3.14 is unreleased / unsupported), and you can reduce this kind of noise by tightening /improve guidance and/or filtering mid-score suggestions.

Recommended config (reduce speculative CI-matrix/version suggestions unless there’s evidence of failure):

[pr_code_suggestions]
extra_instructions = """\
- Do not suggest changing CI matrices / supported language versions (e.g., Python/Node) unless the PR diff or PR checks show an actual failure/incompatibility.
- Avoid claims like “unreleased/unsupported version” unless you can point to concrete evidence in the PR context.
- If CI is green, do not propose removing versions purely as a preventative measure.
"""

Optional: filter out this class of mid-importance suggestions (the example was importance 6):

[pr_code_suggestions]
suggestions_score_threshold = 7

(This will drop suggestions scored below 7; use carefully since it can also hide other useful items.)

If you prefer to exclude CI/workflow files from suggestions altogether:

[pr_code_suggestions]
extra_instructions = """\
- Ignore changes in CI/workflow files (e.g., .github/workflows/*).
"""

or globally:

[ignore]
glob = [".github/workflows/*"]

If you share which tool produced the comment (/improve vs /review) and your git provider (GitHub/GitLab/etc.), I can tailor the exact config snippet to the right section.

Relevant Sources:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Initialize MFC
run: ./mfc.sh init
- name: Lint and test toolchain
run: ./mfc.sh lint
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ if (MFC_DOCUMENTATION)
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/case_constraints.md"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/gen_case_constraints_docs.py"
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/case_validator.py"
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/params/definitions.py"
"${examples_DOCs}"
COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_constraints.sh"
"${CMAKE_CURRENT_SOURCE_DIR}"
Expand All @@ -684,10 +685,12 @@ if (MFC_DOCUMENTATION)
)

# Generate parameters.md from parameter registry
# docs_gen.py now AST-parses case_validator.py, so it must be a dependency
file(GLOB_RECURSE params_SRCs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/params/*.py")
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/docs/documentation/parameters.md"
DEPENDS "${params_SRCs}"
"${CMAKE_CURRENT_SOURCE_DIR}/toolchain/mfc/case_validator.py"
COMMAND "bash" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_parameters.sh"
"${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating parameters.md"
Expand Down
42 changes: 34 additions & 8 deletions toolchain/mfc/case_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
# pylint: disable=too-many-lines
# Justification: Comprehensive validator covering all MFC parameter constraints

import re
from typing import Dict, Any, List, Set
from functools import lru_cache
from .common import MFCException
from .params.definitions import CONSTRAINTS


@lru_cache(maxsize=1)
Expand Down Expand Up @@ -144,6 +146,10 @@ def check_model_eqns_and_num_fluids(self):
def check_igr(self):
"""Checks constraints regarding IGR order"""
igr = self.get('igr', 'F') == 'T'
igr_pres_lim = self.get('igr_pres_lim', 'F') == 'T'

self.prohibit(igr_pres_lim and not igr,
"igr_pres_lim requires igr to be enabled")

if not igr:
return
Expand All @@ -152,7 +158,6 @@ def check_igr(self):
m = self.get('m', 0)
n = self.get('n', 0)
p = self.get('p', 0)

self.prohibit(igr_order not in [None, 3, 5],
"igr_order must be 3 or 5")
if igr_order:
Expand Down Expand Up @@ -191,6 +196,10 @@ def check_weno(self):
def check_muscl(self):
"""Check constraints regarding MUSCL order"""
recon_type = self.get('recon_type', 1)
int_comp = self.get('int_comp', 'F') == 'T'

self.prohibit(int_comp and recon_type != 2,
"int_comp (THINC interface compression) requires recon_type = 2 (MUSCL)")

# MUSCL_TYPE = 2
if recon_type != 2:
Expand Down Expand Up @@ -1201,6 +1210,10 @@ def check_probe_integral_output(self):
def check_hyperelasticity(self):
"""Checks hyperelasticity constraints"""
hyperelasticity = self.get('hyperelasticity', 'F') == 'T'
pre_stress = self.get('pre_stress', 'F') == 'T'

self.prohibit(pre_stress and not hyperelasticity,
"pre_stress requires hyperelasticity to be enabled")

if not hyperelasticity:
return
Expand Down Expand Up @@ -1911,14 +1924,27 @@ def _format_errors(self) -> str:
err_lower = err.lower()
if "must be positive" in err_lower or "must be set" in err_lower:
lines.append(" [dim]Check that this required parameter is defined in your case file[/dim]")
elif "weno_order" in err_lower:
lines.append(" [dim]Valid values: 1, 3, 5, or 7[/dim]")
elif "riemann_solver" in err_lower:
lines.append(" [dim]Valid values: 1 (HLL), 2 (HLLC), 3 (Exact), etc.[/dim]")
elif "model_eqns" in err_lower:
lines.append(" [dim]Valid values: 1, 2 (5-eq), 3 (6-eq), or 4[/dim]")
elif "boundary" in err_lower or "bc_" in err_lower:
continue
if "boundary" in err_lower or "bc_" in err_lower:
lines.append(" [dim]Common BC values: -1 (periodic), -2 (reflective), -3 (extrapolation)[/dim]")
continue

# Auto-generate hints from CONSTRAINTS with value_labels
for param_name, constraint in CONSTRAINTS.items():
if not re.search(r'\b' + re.escape(param_name.lower()) + r'\b', err_lower):
continue
choices = constraint.get("choices")
if not choices:
continue
labels = constraint.get("value_labels", {})
if labels:
items = [f"{v} ({labels[v]})" if v in labels else str(v)
for v in choices]
hint = f"Valid values: {', '.join(items)}"
else:
hint = f"Valid values: {choices}"
lines.append(f" [dim]{hint}[/dim]")
break

lines.append("")
lines.append("[dim]Tip: Run './mfc.sh validate case.py' for detailed validation[/dim]")
Expand Down
Loading
Loading