Skip to content

test(integration): substrate-gate chain — composition of 7 invariant modules#425

Merged
neuron7xLab merged 1 commit intomainfrom
feat/substrate-gate-chain-integration
Apr 26, 2026
Merged

test(integration): substrate-gate chain — composition of 7 invariant modules#425
neuron7xLab merged 1 commit intomainfrom
feat/substrate-gate-chain-integration

Conversation

@neuron7xLab
Copy link
Copy Markdown
Owner

Single-file integration test proving the seven runtime-evaluable physics invariant modules from this session produce non-contradictory verdicts on a deterministic synthetic substrate state.

Tier composition

Tier Modules
ANCHORED arrow_of_time, anchored_substrate_gate (composite), bekenstein_cognitive_ceiling
EXTRAPOLATED cosmological_compute_bound, jacobson_observer_coherence
SPECULATIVE observer_bandwidth
Registry-only simulation_falsification (point-eval, not state-eval)

Six scenarios

  1. admissible baseline — all axes pass
  2. Bekenstein violation — composite inadmissible, BEKENSTEIN named, Arrow still passes
  3. Arrow violation — composite inadmissible, ARROW named, Bekenstein still passes
  4. multi-failure — failure_axes == ('BEKENSTEIN', 'ARROW') deterministic ordering
  5. SPECULATIVE bandwidth violation — anchored composite still admissible (tier separation)
  6. same-state consistency — every axis evaluated on baseline; tiers cross-checked; ladder shape + reasoning_tier asserted

Negative verification (anchored)

Locally inverted composite logic (admissible = bekenstein_holds and arrow_holdsadmissible = bekenstein_holds); scenario 3 FAILED with is_thermodynamically_admissible=True despite arrow_axis_holds=False. Source restored before commit. Proves integration test catches compositional regressions unit tests cannot.

Quality gate

Gate Result
pytest tests/integration/test_substrate_gate_chain.py 6/6 PASS
pytest tests/unit/physics/ + integration all green
ruff check / format clean
black --check clean
mypy --strict clean (1 file, 0 issues)
validate_tests.py --self-check 8/8 PASS

No mocked physics. No randomization. No Hypothesis — deterministic fixture only.

…modules

Single-file integration test proving the seven runtime-evaluable physics
invariant modules from this session produce non-contradictory verdicts
on a deterministic synthetic substrate state.

ANCHORED ingredients composed:
  - core.physics.arrow_of_time           (PROVENANCE_TIER = "ANCHORED")
  - core.physics.anchored_substrate_gate (PROVENANCE_TIER = "ANCHORED")
  - core.physics.thermodynamic_budget.bekenstein_cognitive_ceiling
    (registered ANCHORED via INV-BEKENSTEIN-COGNITIVE in INVARIANTS.yaml)

EXTRAPOLATED ingredients composed (independent witnesses, do not veto):
  - core.physics.cosmological_compute_bound
  - core.physics.jacobson_observer_coherence

SPECULATIVE ingredient composed (does not veto anchored composite):
  - core.physics.observer_bandwidth (downgraded in PR #421)

REGISTRY-ONLY (point-eval only, no state-eval):
  - core.physics.simulation_falsification — exercised via
    FalsificationLadder shape + reasoning_tier per signature.

Six scenarios:
  1. admissible baseline — all axes pass
  2. Bekenstein violation — composite inadmissible, BEKENSTEIN named
  3. Arrow violation — composite inadmissible, ARROW named
  4. both anchored axes fail — failure_axes == ("BEKENSTEIN", "ARROW")
     (deterministic ordering per anchored_substrate_gate.py:144)
  5. SPECULATIVE bandwidth violation — anchored composite still admissible
     (tier separation explicit; bandwidth result reported separately)
  6. same-state consistency — every runtime-evaluable axis evaluated on
     baseline; tier metadata cross-checked; registry ladder shape +
     reasoning_tier asserted

Negative verification: locally inverted composite logic in
anchored_substrate_gate.py (`admissible = bekenstein_holds and arrow_holds`
→ `admissible = bekenstein_holds`); scenario 3 failed with
`is_thermodynamically_admissible=True` despite `arrow_axis_holds=False`,
proving the integration test catches a compositional regression that
unit tests on individual modules cannot. Source restored before commit.

Quality gates:
  pytest tests/integration/test_substrate_gate_chain.py    6/6 PASS
  pytest tests/unit/physics/ + integration                 all green
  ruff check                                               clean (after one auto-fix for import sorting)
  ruff format --check                                      clean
  black --check                                            clean
  mypy --strict tests/integration/test_substrate_gate_chain.py
                                                           clean (1 file, 0 issues)
  validate_tests.py --self-check                           PASS 8/8

No mocked physics. No hidden randomization. No Hypothesis — deterministic
fixture only. Single substrate fixture; each scenario mutates exactly one
field except scenario 4 (intentional double-mutation, documented).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@neuron7xLab neuron7xLab merged commit c18a0ba into main Apr 26, 2026
12 checks passed
@neuron7xLab neuron7xLab deleted the feat/substrate-gate-chain-integration branch April 26, 2026 11:20
neuron7xLab added a commit that referenced this pull request Apr 26, 2026
…stic cases (Task 1) (#426)

Extends test_substrate_gate_chain.py from one comfortable baseline to
deterministic boundary-adjacent regions. Each case named, mutation
documented, expected verdict mapped to a specific invariant contract
anchored on actual module source.

Cases (10 deterministic, 1 enumeration sanity = 11 total):
  Bekenstein/gate (6):
    1. near_zero_positive_energy        — E=1e-30 J, no NaN/Inf
    2. near_zero_positive_radius        — R=1e-30 m, ceiling ≈ 0
    3. very_large_radius_finite_energy  — R=1e10 m, E=1 J, no overflow
    4. bekenstein_just_below_bound      — claim = ceiling × 0.999999
    5. bekenstein_exactly_at_boundary   — claim = ceiling (`<=` admissible)
    6. bekenstein_just_above_bound      — claim = ceiling × 1.000001
  Arrow (2):
    7. arrow_net_exactly_zero           — ΔS=-1, ΔI=+1 (`>=` admissible)
    8. arrow_net_just_below_zero        — ΔS=-1, ΔI=+0.999999
  Bandwidth (2):
    9. bandwidth_gamma_equals_sigma_dot — Γ=Σ̇=5 (`>=` admissible);
                                         ANCHORED gate unaffected (tier separation)
   10. bandwidth_gamma_just_above       — Γ=5.01, Σ̇=5;
                                         ANCHORED gate STILL admissible

Boundary semantics anchored from source:
  - bekenstein_axis_holds: observed_information_bits <= ceiling
    (anchored_substrate_gate.py)
  - arrow_axis_holds: net >= 0.0
    (arrow_of_time.assess_arrow_of_time)
  - bandwidth_holds: slack_hz = bound_hz - rate_hz >= 0.0
    (observer_bandwidth.assess_bandwidth_bound)

Each case asserts: bekenstein verdict, arrow verdict, composite
verdict. Bandwidth cases additionally assert tier separation —
SPECULATIVE bandwidth violation does NOT veto ANCHORED composite.

Quality gates:
  pytest tests/integration/test_substrate_gate_boundary_sweep.py
                                                11/11 PASS in 0.31s
  pytest chain + boundary suites               17/17 PASS
  ruff check / format / black                  clean (one I001 auto-fix for import sorting)
  mypy --strict                                clean (1 file, 0 issues)

No Hypothesis (deterministic boundary table per protocol §4 — property
layer is post-T1 optional). No randomness. No mocks. Same fixture
style as substrate-gate-chain test (PR #425).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
neuron7xLab added a commit that referenced this pull request Apr 26, 2026
…ask 6) (#431)

Custom subprocess-based mutation harness (no mutmut dependency) that
proves the physics test suite catches meaningful contract regressions,
not just stylistic changes.

Mutants registered (all six per protocol §6):
  1. anchored_ignores_arrow      — composite ignores Arrow axis
  2. anchored_ignores_bekenstein — composite ignores Bekenstein axis
  3. failure_axes_drops_arrow    — multi-failure drops ARROW
  4. bandwidth_inverted          — Γ ≤ Σ̇ becomes Γ < Σ̇
  5. cosmo_above_passes          — claim above ceiling silently passes
  6. sim_threshold_inverted      — strict > becomes < in sim ladder

Harness contract (tools/physics_mutation_check.py):
  - exact-string source mutation; pattern must appear EXACTLY ONCE
    (zero → SKIPPED_PATTERN_NOT_FOUND; multiple → SKIPPED_AMBIGUOUS;
    no silent expansion)
  - mutation applied → targeted pytest run → restore in finally
  - post-restore equality check against original source
  - working-tree-clean asserted via `git diff --exit-code` after run
  - exit codes: 0 killed, 1 survivor, 2 restore-failed, 3 pattern-not-found,
    4 invocation-error
  - --list / --mutant NAME (repeatable) / --all / --fail-on-survivor

Reproduced result on this commit:
    python tools/physics_mutation_check.py --all --fail-on-survivor
    → Killed: 6/6 (every mutant survived ZERO; targeted tests caught
      all six contract regressions)
    → git diff --exit-code: clean (no leftover mutation)

This proves negative-verification at scale: each integration / unit
test referenced by the harness fails when the source contract it
guards is intentionally broken, then passes when source is restored.
The harness is the encoded form of the negative-verification step
performed manually for PR #425 (substrate-gate chain compositional
regression catch).

Forbidden behaviors omitted:
  - no persistent mutation
  - no mutated-file commits (verified by --exit-code check)
  - no broad shell magic
  - no deletion of user changes
  - no run across entire repo by default

Quality gates:
  python tools/physics_mutation_check.py --all --fail-on-survivor   6/6
  git diff --exit-code (post-run)                                   clean
  ruff check / format / black                                       clean
  mypy --strict                                                     clean (1 file, 0 issues)

Optional mutmut adoption deferred per protocol "start custom; evaluate
mutmut as optional follow-up after the custom harness is stable".

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant