Skip to content

test: boman edge cases and phase3 vs pipeline safety threshold contract - #23

Merged
cschanhniem merged 3 commits into
mainfrom
feat/boman-edge-config-switching
Jun 28, 2026
Merged

cschanhniem merged 3 commits into
mainfrom
feat/boman-edge-config-switching

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

  • tests/test_boman_scorer.py — two new edge-case tests:

    • test_all_non_canonical_returns_zero: verifies boman_index("XXX") and boman_index("BBBBB") return 0.0 via the .get(aa, 0.0) fallback — ensures non-standard AAs are silently neutral, not errors
    • test_amp_threshold_bi_maps_to_expected_score: pins the tanh formula constant 0.5*(1+tanh(bi/2)) ≈ 0.7311 at bi=1.0 (_AMP_THRESHOLD), making any future formula drift a test failure
  • tests/test_pipeline_filters.py — one new integration test:

    • test_phase3_config_has_stricter_safety_filter_than_pipeline: loads both configs/pipeline.yaml and configs/phase3.yaml, asserts phase3 max_safety_risk=0.40 (safety≥0.60) is strictly tighter than pipeline's 0.70 (safety≥0.30), and shows that a candidate with safety=0.50 is admitted by pipeline but blocked by phase3 — critical pre-synthesis gate contract

Test plan

  • pytest tests/test_boman_scorer.py tests/test_pipeline_filters.py — 52 passed
  • Full suite pytest — 774 passed, 0 failures
  • Pre-push hook verified

Context

This is iteration #23 of the pre-wet-lab quality loop. Previous PRs (#20–22) added coverage for certificate, mutation, external_predict, config, safety, and activity scoring. This PR closes the last two identified gaps from the agent survey:

  1. All-non-canonical boman edge case (silent neutral contract)
  2. Config switching validation (phase3 vs pipeline safety threshold divergence)

🤖 Generated with Claude Code

…ct (#23)

- boman_index: all-non-canonical (XXX/BBBBB) → 0.0 via .get(aa, 0.0) fallback
- boman_activity_score: verify tanh formula constant (0.5*(1+tanh(bi/2)) ≈ 0.7311 at bi=1.0)
- test_phase3_config_has_stricter_safety_filter_than_pipeline: asserts phase3.yaml
  max_safety_risk=0.40 (safety≥0.60) is stricter than pipeline.yaml 0.70 (safety≥0.30);
  a candidate with safety=0.50 passes pipeline but is blocked by phase3
- Move `import math` to module top level (ruff PLC0415)
- Replace vacuous tanh assertion (tested math.tanh locally) with a test that
  actually calls boman_activity_score("K") and compares to formula-derived
  expected value — any change to bi/2.0 divisor will now be caught
- Move `from pathlib import Path` and `from openamp_foundry.config import load_config`
  from inside test function to module top level (ruff PLC0415)
@cschanhniem
cschanhniem merged commit 4d02509 into main Jun 28, 2026
3 checks passed
@cschanhniem
cschanhniem deleted the feat/boman-edge-config-switching branch June 28, 2026 01:50
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