Prove the semver and solver kernel instead of testing it
Move number parsing, version ordering and constraints, version sorting and solver literals into src/kernel, with contracts checked by moon prove under overflow-checked integers. Replace the semver behaviour tests with those proofs, keep tests for string parsing, and run the proofs in CI. Version numbers are now 64-bit: the old parser silently wrapped at 2^31. Drop pick_tag, which only tests called. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d815bbb75
commit
83e694c6c4
16 files changed
+874
-330
No files matched your search
@@ -16,6 +16,8 @@ permissions:
|
||||
|
||||
env:
|
||||
MOONBIT_VERSION: 0.10.20+65efd5b93
|
||||
Z3_VERSION: 5.3.3
|
||||
Z3_SHA256: d56f60b06f432f33de5810f7f1a384a339131f361e2d54d08ea83eea14326880
|
||||
ZIG_VERSION: 0.17.1
|
||||
ZIG_SHA256: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a
|
||||
|
||||
@@ -55,6 +57,20 @@ jobs:
|
||||
- name: Test
|
||||
run: moon test --target native
|
||||
|
||||
# Proofs replace tests of src/kernel. The override checks for overflow;
|
||||
# `just prove` runs the same command.
|
||||
- name: Prove
|
||||
run: |
|
||||
z3="z3-$Z3_VERSION-x64-glibc-2.39"
|
||||
curl -fsSL --retry 5 -o "$RUNNER_TEMP/z3.zip" \
|
||||
"https://github.com/Z3Prover/z3/releases/download/z3-$Z3_VERSION/$z3.zip"
|
||||
echo "$Z3_SHA256 $RUNNER_TEMP/z3.zip" | sha256sum -c -
|
||||
python3 -m zipfile -e "$RUNNER_TEMP/z3.zip" "$RUNNER_TEMP"
|
||||
chmod +x "$RUNNER_TEMP/$z3/bin/z3"
|
||||
export Z3PATH="$RUNNER_TEMP/$z3/bin/z3"
|
||||
export MOON_PROVE_PRELUDE_OVERRIDE="$HOME/.moon/lib/prelude_proof_machine_int"
|
||||
moon prove src/kernel
|
||||
|
||||
- name: Build static binary
|
||||
run: scripts/build-musl.sh
|
||||
|
||||
|
||||
Reference in new issue
Block a user