Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/scripts/mock-proof/lay-out-mocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
37 changes: 28 additions & 9 deletions .github/workflows/graph-fuzzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Scripts/mock-proof-shipped.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, `<seed>-<UUID>.json`.

Expand Down
Loading