From d7abac1a02cb89531b5653410132f469ca0d1db8 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Dec 2026 12:27:09 +0000 Subject: [PATCH] Build the mock proof's ON tool as the commit ships it graph-fuzzer.yml's `mock_proof` built its ON tool with lay-out-mocks.sh's `all` edits on every commit. Since mock layout ships on by default, that also turned on `recordsFilledCalls`, which the release ships off, so the proof judged a tool no adopter gets. A commit whose `laysOutMockRoots` defaults to on is now built as committed; a commit whose mock layout defaults to off still gets the script's edits. The step lists the default of every node-records switch the tool is built with, in its log and the run's summary. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HLuVQMifKg1WBCEn5ahSLi --- .github/scripts/mock-proof/lay-out-mocks.sh | 3 +- .github/workflows/graph-fuzzer.yml | 37 ++++++++++++++++----- Scripts/mock-proof-shipped.py | 2 +- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/scripts/mock-proof/lay-out-mocks.sh b/.github/scripts/mock-proof/lay-out-mocks.sh index 19265da675..66a7171988 100755 --- a/.github/scripts/mock-proof/lay-out-mocks.sh +++ b/.github/scripts/mock-proof/lay-out-mocks.sh @@ -15,7 +15,8 @@ # Nothing else is to be set by hand: a tool with fewer of them on (mock layout and shared worlds alone, say) is not the # gate's tool, and its differences are not the gate's. A switch that already reads `true` is left as it is. `layout` # turns on mock layout alone, to find which of the others a difference comes from; its result is never a gate result. -# graph-fuzzer.yml's `mock_proof` builds its ON tool with `all`, and its OFF tool from release 2.4.5, without the edits. +# graph-fuzzer.yml's `mock_proof` builds its ON tool with `all` only for a commit whose `laysOutMockRoots` defaults to +# `false`, and a later commit as committed; its OFF tool is release 2.4.5, without the edits. set -u root=$1 switches=${2:-all} diff --git a/.github/workflows/graph-fuzzer.yml b/.github/workflows/graph-fuzzer.yml index e6a26e0c43..d3b85d02cb 100644 --- a/.github/workflows/graph-fuzzer.yml +++ b/.github/workflows/graph-fuzzer.yml @@ -84,7 +84,7 @@ on: required: false default: '' mock_proof: - description: Also prove the mocks the commit ships alike to those SafeDI 2.4.5 ships, for every graph of the run the tool accepts. ON is a release build of the commit with .github/scripts/mock-proof/lay-out-mocks.sh's edits, OFF a release build of 2.4.5 (the `mock-proof-tools` job's MOCK_PROOF_OFF_COMMIT), the tool adopters have. Run it with `switches` naming the four mock layout switches, so the fuzzer judges the same graphs. Fails on a seed with no accepted graph, a graph either tool rejects, or a pair the mock program comparison does not find EQUAL, unless Scripts/mock-proof-allowances.tsv claims an entry for it and its mock's events come in production's order; and, as a canary that the two sides are different tools, when the two builds are the same binary or write the same mocks for every graph of the run. + description: Also prove the mocks the commit ships alike to those SafeDI 2.4.5 ships, for every graph of the run the tool accepts. ON is a release build of the commit as it ships, which is the commit as committed where its mock layout defaults to on, and with .github/scripts/mock-proof/lay-out-mocks.sh's edits where it does not; the job prints each switch's default. OFF is a release build of 2.4.5 (the `mock-proof-tools` job's MOCK_PROOF_OFF_COMMIT), the tool adopters have. On a commit whose mock layout defaults to off, run it with `switches` naming the four mock layout switches, so the fuzzer judges the same graphs. Fails on a seed with no accepted graph, a graph either tool rejects, or a pair the mock program comparison does not find EQUAL, unless Scripts/mock-proof-allowances.tsv claims an entry for it and its mock's events come in production's order; and, as a canary that the two sides are different tools, when the two builds are the same binary or write the same mocks for every graph of the run. type: boolean default: false # From verify.yml, in whose run the jobs below then run: they read the @@ -277,12 +277,12 @@ jobs: if-no-files-found: error # With `mock_proof`, the two release tools the shards' proof generates - # with: ON, the commit the run is dispatched on with - # .github/scripts/mock-proof/lay-out-mocks.sh's edits, the mock gate's four - # switches; and OFF, SafeDI 2.4.5 as released, the tool adopters have. OFF - # is not the commit as committed: once the commit's own switches default to - # on, that build is ON's, and the proof would compare a tool with itself. - # Both are built as a release is, and nothing reads or saves a cache. + # with: ON, the commit the run is dispatched on as it ships ("Build the + # Commit As It Ships" below); and OFF, SafeDI 2.4.5 as released, the tool + # adopters have. OFF is not the commit as committed: once the commit's own + # switches default to on, that build is ON's, and the proof would compare a + # tool with itself. Both are built as a release is, and nothing reads or + # saves a cache. mock-proof-tools: name: Build the Shipped Mock Proof's SafeDITool on Linux (${{ matrix.side }}) if: ${{ inputs.mock_proof && !inputs.coverage && !inputs.release_acceptance }} @@ -305,11 +305,30 @@ jobs: uses: actions/checkout@v7 with: ref: ${{ matrix.side == 'off' && env.MOCK_PROOF_OFF_COMMIT || '' }} - - name: Lay Mocks Out From Node Records + # A commit whose mock layout defaults to on (`laysOutMockRoots`) is built + # as committed, so each switch it ships off stays off: lay-out-mocks.sh + # `all` turns on `recordsFilledCalls` too, which 2.4.6 ships off, and the + # proof then judged a tool no adopter gets. A commit whose mock layout + # defaults to off gets the script's edits, the mock gate's four switches, + # as the mock gate has always run. Either way the step + # lists the default each switch is built with, in its log and the run's + # summary, so a reader of the proof knows which tool it judged. + - name: Set the Switches the Commit Ships if: ${{ matrix.side == 'on' }} run: | git config --global --add safe.directory "$PWD" - .github/scripts/mock-proof/lay-out-mocks.sh . all + observation=Sources/SafeDICore/Generators/NodeRecords/NodeRecordsObservation.swift + if grep -qE '^[[:space:]]*@TaskLocal public static var laysOutMockRoots = true$' "$observation"; then + echo "The commit lays out mocks by default, so it is built as committed." + else + .github/scripts/mock-proof/lay-out-mocks.sh . all + fi + { + echo "### Switch defaults of the ON tool" + echo '```' + grep -rE '^[[:space:]]*(@TaskLocal )?(public )?static (var|let) [A-Za-z]+ = (true|false)$' Sources/SafeDICore/Generators/NodeRecords | sed -E 's/:[[:space:]]+/: /' | sort + echo '```' + } | tee -a "$GITHUB_STEP_SUMMARY" - name: Build SafeDITool run: swift build -c release --product SafeDITool --static-swift-stdlib - name: Package the Tool diff --git a/Scripts/mock-proof-shipped.py b/Scripts/mock-proof-shipped.py index 0ec2b9a1a7..db3221f34e 100755 --- a/Scripts/mock-proof-shipped.py +++ b/Scripts/mock-proof-shipped.py @@ -2,7 +2,7 @@ """Usage: mock-proof-shipped.py [--jobs N] [--seeds FIRST-LAST|N,N…] FIXTURES ON_TOOL OFF_TOOL OUT Generates each graph of a graph fuzzer run that SafeDITool accepted with two release builds, and pairs the mocks they -write for the mock proof to compare: ON_TOOL is the head with the mock gate's switches on (lay-out-mocks.sh all), +write for the mock proof to compare: ON_TOOL is the head as it ships (graph-fuzzer.yml's "Set the Switches the Commit Ships"), OFF_TOOL SafeDI 2.4.5 as released (graph-fuzzer.yml's MOCK_PROOF_OFF_COMMIT). FIXTURES is the directory the run wrote with SAFEDI_GRAPH_FUZZER_ACCEPTED_FIXTURES (`GraphFuzzerAcceptedFixtures`): one JSON file per accepted graph, `-.json`.