diff --git a/.github/workflows/check_dafny_runtime_versions.yml b/.github/workflows/check_dafny_runtime_versions.yml index 1ab75e7f4..3578ecedb 100644 --- a/.github/workflows/check_dafny_runtime_versions.yml +++ b/.github/workflows/check_dafny_runtime_versions.yml @@ -16,6 +16,33 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # TODO: Remove this entire step when dafnyRuntimePythonVersion is deleted from project.properties + - name: Enforce dafnyVersion review (PR only) + if: github.event_name == 'pull_request' + run: | + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + + # Check if dafnyVersion was changed + if git diff "$BASE_SHA" "$HEAD_SHA" -- project.properties | grep -q "^[+-]dafnyVersion="; then + # Check if dafnyRuntimePythonVersion was also changed + if ! git diff "$BASE_SHA" "$HEAD_SHA" -- project.properties | grep -q "^[+-]dafnyRuntimePythonVersion="; then + echo "ERROR: dafnyVersion was changed but dafnyRuntimePythonVersion was not reviewed." + echo "" + echo "Required action (choose one):" + echo "1. PREFERRED: Delete the dafnyRuntimePythonVersion line entirely if the new Dafny version is compatible" + echo "2. Update dafnyRuntimePythonVersion to a compatible version" + echo "3. Keep the same value but add a comment explaining why (e.g., '# Keeping 4.11.0 due to compatibility issues')" + echo "" + echo "This ensures conscious review of the temporary Python runtime workaround." + echo "NOTE: When dafnyRuntimePythonVersion is removed, also remove this enforcement step." + exit 1 + fi + fi + - name: Validate DafnyRuntimePython Version Consistency run: | # Extract the version from pyproject.toml @@ -24,8 +51,8 @@ jobs: # Normalize by removing `.postN` if present normalized_dafny_runtime_python_version=$(echo "$dafny_runtime_python_version" | sed 's/\.post[0-9]*$//') - # Extract the version from project.properties - dafny_version=$(grep -oP 'dafnyVersion=\K[^\s]+' project.properties) + # Extract the Dafny Runtime Python Version from project.properties + dafny_version=$(grep -oP 'dafnyRuntimePythonVersion=\K[^\s]+' project.properties) # Check if the versions match if [ "$normalized_dafny_runtime_python_version" != "$dafny_version" ]; then diff --git a/StandardLibrary/runtimes/python/pyproject.toml b/StandardLibrary/runtimes/python/pyproject.toml index 72d531713..e758c983f 100644 --- a/StandardLibrary/runtimes/python/pyproject.toml +++ b/StandardLibrary/runtimes/python/pyproject.toml @@ -18,7 +18,7 @@ include = [ python = "^3.11.0" pytz = ">=2023.3.post1, <2026.0.0" # TODO: Longer-term, write something to pull this in from the project's project.properties file -DafnyRuntimePython = "4.9.0" +DafnyRuntimePython = "4.11.0" # Package testing diff --git a/project.properties b/project.properties index b26c85113..92272ebf6 100644 --- a/project.properties +++ b/project.properties @@ -7,5 +7,9 @@ # And the Dotnet projects include and parse this file. dafnyVersion=4.9.0 dafnyVerifyVersion=4.9.1 +# TEMPORARY WORKAROUND: When updating dafnyVersion, try to REMOVE this property first. +# Only keep if the new Dafny version has Python runtime compatibility issues. +# GitHub workflow will enforce this review. Goal: remove this entirely. +dafnyRuntimePythonVersion=4.11.0 dafnyRustVersion=4.10.0 mplVersion=1.11.1-SNAPSHOT