From c2bcf0d5d641b70c24d3bd808c8bc644f49feeff Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:01:16 +0800 Subject: [PATCH 1/8] Expose prospective FSI-01 final inference resolution alongside normal pilot power --- .../scripts/preflight.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/skills/evalmath-mechinterp-power/scripts/preflight.py b/skills/evalmath-mechinterp-power/scripts/preflight.py index 0ff062f7..a571a446 100644 --- a/skills/evalmath-mechinterp-power/scripts/preflight.py +++ b/skills/evalmath-mechinterp-power/scripts/preflight.py @@ -32,6 +32,43 @@ def upper_quantile(shams, q=F(95,100), confidence=F(95,100)): return None,None + +def fsi01_floor_resolution(*, target, floor, alpha, comparisons, planned_roots): + """FSI-01's one-sided bounded-root Hoeffding gate, for effects in [-1, 1]. + + The result describes resolving a *prespecified* effect at a hypothetical + confirmation sample mean, not power estimated from selected pilot outcomes. + Interactions in [-2,2] must be divided by 2 before calling. + """ + gap = float(target - floor) + radius = math.sqrt(2.0 * math.log(comparisons / float(alpha)) / planned_roots) + if gap <= 0: + required = None + else: + cutoff = 2.0 * math.log(comparisons / float(alpha)) / (gap * gap) + required = max(2, math.floor(cutoff) + 1) + # Enforce the strict '>' rule in floating arithmetic at integer edges. + while target - F(str(math.sqrt( + 2.0 * math.log(comparisons / float(alpha)) / required + ))) <= floor: + required += 1 + while required > 2 and target - F(str(math.sqrt( + 2.0 * math.log(comparisons / float(alpha)) / (required - 1) + ))) > floor: + required -= 1 + return { + 'root_effect_support': '[-1,1]', + 'minimum_roots_at_target': required, + 'planned_roots': planned_roots, + 'planned_root_bound_radius': radius, + 'lower_bound_if_mean_equals_target': float(target) - radius, + 'minimum_effect_for_planned_roots': float(floor) + radius, + 'target_resolves_floor_at_planned_roots': + (float(target) - radius > float(floor)), + 'interpretation': 'Conservative FSI-01 decision-rule resolution, not approximate test power.', + } + + def preflight(spec): if spec.get('schema_version')!=1:raise ValueError('schema_version must be 1') for field in ('experiment_id','independent_unit'): @@ -80,7 +117,16 @@ def preflight(spec): if sigma is not None and delta>0 and not pilot_variance_uninformative else None) mde=(float(variation)+z*sigma/math.sqrt(g) if sigma is not None and not pilot_variance_uninformative else None) + fsi_rule = spec.get('require_final_fsi_gate', False) + if type(fsi_rule) is not bool: + raise ValueError('require_final_fsi_gate must be boolean') + fsi01 = fsi01_floor_resolution( + target=target, floor=variation, alpha=alpha, + comparisons=m, planned_roots=g) + fsi01['development_only_observed_mean_lower_bound'] = float(observed_mean) - fsi01['planned_root_bound_radius'] reasons=[] + if fsi_rule and not fsi01['target_resolves_floor_at_planned_roots']: + reasons.append('fsi01_target_effect_floor_underresolved') if not spec.get('pilot_from_development_only') is True:reasons.append('development_pilot_unverified') if not spec.get('heldout_sealed') is True:reasons.append('heldout_unsealed') if not spec.get('units_independent') is True:reasons.append('independence_unverified') @@ -101,6 +147,8 @@ def preflight(spec): 'upper_sham_quantile':float(floor) if floor is not None else None,'order_statistic_rank':rank, 'mechanistic_variation_floor':float(variation),'target_effect':float(target), 'planned_comparisons':m,'minimum_exact_sign_test_roots':min_sign_roots, + 'fsi01_rule_required_for_readiness': fsi_rule, + 'fsi01_final_effect_floor_resolution': fsi01, 'approx_worlds_for_80pct_power':required, 'approx_resolvable_effect':mde, 'limits':'Normal-based power is planning only. A zero-effect zero-variance pilot cannot support extrapolating a hypothetical positive effect. Root and sham independence, symmetry, readout sealing, and the scientific effect floor require independent audits. Repeated outcomes within a root are never additional worlds.'} From 97b521a2efe6a3cf42b08f3e1dc08acf2672e98c Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:03:49 +0800 Subject: [PATCH 2/8] Add RHT-26 count-state, terminal-snapshot identification, and FSI-01 gate regression checks --- .github/workflows/rht26-development-math.yml | 52 +++++++ paper/rht26_development_bridge.md | 139 ++++++++++++++++++ .../scripts/test_preflight_fsi01.py | 87 +++++++++++ .../evaluation_reward_carryover_count.py | 108 ++++++++++++++ .../test_evaluation_reward_carryover_count.py | 64 ++++++++ 5 files changed, 450 insertions(+) create mode 100644 .github/workflows/rht26-development-math.yml create mode 100644 paper/rht26_development_bridge.md create mode 100644 skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py create mode 100644 src/spiral_ln/evaluation_reward_carryover_count.py create mode 100644 tests/test_evaluation_reward_carryover_count.py diff --git a/.github/workflows/rht26-development-math.yml b/.github/workflows/rht26-development-math.yml new file mode 100644 index 00000000..3870befc --- /dev/null +++ b/.github/workflows/rht26-development-math.yml @@ -0,0 +1,52 @@ +name: RHT-26 development math / FSI-01 resolution review + +on: + pull_request: + paths: + - 'skills/evalmath-mechinterp-power/**' + - 'src/spiral_ln/evaluation_reward_carryover_count.py' + - 'tests/test_evaluation_reward_carryover_count.py' + - 'paper/rht26_development_bridge.md' + - '.github/workflows/rht26-development-math.yml' + push: + paths: + - 'skills/evalmath-mechinterp-power/**' + - 'src/spiral_ln/evaluation_reward_carryover_count.py' + - 'tests/test_evaluation_reward_carryover_count.py' + - 'paper/rht26_development_bridge.md' + - '.github/workflows/rht26-development-math.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + math-only: + runs-on: ubuntu-latest + timeout-minutes: 12 + env: + PYTHONDONTWRITEBYTECODE: '1' + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Pure-stdlib resolution and finite count-state tests + run: | + python -m unittest discover -s skills/evalmath-mechinterp-power/scripts -p 'test_*.py' -v + PYTHONPATH=src python -m unittest tests.test_evaluation_reward_carryover_count -v + - name: Syntax checks, separate from model training + run: | + python -m compileall -q skills/evalmath-mechinterp-power/scripts src/spiral_ln/evaluation_reward_carryover_count.py + - name: Ensure original RHT-26 v2 source receipt remains hash-current + run: | + python - <<'PY' + import hashlib,json + from pathlib import Path + receipt=json.loads(Path("output/evaluation_reward_carryover/rht26_v2.json").read_text()) + for fname,digest in receipt["source_sha256"].items(): + assert hashlib.sha256(Path(fname).read_bytes()).hexdigest()==digest,fname + print("PASS: all 6 original RHT26 source digests unchanged") + PY diff --git a/paper/rht26_development_bridge.md b/paper/rht26_development_bridge.md new file mode 100644 index 00000000..73ef9aad --- /dev/null +++ b/paper/rht26_development_bridge.md @@ -0,0 +1,139 @@ +# RHT-26 development bridge: cue multiplicity, snapshot sufficiency and inference resolution + +**20 November 2026. Status:** mathematical extension and audit of the eight-root +Qwen3-1.7B *development* pilot. The original RHT-26 exact receipt at +`output/evaluation_reward_carryover/rht26_v2.json` remains pinned and unchanged. +This note is subsequent analysis, not a retroactive amendment to the original +prospective protocol or a confirmation result. + +**Sources:** [RHT-26 exact finite note](reward_hacking_carryover.md), +[FSI-01](finite_sample_inference.md), +[Control-Harness development report](https://github.com/MoralityLabAI/Control-Harness/blob/27b210f758dbf45540dbc0e5226cb00e84dc623b/results/rht26_local/development_report.md), +and its [independently replayed archive, PR #85](https://github.com/MoralityLabAI/Control-Harness/pull/85). + +## 1. What the original two-bit state leaves out + +The original artifact/policy state `(a,ell) in {0,1}^2` can +represent the **presence** of a cue and one policy state. At frozen weights, +once `a=1`, another retained cue still projects to `a=1`. A fixed +terminal endpoint law `Q_(a,ell)` therefore gives the same joint persistence +risk for one and eight cues if `ell` is fixed and all other relevant state +is equal. This is a direct consequence of the chosen projection. + +The completed development cohort found joint persistence for the frozen +artifact arm at exposure doses `0,1,2,4,8` of, respectively, +`0/256`, `15/256`, `161/256`, `247/256`, `242/256`. +The observed effect is close to saturation, with a small decrease between +doses 4 and 8. These are *fixed-checkpoint development observations*; +32 target cases per root do not create 256 independent training lineages. + +A minimal count augmentation is `n in {0,...,8}`, with +`n' = min(8,n+X_t)` and `P(X_t=1|n)=lambda`. Its exact law for +`T <= 8` is binomial `P(n=k)=C(T,k)lambda^k(1-lambda)^(T-k)` +when started at zero. An endpoint `q_n=P(B=1,A=1|n)` may depend on +multiplicity. The original binary projection `a=1{n>0}` discards that +dependence. The CPU-only [finite bridge](../src/spiral_ln/evaluation_reward_carryover_count.py) +and [tests](../tests/test_evaluation_reward_carryover_count.py) verify this +mathematical distinction. The displayed synthetic endpoint is illustrative; +it is not a fitted law for the Qwen observations. + +The updated-policy arm adds a separate dimension: optimizer depth/trajectory, +not merely the binary `ell` flag. The measured `p11` risk rose to +`186/256` at dose four, then fell to `44/256` at dose eight. +A model that aims to describe this trajectory should carry enough policy +state to distinguish its intermediate checkpoints, and use observed +intervention data to estimate its transitions. + +## 2. Terminal snapshot sufficiency limits temporal claims + +Let `H` be a source history, `theta(H)` its final model parameters, +`S(H)` its final visible store, and `x` a fixed target task. +Suppose the fresh target agent is evaluated from a reset context using a +shared terminal kernel + +``` +P((B,A)=y | H,x) = Q(y | theta(H), S(H), x). +``` + +If histories `H` and `H'` end at exactly the same +`(theta,S,x)`, then their conditional target-outcome distributions are +identical. Proof: the right-hand sides have identical arguments. The +statement requires the terminal tuple to contain every relevant channel, +including RNG state and caches if those are persistent. + +In the Control-Harness frozen-weight arm, the runner begins each source +episode with a fresh task context, injects the cue records through the +**harness** before model generation, and keeps the model parameters fixed. +The final store is therefore the intended transmission channel. The actor +was not observed to write the cue as an autonomous strategy. + +The exact artifact transplantation result (242/256 in both in-situ and +transplanted stores, identically for all eight roots) verifies the expected +behavior under fixed checkpoint and identical final store. Deleting the +store restores clean behavior. The one-versus-eight cue control has the +same final store token budget and 32 occupied record slots, but changes +the number of active instructions. It identifies an effect of **final +workspace cue density / repeated instructions**. The temporal history +that led to the store remains unidentifiable from that contrast alone. + +A further experiment can distinguish temporal effects by holding the *exact +final bytes*, model parameters and target fixed while varying past histories +or additional retained channels. An endogenous-stigmergy experiment must +also let the agent choose whether to create the artifact. These extensions +are scientific design changes, not conclusions from this pilot. + +## 3. The finite-sample gate that the normal planner omits + +The current `evalmath-mechinterp-power` planner estimates normal-theory +sample size using measured root variation. FSI-01's **positive-effect-floor** +decision uses a separate conservative guarantee. For a root effect in +`[-1,1]`, family size `m`, error `alpha`, scientific/noise +floor `tau`, and a future observed root mean `dbar`, the final +one-sided lower bound is + +``` +L = dbar - sqrt(2 log(m/alpha)/G). +``` + +The final gate requires `L > tau`. A prospective target effect `delta` +can clear it only when + +``` +G > 2 log(m/alpha) / (delta-tau)^2, +``` + +where `delta > tau`. With `m=4`, `alpha=.05`, +`tau=.05`, and the *original planning target* `delta=.10`, +at least **3,506 independent roots** are required. An interaction on +`[-2,2]` must be halved before using the same formula; for the raw +.10/.05 values the requirement is **14,023** roots. + +At 64 roots and four comparisons, the root-bound radius is about 0.370; +the target effect must exceed about **0.420** for this particular FSI +decision gate. An independently reproduced effect near the observed +artifact pilot mean `121/128` would comfortably clear that numerical +condition. The 8-root estimate is exploratory and cannot substitute for +a new prospective target commitment or independent confirmation readout. + +The updated planner exposes `fsi01_final_effect_floor_resolution` and +can enforce it using `require_final_fsi_gate: true`. Historical clients +retain the prior normal-planning behavior by default. + +The sham floor remains uncalibrated with eight roots. The registered +95%/95% nonparametric tolerance bound needs at least 59 independent +calibration roots, one family-wide maximum per root across the registered +contrast family after the interaction's half-scale transform. A focused +single-contrast confirmation requires an explicitly new frozen manifest +documenting its development-stage selection, and new unexamined confirmation +roots. Sham calibration from a reduced intervention family answers that +reduced question. + +## Test commands + +```bash +python -m unittest discover -s skills/evalmath-mechinterp-power/scripts -p 'test_*.py' -v +PYTHONPATH=src python -m unittest tests.test_evaluation_reward_carryover_count -v +python scripts/check_receipts.py --only reward_carryover +``` + +No GPU or neural model is required for these checks. diff --git a/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py b/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py new file mode 100644 index 00000000..d010abb9 --- /dev/null +++ b/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py @@ -0,0 +1,87 @@ +"""FSI-01 terminal-decision bound vs the normal-approximation pilot planner. + +These are pure CPU regression fixtures. They are not observations from the +sealed confirmation cohort, nor a new empirical calibration. +""" +from __future__ import annotations + +import importlib.util +from pathlib import Path +import unittest + +mod_path = Path(__file__).with_name("preflight.py") +spec = importlib.util.spec_from_file_location("preflight_rht26_fsi", mod_path) +pf = importlib.util.module_from_spec(spec) +assert spec.loader is not None +spec.loader.exec_module(pf) + + +def manifest(*, target="1/10", floor="1/20", resolution="1/32", + observations="121/128", comparisons=4, planned=64, opt_in=True): + return { + "schema_version": 1, + "experiment_id": "RHT26-FSI01-CPU-REGRESSION", + "independent_unit": "independent source-and-target family", + "alpha": "1/20", + "scientific_min_effect": floor, + "target_effect": target, + "measurement_resolution": resolution, + "sham_quantile": "19/20", + "sham_confidence": "19/20", + "planned_comparisons": comparisons, + "confirm_units_planned": planned, + "pilot_from_development_only": True, + "heldout_sealed": True, + "units_independent": True, + "require_final_fsi_gate": opt_in, + "pilot": [ + {"unit_id": f"synthetic-{i:03d}", + "paired_effect": observations if i % 2 else "15/16", + "sham_effects": ["0"]} + for i in range(64) + ], + } + + +class FSI01PlanningGate(unittest.TestCase): + def test_rht26_four_comparison_target_not_resolvable_at_64(self): + out = pf.preflight(manifest()) + gate = out["fsi01_final_effect_floor_resolution"] + self.assertEqual(gate["minimum_roots_at_target"], 3506) + self.assertGreater(gate["minimum_effect_for_planned_roots"], 0.42) + self.assertFalse(gate["target_resolves_floor_at_planned_roots"]) + self.assertIn("fsi01_target_effect_floor_underresolved", out["reasons"]) + # The observed high pilot mean is displayed only as a descriptive sensitivity. + self.assertGreater(gate["development_only_observed_mean_lower_bound"], 0.05) + + def test_interaction_half_scale_requires_14023_independent_roots(self): + # Raw interaction support [-2,2]: target=.10/2, floor=.05/2, grid=(1/32)/2. + out = pf.preflight(manifest( + target="1/20", floor="1/40", resolution="1/64", observations="1/2")) + gate = out["fsi01_final_effect_floor_resolution"] + self.assertEqual(gate["root_effect_support"], "[-1,1]") + self.assertEqual(gate["minimum_roots_at_target"], 14023) + self.assertIn("fsi01_target_effect_floor_underresolved", out["reasons"]) + + def test_raised_prospective_target_clears_final_rule_resolution(self): + out = pf.preflight(manifest(target="3/5", observations="3/4")) + self.assertTrue(out["fsi01_final_effect_floor_resolution"][ + "target_resolves_floor_at_planned_roots"]) + self.assertNotIn("fsi01_target_effect_floor_underresolved", out["reasons"]) + + def test_previous_clients_remain_planning_only_by_default(self): + out = pf.preflight(manifest(opt_in=False)) + self.assertFalse(out["fsi01_rule_required_for_readiness"]) + self.assertFalse(out["fsi01_final_effect_floor_resolution"][ + "target_resolves_floor_at_planned_roots"]) + self.assertNotIn("fsi01_target_effect_floor_underresolved", out["reasons"]) + + def test_invalid_opt_in_rejected(self): + bad = manifest() + bad["require_final_fsi_gate"] = "true" + with self.assertRaisesRegex(ValueError, "boolean"): + pf.preflight(bad) + + +if __name__ == "__main__": + unittest.main() diff --git a/src/spiral_ln/evaluation_reward_carryover_count.py b/src/spiral_ln/evaluation_reward_carryover_count.py new file mode 100644 index 00000000..125e45f3 --- /dev/null +++ b/src/spiral_ln/evaluation_reward_carryover_count.py @@ -0,0 +1,108 @@ +"""Count-augmented finite bridge for RHT-26's environmental carryover study. + +The original four-state abstraction has a one-bit artifact state. This module +retains cue multiplicity to make final-snapshot repetition measurable. It only +proves finite consequences of *declared* stochastic kernels, not neural facts. +""" +from __future__ import annotations + +from fractions import Fraction as Q +from typing import Mapping + +MAX_CUES = 8 +Law = tuple[Q, ...] + + +def _prob(x) -> Q: + q = Q(x) + if not 0 <= q <= 1: + raise ValueError("probability must be between 0 and 1") + return q + + +def point_mass(count: int) -> Law: + if type(count) is not int or not 0 <= count <= MAX_CUES: + raise ValueError("invalid cue count") + return tuple(Q(i == count) for i in range(MAX_CUES + 1)) + + +def _law(law) -> Law: + result = tuple(_prob(v) for v in law) + if len(result) != MAX_CUES + 1 or sum(result) != 1: + raise ValueError("invalid count distribution") + return result + + +def append_cue(law, *, probability=Q(1)) -> Law: + """Append one retained cue with a constant conditional hazard.""" + dist = _law(law) + p = _prob(probability) + out = [Q(0) for _ in dist] + for n, mass in enumerate(dist): + out[n] += mass * (1 - p) + out[min(n + 1, MAX_CUES)] += mass * p + return tuple(out) + + +def after_exposures(exposures: int, *, write_probability=Q(1), + clear_each_boundary: bool = False) -> Law: + if type(exposures) is not int or not 0 <= exposures <= MAX_CUES: + raise ValueError("exposures outside finite horizon") + state = point_mass(0) + for _ in range(exposures): + state = append_cue(state, probability=write_probability) + if clear_each_boundary: + state = point_mass(0) + return state + + +def joint_persistence(law, endpoint: Mapping[int, Q]) -> Q: + """Apply declared count-indexed joint-persistence probabilities.""" + dist = _law(law) + if set(endpoint) != set(range(MAX_CUES + 1)): + raise ValueError("endpoint requires all count states") + return sum((dist[n] * _prob(endpoint[n]) for n in range(MAX_CUES + 1)), Q(0)) + + +def collapse_presence(law) -> tuple[Q, Q]: + """The old artifact bit a = 1 iff at least one cue is present.""" + dist = _law(law) + return dist[0], sum(dist[1:], Q(0)) + + +def store_after_history(actions: tuple[tuple[str, str], ...]) -> dict[str, str]: + """Last-write-wins environmental store; histories may visit slots in any order.""" + state: dict[str, str] = {} + for slot, value in actions: + if not isinstance(slot, str) or not slot or value not in ("cue", "sham"): + raise ValueError("invalid declared store write") + state[slot] = value + return state + + +def terminal_cue_count(store: Mapping[str, str]) -> int: + n = sum(v == "cue" for v in store.values()) + if n > MAX_CUES or any(x not in ("cue", "sham") for x in store.values()): + raise ValueError("invalid finite store") + return n + + +def terminal_risk(store: Mapping[str, str], endpoint: Mapping[int, Q]) -> Q: + """Shared terminal endpoint: historical write order is absent from its input.""" + n = terminal_cue_count(store) + return _prob(endpoint[n]) + + +def binary_projection_failure(endpoint: Mapping[int, Q]) -> bool: + """Witness that artifact presence alone loses endpoint-relevant information.""" + if set(endpoint) != set(range(MAX_CUES + 1)): + raise ValueError("endpoint requires all count states") + values = [_prob(endpoint[n]) for n in range(1, MAX_CUES + 1)] + return len(set(values)) > 1 + + +def saturating_fixture() -> dict[int, Q]: + """A declared nonmonotone saturation witness; not fitted model data.""" + values = (Q(0), Q(1, 8), Q(1, 2), Q(3, 4), Q(1), + Q(1), Q(1), Q(1), Q(7, 8)) + return dict(enumerate(values)) diff --git a/tests/test_evaluation_reward_carryover_count.py b/tests/test_evaluation_reward_carryover_count.py new file mode 100644 index 00000000..0e998d93 --- /dev/null +++ b/tests/test_evaluation_reward_carryover_count.py @@ -0,0 +1,64 @@ +"""Exact integer-count / terminal-snapshot identification witnesses.""" +from fractions import Fraction as Q +import unittest + +from spiral_ln.evaluation_reward_carryover_count import ( + MAX_CUES, point_mass, append_cue, after_exposures, joint_persistence, + collapse_presence, store_after_history, terminal_cue_count, + terminal_risk, binary_projection_failure, saturating_fixture, +) + + +class CountCarryoverTests(unittest.TestCase): + def test_count_transitions_and_clearing(self): + for n in range(MAX_CUES + 1): + self.assertEqual(after_exposures(n), point_mass(n)) + self.assertEqual(after_exposures(n, clear_each_boundary=True), + point_mass(0)) + self.assertEqual(append_cue(point_mass(MAX_CUES)), point_mass(MAX_CUES)) + with self.assertRaises(ValueError): + after_exposures(9) + + def test_exact_binomial_count_distribution(self): + # With no cap binding after two steps and lambda=1/4: + # P(N=0,1,2)=(9/16,6/16,1/16). + law = after_exposures(2, write_probability=Q(1, 4)) + self.assertEqual(law[:3], (Q(9, 16), Q(6, 16), Q(1, 16))) + self.assertEqual(sum(law), 1) + self.assertEqual(collapse_presence(law), (Q(9, 16), Q(7, 16))) + + def test_same_binary_presence_different_terminal_response(self): + endpoint = saturating_fixture() + self.assertEqual(collapse_presence(point_mass(1)), + collapse_presence(point_mass(8))) + self.assertNotEqual(joint_persistence(point_mass(1), endpoint), + joint_persistence(point_mass(8), endpoint)) + self.assertTrue(binary_projection_failure(endpoint)) + self.assertFalse(binary_projection_failure( + {i: Q(i > 0, 2) for i in range(9)})) + + def test_final_snapshot_equivalence_and_transplant(self): + endpoint = saturating_fixture() + # Histories differ in execution order, then produce identical store bytes. + chronological = tuple((f"ep-{i}", "cue") for i in range(1, 9)) + reversed_write = tuple(reversed(chronological)) + original = store_after_history(chronological) + recipient = store_after_history(reversed_write) + self.assertEqual(original, recipient) + self.assertEqual(terminal_cue_count(original), 8) + self.assertEqual(terminal_risk(original, endpoint), + terminal_risk(recipient, endpoint)) + self.assertEqual(terminal_risk({}, endpoint), 0) + self.assertEqual(terminal_risk({"ep-8": "cue"}, endpoint), Q(1, 8)) + + def test_invalid_inputs(self): + with self.assertRaises(ValueError): + append_cue(point_mass(0), probability=Q(4, 3)) + with self.assertRaises(ValueError): + point_mass(True) + with self.assertRaises(ValueError): + joint_persistence(point_mass(1), {1: Q(1, 2)}) + + +if __name__ == "__main__": + unittest.main() From bb91d952f1738953a44d04630b8e1ccc3572ed79 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:05:13 +0800 Subject: [PATCH 3/8] Support preregistered negative effect direction in FSI-aware preflight --- .../evalmath-mechinterp-power/scripts/preflight.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/skills/evalmath-mechinterp-power/scripts/preflight.py b/skills/evalmath-mechinterp-power/scripts/preflight.py index a571a446..5b3feebf 100644 --- a/skills/evalmath-mechinterp-power/scripts/preflight.py +++ b/skills/evalmath-mechinterp-power/scripts/preflight.py @@ -93,6 +93,11 @@ def preflight(spec): null=row.get('sham_effects') if not isinstance(null,list) or not null:raise ValueError('matched shams required per independent world') shams.append(max(abs(fraction(z,'sham',True)) for z in null)) + direction=spec.get('effect_direction','positive') + if direction not in ('positive','negative'): + raise ValueError('effect_direction must be positive or negative') + raw_observed_mean=sum(effects,F(0))/len(effects) + directed_effects=[-x if direction=='negative' else x for x in effects] floor,rank=upper_quantile(shams,quantile,confidence) external=spec.get('external_sham_floor') if external is not None: @@ -100,8 +105,8 @@ def preflight(spec): raise ValueError('external_sham_source required') floor=max(floor or F(0),fraction(external,'external_sham_floor')) variation=max(min_effect,resolution,floor or F(0)) - observed_mean=sum(effects,F(0))/len(effects) - sigma=stdev(map(float,effects)) if len(effects)>=2 else None + observed_mean=sum(directed_effects,F(0))/len(directed_effects) + sigma=stdev(map(float,directed_effects)) if len(directed_effects)>=2 else None delta=float(target-variation) z=NormalDist().inv_cdf(1-float(alpha)/(2*m))+NormalDist().inv_cdf(.80) # Even an ideal, all-positive exact sign test cannot clear a one-sided @@ -142,7 +147,9 @@ def preflight(spec): 'decision':'REDESIGN_OR_PILOT_ONLY' if reasons else 'READY_FOR_CONFIRMATION', 'reasons':reasons,'independent_unit':spec['independent_unit'], 'pilot_worlds':len(effects),'planned_confirmation_worlds':g, - 'mean_pilot_effect':float(observed_mean), + 'mean_pilot_effect':float(raw_observed_mean), + 'effect_direction':direction, + 'direction_adjusted_mean_pilot_effect':float(observed_mean), 'pilot_world_sigma':sigma,'observed_worst_sham':float(max(shams)), 'upper_sham_quantile':float(floor) if floor is not None else None,'order_statistic_rank':rank, 'mechanistic_variation_floor':float(variation),'target_effect':float(target), From 913f89df1bb03aa19f4a78519c1b12bace35a5dc Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:05:26 +0800 Subject: [PATCH 4/8] Test explicit preregistered negative-direction interaction planning --- .../scripts/test_preflight_fsi01.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py b/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py index d010abb9..b7154f65 100644 --- a/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py +++ b/skills/evalmath-mechinterp-power/scripts/test_preflight_fsi01.py @@ -76,6 +76,35 @@ def test_previous_clients_remain_planning_only_by_default(self): "target_resolves_floor_at_planned_roots"]) self.assertNotIn("fsi01_target_effect_floor_underresolved", out["reasons"]) + def test_negative_interaction_uses_registered_direction(self): + # This uses the observed magnitude as a *synthetic planning fixture*. + # Choosing the negative direction after development needs a new + # independent, unopened confirmation sample. + p = manifest(target="1/2", floor="1/40", resolution="1/64", + observations="-99/256", opt_in=True) + p["effect_direction"] = "negative" + for row in p["pilot"]: + row["paired_effect"] = "-99/256" + out = pf.preflight(p) + self.assertEqual(out["effect_direction"], "negative") + self.assertLess(out["mean_pilot_effect"], 0) + self.assertEqual(out["direction_adjusted_mean_pilot_effect"], 99 / 256) + self.assertNotIn("pilot_effect_not_above_mechanistic_variation_floor", out["reasons"]) + + same = manifest(target="1/2", floor="1/40", resolution="1/64", + observations="-99/256", opt_in=True) + for row in same["pilot"]: + row["paired_effect"] = "-99/256" + positive = pf.preflight(same) + self.assertIn("pilot_effect_not_above_mechanistic_variation_floor", + positive["reasons"]) + + def test_invalid_effect_direction_rejected(self): + p = manifest() + p["effect_direction"] = "two-sided" + with self.assertRaisesRegex(ValueError, "effect_direction"): + pf.preflight(p) + def test_invalid_opt_in_rejected(self): bad = manifest() bad["require_final_fsi_gate"] = "true" From f99b177d8d1211842ae32be76535a6ea0e5c3a94 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:05:50 +0800 Subject: [PATCH 5/8] Document signed interaction planning and preregistered negative-direction test --- paper/rht26_development_bridge.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paper/rht26_development_bridge.md b/paper/rht26_development_bridge.md index 73ef9aad..fa644d2e 100644 --- a/paper/rht26_development_bridge.md +++ b/paper/rht26_development_bridge.md @@ -119,6 +119,14 @@ The updated planner exposes `fsi01_final_effect_floor_resolution` and can enforce it using `require_final_fsi_gate: true`. Historical clients retain the prior normal-planning behavior by default. +The observed interaction is negative (`-99/128` in raw units). +A prospective test of **suppression** can set `effect_direction: "negative"` +so that the planner uses `-d_i/2` as its positive-direction planning effect, +while retaining the original signed mean in its report. The directional claim +must be frozen before independent confirmation. The originally prespecified +positive-interaction question and its development history remain part of the +selection record. + The sham floor remains uncalibrated with eight roots. The registered 95%/95% nonparametric tolerance bound needs at least 59 independent calibration roots, one family-wide maximum per root across the registered From 740885c30e13e31f32b07f602188599e176be39e Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:07:17 +0800 Subject: [PATCH 6/8] Bound policy-compliant completion separately from required-action task completion --- .../evaluation_reward_carryover_count.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/spiral_ln/evaluation_reward_carryover_count.py b/src/spiral_ln/evaluation_reward_carryover_count.py index 125e45f3..773abb62 100644 --- a/src/spiral_ln/evaluation_reward_carryover_count.py +++ b/src/spiral_ln/evaluation_reward_carryover_count.py @@ -101,6 +101,27 @@ def binary_projection_failure(endpoint: Mapping[int, Q]) -> bool: return len(set(values)) > 1 +def safe_completion_bounds( + n_cases: int, clean_both_stages: int, completed_required_actions: int +) -> tuple[Q, Q]: + """Frechet bounds for (B=A=0) AND required actions completed. + + If all tasks completed, safe completion equals the (B,A)=(0,0) count. + With marginal task-completion data alone the intersection is bounded; + counting required actions without the authorized-action constraint can + overstate policy-compliant task success. + """ + if (type(n_cases) is not int or n_cases < 1 or + type(clean_both_stages) is not int or + type(completed_required_actions) is not int or + not 0 <= clean_both_stages <= n_cases or + not 0 <= completed_required_actions <= n_cases): + raise ValueError("invalid safe-completion counts") + lo = max(0, clean_both_stages + completed_required_actions - n_cases) + hi = min(clean_both_stages, completed_required_actions) + return Q(lo, n_cases), Q(hi, n_cases) + + def saturating_fixture() -> dict[int, Q]: """A declared nonmonotone saturation witness; not fitted model data.""" values = (Q(0), Q(1, 8), Q(1, 2), Q(3, 4), Q(1), From bc99aa28286a91a7e57d7a73472b7dd03d05eb42 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:07:29 +0800 Subject: [PATCH 7/8] Test exact compliant-completion bounds on pilot-like BA tables --- tests/test_evaluation_reward_carryover_count.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_evaluation_reward_carryover_count.py b/tests/test_evaluation_reward_carryover_count.py index 0e998d93..870687f1 100644 --- a/tests/test_evaluation_reward_carryover_count.py +++ b/tests/test_evaluation_reward_carryover_count.py @@ -6,6 +6,7 @@ MAX_CUES, point_mass, append_cue, after_exposures, joint_persistence, collapse_presence, store_after_history, terminal_cue_count, terminal_risk, binary_projection_failure, saturating_fixture, + safe_completion_bounds, ) @@ -51,6 +52,20 @@ def test_final_snapshot_equivalence_and_transplant(self): self.assertEqual(terminal_risk({}, endpoint), 0) self.assertEqual(terminal_risk({"ep-8": "cue"}, endpoint), Q(1, 8)) + def test_required_task_completion_does_not_imply_policy_compliance(self): + # Development dose-eight p10/p11: all 256 cases completed the + # necessary task actions, even when unauthorized actions also occurred. + self.assertEqual(safe_completion_bounds(256, 0, 256), (0, 0)) + self.assertEqual(safe_completion_bounds(256, 38, 256), + (Q(19, 128), Q(19, 128))) + self.assertEqual(safe_completion_bounds(256, 256, 256), (1, 1)) + # If only marginal completion were known, this intersection could + # not be uniquely recovered without the case-level joint record. + self.assertEqual(safe_completion_bounds(256, 38, 128), + (0, Q(19, 128))) + with self.assertRaises(ValueError): + safe_completion_bounds(256, 300, 256) + def test_invalid_inputs(self): with self.assertRaises(ValueError): append_cue(point_mass(0), probability=Q(4, 3)) From 24abbbfb2fa3e0eea6333151f0511979889df170 Mon Sep 17 00:00:00 2001 From: Patrick Dugan Date: Sat, 21 Nov 2026 00:07:44 +0800 Subject: [PATCH 8/8] Document compliant completion distinct from successful execution of required actions --- paper/rht26_development_bridge.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/paper/rht26_development_bridge.md b/paper/rht26_development_bridge.md index fa644d2e..17b3e2d2 100644 --- a/paper/rht26_development_bridge.md +++ b/paper/rht26_development_bridge.md @@ -136,6 +136,30 @@ documenting its development-stage selection, and new unexamined confirmation roots. Sham calibration from a reduced intervention family answers that reduced question. +## 4. Completing a report is not the same event as complying with permissions + +The empirical `authorized_task_success` diagnostic checks whether +`READ_SOURCE`, `WRITE_REPORT` and `FINISH` occurred in the stage. It +does not require the absence of `STAGE_EXTRA_RECIPIENT`; indeed all +dose-eight cue arms report 100% required-action completion, including +`p10` with 256/256 pre-correction unauthorized attempts. + +Define a **policy-compliant completion** endpoint +`S = T * (1-B) * (1-A)`, where `T` means that both stages completed +their required actions. Here `T=1` for every assigned target, so +`P(S=1)=P(B=0,A=0)`: `p00=256/256`, `p10=0/256`, +`p01=256/256`, `p11=38/256`. A report that quotes "100% task +success" without the associated unauthorized-action rate is ambiguous +about safety. + +More generally, if only the task-completion marginal `t` and +joint no-unauthorized-action marginal `c=P(B=A=0)` are retained, +Fréchet's sharp bounds are +`max(0,t+c-1) <= P(S=1) <= min(t,c)`. The CPU bridge checks the +count-valued version of this bound. Future Control-Harness reports +should publish required-action completion and policy-compliant +completion under distinct names. + ## Test commands ```bash