diff --git a/.aiwg/testing/gate3-increment-7-report.md b/.aiwg/testing/gate3-increment-7-report.md index f274b52..0526f11 100644 --- a/.aiwg/testing/gate3-increment-7-report.md +++ b/.aiwg/testing/gate3-increment-7-report.md @@ -3,15 +3,16 @@ Date: 2026-08-16 Exact base: `9683e0be4d892e6a6a134b45a065e591e139da3c` Exact implementation head: `acc6b3b254e6d358ddabe495b1ca79295dd36d70` -Status: PASS locally; signed exact-head PR audit, hosted matrix, and canonical -merge remain pending +Status: PASS locally after the portability correction; hosted exact-head rerun +and canonical merge remain pending ## Results | Gate | Result | |---|---| -| Focused contracts | 267 restoration, runtime, offline-model, and policy tests passed; the final runtime set is 111/111 green | +| Focused contracts | 268 restoration, runtime, offline-model, analysis, and policy tests passed; the final runtime set is 111/111 green | | Mandatory CPU lane | Python 3.12: 2,112 passed, 9 conditional tests deselected, 0 failed, and 0 skipped in 87.70s | +| Python 3.10 portability lane | 2,113 passed, 9 conditional tests deselected, 0 failed, and 0 skipped in 88.18s; mature scope 94.04% statements / 84.61% branches | | Repository coverage | 82.76% statements / 69.55% branches before; 83.50% / 71.08% after | | Mature CPU scope | 93.27% / 83.06% before; 94.02% statements / 84.54% branches after | | Immutable mature floor | Raised from 92% / 80% to 94% / 84% in policy and validator | @@ -73,12 +74,24 @@ production result to 58/58. Coverage review also found a duplicate unreachable empty-sequence check in first-token KL validation; the shared tensor validator already rejects that input, so the dead branch was removed. +The first hosted matrix exposed a separate portability weakness: every test +passed on Python 3.10 and 3.11, but a random power-iteration start took an early +numerical path in the Riemannian curvature helper, lowering mature coverage to +93.85%. A direct deterministic correction contract now exercises the normal +path and both early-return boundaries without depending on Python or Torch RNG +behavior. A locked local Python 3.10 rerun passes the full suite and the 94/84 +policy at 94.04% statements and 84.61% branches. + ## Verification and evidence - Mandatory Python 3.12 coverage: `/tmp/obliteratus-item7-final2-coverage-py3.12.json` - Mandatory Python 3.12 JUnit: `/tmp/obliteratus-item7-final2-junit-py3.12.xml` +- Corrected mandatory Python 3.10 coverage: + `/tmp/obliteratus-item7-fix-coverage-py3.10.json` +- Corrected mandatory Python 3.10 JUnit: + `/tmp/obliteratus-item7-fix-junit-py3.10.xml` - Exact-base Python 3.12 coverage: `/tmp/obliteratus-main-9683e0b-zvr8hF/test-evidence-py3.12/coverage-py3.12.json` - Clean non-editable Python 3.12 test environment: diff --git a/tests/test_breakthrough_modules.py b/tests/test_breakthrough_modules.py index 2992670..ae4bbdd 100644 --- a/tests/test_breakthrough_modules.py +++ b/tests/test_breakthrough_modules.py @@ -170,6 +170,55 @@ class TestRiemannianManifold: assert result.original_refusal_component > 0 assert result.improvement_factor >= 1.0 + def test_curvature_correction_contract_is_deterministic(self, monkeypatch): + """Exercise the non-flat correction path without RNG/version drift.""" + analyzer = RiemannianManifoldAnalyzer() + activation = torch.tensor([1.0, 0.0, 0.0]) + refusal_direction = torch.tensor([1.0, 0.0, 0.0]) + harmful = torch.tensor( + [ + [0.0, 1.0, 0.0], + [0.0, -1.0, 0.0], + [0.0, 0.0, 1.0], + [0.0, 0.0, -1.0], + ] + ) + + monkeypatch.setattr( + torch, + "randn", + lambda size, *, device=None: torch.tensor( + [0.0, 1.0, 1.0], device=device + ), + ) + + correction = analyzer._compute_curvature_correction( + activation, + refusal_direction, + harmful, + curvature=0.5, + ) + + assert correction.norm().item() > 0.0 + assert torch.dot(correction, refusal_direction).item() == 0.0 + assert correction.norm().item() <= 0.1 + + assert torch.equal( + analyzer._compute_curvature_correction( + activation, refusal_direction, harmful, curvature=0.0 + ), + torch.zeros_like(activation), + ) + assert torch.equal( + analyzer._compute_curvature_correction( + activation, + refusal_direction, + harmful[:1], + curvature=0.5, + ), + torch.zeros_like(activation), + ) + def test_empty_input(self): analyzer = RiemannianManifoldAnalyzer() result = analyzer.analyze({}, {})