Skip to content

Commit d8e37f7

Browse files
authored
Merge pull request #351 from PhysShell/claude/p-022-analysis-wiring-mwhqlw
feat(perf): #263-A — the measurement instrument (phase A: prerequisites and merge-gate wiring; CALIBRATION_ONLY, no admissible baseline)
2 parents ca8b106 + 2b2314e commit d8e37f7

56 files changed

Lines changed: 89249 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,6 +2894,120 @@ jobs:
28942894
[ "$rc" -ne 0 ] || { echo "FAIL: a broken candidate exited 0"; exit 1; }
28952895
echo "OK: a broken candidate is a visible failure (exit $rc), never a Python rescue"
28962896
2897+
# #263-A — the performance measurement INSTRUMENT, calibrated. Not a
2898+
# baseline: this job proves the instrument stands up, on both platforms, and
2899+
# that it refuses to measure anything decisive before the D7 freeze.
2900+
#
2901+
# It publishes no engine comparison and can publish none: the harness holds
2902+
# one engine's samples per cell and refuses a report carrying a comparison
2903+
# key. What it asserts here is that the refusal is real, not that Rust is
2904+
# anything.
2905+
perf-instrument:
2906+
name: "#263-A measurement instrument (CALIBRATION_ONLY)"
2907+
strategy:
2908+
fail-fast: false
2909+
matrix:
2910+
os: [ubuntu-latest, windows-latest]
2911+
runs-on: ${{ matrix.os }}
2912+
defaults:
2913+
run:
2914+
shell: bash
2915+
steps:
2916+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2917+
with:
2918+
# The step 4 freeze controls read git objects at the frozen source
2919+
# commit and prove it is an ancestor of this head. A depth-1 checkout
2920+
# cannot answer either question, and those controls refuse rather than
2921+
# pass vacuously — so the history is the thing that makes them real.
2922+
fetch-depth: 0
2923+
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
2924+
with:
2925+
dotnet-version: "8.0.x"
2926+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2927+
with:
2928+
python-version: "3.13"
2929+
- uses: dtolnay/rust-toolchain@fa04a1451ff1842e2626ccb99004d0195b455a88 # master, 2026-07-10
2930+
with:
2931+
toolchain: stable
2932+
- name: Build the production own-cli candidate
2933+
working-directory: rust
2934+
run: cargo build -p own-cli --release
2935+
- name: The instrument's own selftest (no measurement taken)
2936+
run: python scripts/perf_baseline.py --selftest
2937+
- name: The instrument controls (firewall, both identity domains, provenance)
2938+
run: python tests/test_perf_instrument.py
2939+
# The Round 7 apparatus is a classifier and a structural preflight, both
2940+
# exercisable without a clock. The exclusivity control is the one that
2941+
# matters: the preregistration's first outcome table let one dataset
2942+
# satisfy two contradictory verdicts, and nothing in the process that
2943+
# produced it would have noticed.
2944+
- name: Round 7 apparatus controls (outcome exclusivity, zero guard, B1-B4)
2945+
run: python tests/test_round7_apparatus.py
2946+
# The calibration policy is pure: no clock, no files, no randomness, and no
2947+
# constant values at all. It is step 2 of the ratified sequence, written
2948+
# before any training corpus exists, so every claim it makes is checkable
2949+
# here on both platforms and none of it needs a measurement.
2950+
- name: Calibration policy controls (no defaults, symmetry, exact fit)
2951+
run: python tests/test_calibration_policy.py
2952+
# Step 4 froze WHICH BYTES the policy is, and nothing else. These controls
2953+
# recompute that digest from git blobs at the frozen commit, and refuse the
2954+
# artifact outright if it ever grows a field that is not identity.
2955+
- name: Calibration policy freeze controls (step 4 digest identity)
2956+
run: python tests/test_calibration_freeze.py
2957+
# Step 5 records the five constants the owner chose, bound to the step 4
2958+
# identity. The frozen implementation is the judge of its own ranges, so
2959+
# these controls hand it the committed pairs rather than re-stating them.
2960+
- name: Calibration design constants controls (step 5 ratified values)
2961+
run: python tests/test_calibration_constants.py
2962+
# Step 6 preregisters a training collection that has not happened. These
2963+
# controls prove the protocol is complete and bound, and that the scope
2964+
# combiner reads the frozen selector's own margin instead of copying it.
2965+
- name: Training preregistration controls (step 6 protocol + scope binding)
2966+
run: python tests/test_training_prereg.py
2967+
# Step 7 needs two dedicated measurement hosts that do not exist yet. This
2968+
# captures WHAT a machine is and never how fast it is: no clock, no resource
2969+
# observation, proved by walking the AST rather than the prose. It also
2970+
# proves the tool sits outside all three frozen source sets, so preparing
2971+
# step 7 cannot move a digest steps 4, 5 and 6 are already bound to.
2972+
- name: Step 7 environment capture controls (measurement-free identity manifest)
2973+
run: python tests/test_step7_envcapture.py
2974+
# The same tool run for real on this runner. It writes nothing, starts no
2975+
# clock, and is NOT a binding input: a hosted runner is not admissible for
2976+
# step 7, and the manifest records the runner and CI flag that say so.
2977+
- name: Step 7 environment capture selftest (writes nothing, starts nothing)
2978+
run: python scripts/step7/envcapture.py --selftest
2979+
# Plan mode builds the arms, preflights THOSE bytes, freezes their
2980+
# identities and fixes the execution order — then returns before the
2981+
# timing function is reachable. Linux only: the arms are ELF binaries.
2982+
- name: Round 7 runner — plan mode, no clock started
2983+
if: matrix.os == 'ubuntu-latest'
2984+
run: |
2985+
python scripts/round7/runner.py \
2986+
--candidate "$PWD/rust/target/release/own-cli" \
2987+
--plan --build-dir "$RUNNER_TEMP/round7-arms" \
2988+
--out "$RUNNER_TEMP/round7-plan.json"
2989+
# Decisive workloads: availability and pins only. No clock, no resource
2990+
# sampling — this step is what "enumerated, hashed, availability-checked"
2991+
# looks like when it is the only thing permitted.
2992+
- name: Decisive workloads — non-timed structural smoke
2993+
run: python scripts/perf_baseline.py --smoke-decisive
2994+
# The timed legacy calibration pair USED TO RUN HERE, and it is gone while
2995+
# step 7 is closed. It started a real stopwatch, produced forty timed cells
2996+
# per platform on every push and uploaded them, which made the step 6
2997+
# preregistration's own claim to take no new observation false on the very
2998+
# commit that made it. A preregistration that fixes "exactly one collection"
2999+
# while CI quietly gathers numbers every twelve minutes has built an
3000+
# epistemic side channel, whatever anyone intends to do with the output.
3001+
#
3002+
# What still proves the apparatus, all of it untimed: --selftest above, the
3003+
# instrument controls, the round 7 apparatus controls, the round 7 runner in
3004+
# plan mode, the decisive structural smoke, and the calibration policy,
3005+
# freeze, constants and training preregistration controls.
3006+
#
3007+
# training-no-incidental-measurement fails this suite if any workflow
3008+
# regains a path to a measurement entrypoint while the preregistration
3009+
# still records step 7 as unauthorised.
3010+
28973011
# P-014 Tier B: external-reference resolution. The SAME sample, run two ways, must give two
28983012
# verdicts — proving the extractor binds a THIRD-PARTY event only when its DLL is referenced:
28993013
# A (no refs) -> ObservableObject is an error type -> OWN050 (honest skip), no leak
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: P-022 merge gate
2+
3+
# The merge order for the #263 preregistration, as a check rather than an
4+
# agreement. `mergegate.py` is run against the commit a merge would PRODUCE —
5+
# for a pull_request event that is `github.sha`, the merge ref, not the branch
6+
# head — because a PR number proves someone pressed a button and says nothing
7+
# about what the merged tree contains.
8+
#
9+
# Two jobs, and the gate needs the controls: a gate whose own controls are
10+
# failing must not be the thing that says a merge is safe. A failed controls job
11+
# leaves the gate job unreported, which a required check reads as unsatisfied.
12+
#
13+
# This workflow is one half of the wiring. The other half is a ruleset requiring
14+
# these two checks; without it the job reports and nothing is prevented. The
15+
# names below are the contexts that ruleset must name:
16+
#
17+
# P-022 merge gate controls
18+
# P-022 merge gate
19+
#
20+
# Least privilege as elsewhere in this repository: read-only, and every
21+
# third-party `uses:` pinned to a commit SHA with its version in a comment.
22+
23+
permissions:
24+
contents: read
25+
26+
on:
27+
pull_request:
28+
workflow_dispatch:
29+
30+
jobs:
31+
controls:
32+
name: P-022 merge gate controls
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
36+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
37+
with:
38+
python-version: "3.11"
39+
- name: the gate's own controls (fixtures ship the real tools and mutate them)
40+
run: python tests/test_step7_mergegate.py
41+
- name: the wiring's controls (applicability and co-change)
42+
run: python tests/test_step7_mergegate_ci.py
43+
44+
gate:
45+
name: P-022 merge gate
46+
needs: controls
47+
runs-on: ubuntu-latest
48+
steps:
49+
# Full history: the co-change rule compares the gate's own files against
50+
# the base commit, which a shallow clone would not carry.
51+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
52+
with:
53+
fetch-depth: 0
54+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
55+
with:
56+
python-version: "3.11"
57+
- name: the gate, against the commit this merge would produce
58+
env:
59+
# Read through the environment rather than interpolated into the
60+
# script body, so nothing from the event can be read as shell.
61+
MERGE_COMMIT: ${{ github.sha }}
62+
BASE_COMMIT: ${{ github.event.pull_request.base.sha }}
63+
run: |
64+
set -euo pipefail
65+
if [ -n "${BASE_COMMIT}" ]; then
66+
python scripts/step7/mergegate_ci.py --repo . \
67+
--commit "${MERGE_COMMIT}" --base "${BASE_COMMIT}"
68+
else
69+
python scripts/step7/mergegate_ci.py --repo . --commit "${MERGE_COMMIT}"
70+
fi
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"artifact": "p022-263a-calibration-design-constants",
3+
"bound_measurement_harness_digest": "104c384d01bf6060bdec1e7c916053ddb04b97fcbd0b39f8a4fc57b8f139672f",
4+
"bound_policy_implementation_digest": "c3068ed7fa880a7083866ead25fe8bf65c87889d242d8af1f7eee01582cd5cbf",
5+
"constants": {
6+
"G": [
7+
1,
8+
10
9+
],
10+
"M": [
11+
2,
12+
1
13+
],
14+
"N_ladder": [
15+
5,
16+
15,
17+
45
18+
],
19+
"R_runs": 5,
20+
"q": [
21+
19,
22+
20
23+
]
24+
},
25+
"ratified_by": "owner"
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"artifact": "p022-263a-calibration-policy-freeze",
3+
"measurement_harness_digest": "104c384d01bf6060bdec1e7c916053ddb04b97fcbd0b39f8a4fc57b8f139672f",
4+
"policy_implementation_digest": "c3068ed7fa880a7083866ead25fe8bf65c87889d242d8af1f7eee01582cd5cbf",
5+
"policy_implementation_digest_framing": "sha256 over the source set ordered by the UTF-8 bytes of each repo-relative POSIX path. Each file contributes, with no header and no separator: its path byte length as an 8-byte big-endian unsigned integer, its path's exact UTF-8 bytes, its blob byte length as an 8-byte big-endian unsigned integer, and its exact git blob bytes.",
6+
"policy_source_commit": "b4f657a0abdfdfaae199cbc7eee0c47acd8b0057",
7+
"policy_source_files": [
8+
{
9+
"blob_sha1": "ec3fab8bbd8d5e0d0a0e1c6f60e7249d97f3ef4f",
10+
"path": "scripts/calibration/policy.py",
11+
"size_bytes": 25486
12+
}
13+
],
14+
"policy_source_root": "scripts/calibration/",
15+
"policy_source_selector": "all committed *.py recursively under policy_source_root at policy_source_commit",
16+
"policy_source_tree": "2f49574433fea23f6158f4d8544a3b1543c718d4"
17+
}

0 commit comments

Comments
 (0)