test(soul): integration and contract tests for layered_cycle #13

Merged
will.anderson merged 1 commits from test/layer-composition into feat/layer-composition 2026-06-11 17:13:58 +00:00
Owner

Summary

  • Adds tests/test_layered_cycle.el — 12 integration tests for the full layered_cycle() L1->L2->L3->L1 composition stack
  • Adds tests/test_layer_contract.el — 14 contract tests verifying the JSON interface shapes between layers
  • Tests call layer functions directly in the same composition order as layered_cycle() because it is not yet exported from soul.elh (review finding #3); replace run_layered_cycle() with a direct call once the header is regenerated

Integration tests (test_layered_cycle.el) — 12 cases

  1. benign input full pass-through — result is non-empty and contains input concepts
  2. hard-bell input — L2/L3 short-circuit; returns 988 crisis message; input not echoed
  3. soft-bell input — care path; no hard escalation
  4. mission-conflict "manipulate" — L2 redirect; result contains trust reframe; input not echoed
  5. empty input — graceful; no crash, no null/error JSON
  6. result always a non-empty String across varied benign inputs
  7. chain no corruption — benign ASCII input concepts survive all four layers
  8. mission-conflict "deceive the user" — redirect path verified
  9. mission-conflict "override safety" — redirect path verified
  10. imprint_current() stable across cycle — no side-effect mutation
  11. soft-bell with distress history — history escalation raises composite score
  12. sequential calls no state bleed — three sequential inputs reflect only their own content

Contract tests (test_layer_contract.el) — 14 cases

  • L1 safety_screen: action always in {pass, soft_bell, hard_bell}; pass includes content field; hard_bell has empty content (no propagation); soft_bell has concern + non-empty content; enum exhaustive across 5 inputs
  • L2 steward_align: action always in {pass, redirect}; pass includes content; redirect has non-empty redirect_to for all 5 misalignment signals (manipulate, deceive the user, hide from, gain control, override safety); enum exhaustive
  • L3 imprint_respond: non-empty output for non-empty input; base imprint is verbatim passthrough; missing imprint graceful fallback returns input unchanged
  • imprint_current(): defaults to "base" with no active state; reflects active_imprint_id
  • Cross-layer: L1 screen_action propagates correctly to safety_validate; hard_bell replaces generated text entirely; pass returns generated text verbatim

Addresses review findings

  • Finding #3 (unexported layered_cycle): documented in test header; inline composition used as workaround until soul.elh is regenerated
  • Finding #4 (incomplete steward action handling): redirect_to field explicitly asserted non-empty for all 5 misalignment signals
## Summary - Adds `tests/test_layered_cycle.el` — 12 integration tests for the full `layered_cycle()` L1->L2->L3->L1 composition stack - Adds `tests/test_layer_contract.el` — 14 contract tests verifying the JSON interface shapes between layers - Tests call layer functions directly in the same composition order as `layered_cycle()` because it is not yet exported from `soul.elh` (review finding #3); replace `run_layered_cycle()` with a direct call once the header is regenerated ## Integration tests (test_layered_cycle.el) — 12 cases 1. benign input full pass-through — result is non-empty and contains input concepts 2. hard-bell input — L2/L3 short-circuit; returns 988 crisis message; input not echoed 3. soft-bell input — care path; no hard escalation 4. mission-conflict "manipulate" — L2 redirect; result contains trust reframe; input not echoed 5. empty input — graceful; no crash, no null/error JSON 6. result always a non-empty String across varied benign inputs 7. chain no corruption — benign ASCII input concepts survive all four layers 8. mission-conflict "deceive the user" — redirect path verified 9. mission-conflict "override safety" — redirect path verified 10. imprint_current() stable across cycle — no side-effect mutation 11. soft-bell with distress history — history escalation raises composite score 12. sequential calls no state bleed — three sequential inputs reflect only their own content ## Contract tests (test_layer_contract.el) — 14 cases - L1 safety_screen: action always in {pass, soft_bell, hard_bell}; pass includes content field; hard_bell has empty content (no propagation); soft_bell has concern + non-empty content; enum exhaustive across 5 inputs - L2 steward_align: action always in {pass, redirect}; pass includes content; redirect has non-empty redirect_to for all 5 misalignment signals (manipulate, deceive the user, hide from, gain control, override safety); enum exhaustive - L3 imprint_respond: non-empty output for non-empty input; base imprint is verbatim passthrough; missing imprint graceful fallback returns input unchanged - imprint_current(): defaults to "base" with no active state; reflects active_imprint_id - Cross-layer: L1 screen_action propagates correctly to safety_validate; hard_bell replaces generated text entirely; pass returns generated text verbatim ## Addresses review findings - Finding #3 (unexported layered_cycle): documented in test header; inline composition used as workaround until soul.elh is regenerated - Finding #4 (incomplete steward action handling): redirect_to field explicitly asserted non-empty for all 5 misalignment signals
will.anderson added 1 commit 2026-06-11 16:44:46 +00:00
Adds tests/test_layered_cycle.el — 12 integration tests covering the full
L1→L2→L3→L1 stack: benign pass-through, hard-bell short-circuit, soft-bell
care augmentation, steward redirect for all 5 mission-conflict signals, empty
input graceful handling, sequential call isolation, and imprint state stability.

Adds tests/test_layer_contract.el — contract tests verifying the JSON
interface shapes between layers: safety_screen {action, content|reason|concern},
steward_align {action, content|redirect_to}, imprint_respond non-empty String,
and cross-layer action propagation from L1 screen through to L1 validate.
will.anderson merged commit ffd1f34344 into feat/layer-composition 2026-06-11 17:13:58 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: neuron-technologies/neuron#13