Skip to content

fix: falsification-audit hardening — exact conservation, -O guard, empty-index join (C-67/C-68/C-69)#194

Merged
Polichinel merged 1 commit into
developmentfrom
fix/falsify-audit-2026-07
Jul 2, 2026
Merged

fix: falsification-audit hardening — exact conservation, -O guard, empty-index join (C-67/C-68/C-69)#194
Polichinel merged 1 commit into
developmentfrom
fix/falsify-audit-2026-07

Conversation

@Polichinel

Copy link
Copy Markdown
Contributor

Fixes all four findings of the 2026-07-02 four-axis audit's falsification phase (1 hard, 3 soft).
Bug fixes with an identical contract — the code now honors what the docs already promised. No
public-surface change; CONFORMANCE_FLOOR stays 1.0.0.

The hard finding — C-68

reconcile_proportional's torch-port + 1e-8 denominator epsilon was a float32 no-op for draw
sums ≳ 0.1
(why no oracle/parity test ever saw it) but silently deflated the scale factor for
tiny nonzero sums: at draw-sum 1e-8 a country total of 100 reconciled to 50, no error — violating
the Reconcile.md §3 sum-to-country guarantee in-domain; the package's own assert_reconcile_contract
rejected its own output. Fix: explicit all-zero-draw guard + exact division — conservation now
exact for any nonzero sum; all-zero draws stay zero exactly as before; bit-identical on all
realistic data (torch-oracle parity green, unchanged)
. Also: negative country totals now raise
ValueError instead of silently clamping to a zero output (F8).

The soft findings

  • C-67: the three published conformance suites (bare asserts) silently no-op'd under
    python -O — a verified float64 non-conformer passed. Now: _require_assertions() on every
    entry point → RuntimeError under optimized bytecode (refuse-to-run beats report-green-while-dead).
  • C-69: empty-index searchsorted crashed with an obscure IndexError (the clip(0,−1)
    corner) → now returns all -1, the documented not-found value.

Ritual

  • Regression pins: tests/test_falsification_safety_audit_2026_07.py (written as failing stubs
    during the audit, turned green by these fixes; the F3 pin runs a python -O subprocess).
  • Docs: Reconcile.md §6 + proportional.py module docstring (records the deliberate,
    parity-preserving deviation from the torch original). CHANGELOG [Unreleased] entry.
  • Register: C-67/C-68/C-69 registered-and-resolved, C-70 opened (the audit's docs/tests polish
    bundle); counts 63→67 total / 13 open / 54 resolved. /review-rr triage CLEAN.
  • Gate: ruff · mypy (3.10+3.11) · 398 tests, 100% line+branch · validate_docs — all green.
    /review-diff CLEAN.

🤖 Generated with Claude Code

…pty-index join (C-67/C-68/C-69)

The 2026-07-02 four-axis audit's falsification phase found one hard and three
soft violations of the safety claim; fix all four (bug fixes, identical contract):

- C-68 (HARD): reconcile_proportional's torch-port `+ 1e-8` denominator epsilon
  was a float32 no-op for draw sums >~ 0.1 but SILENTLY deflated the scale factor
  for tiny nonzero sums (draw sum 1e-8: country total 100 reconciled to 50, no
  error; the package's own assert_reconcile_contract rejected its own output).
  Replace it with an explicit all-zero-draw guard: exact division for any nonzero
  sum; all-zero draws stay zero exactly as before. Bit-identical on all realistic
  data — torch-oracle parity unchanged and green. Also (F8): negative country
  totals now raise ValueError instead of silently clamping to a zero output.
- C-67: the three published conformance suites were bare asserts — a silent no-op
  under python -O. Entry points now call _require_assertions(), raising
  RuntimeError under optimized bytecode instead of reporting green while dead.
- C-69: searchsorted from an empty index crashed with an obscure IndexError (the
  np.clip(pos, 0, -1) corner); now returns all -1, the documented not-found value.

Regression pins: tests/test_falsification_safety_audit_2026_07.py (written first
as failing stubs, turned green by these fixes). Reconcile.md §6 + proportional.py
docstring document the behaviors. Register: C-67/C-68/C-69 registered-and-resolved,
C-70 (the audit's docs/tests polish bundle) opened; counts 63->67 total, 13 open,
54 resolved; /review-rr triage CLEAN.

Gate: ruff / mypy (3.10+3.11) / pytest 398 passing at 100% line+branch / validate_docs
all green; /review-diff CLEAN.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Polichinel Polichinel merged commit a152ca6 into development Jul 2, 2026
7 checks passed
@Polichinel Polichinel deleted the fix/falsify-audit-2026-07 branch July 2, 2026 09:56
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