Commit graph

5 commits

Author SHA1 Message Date
Shay
a9cafc5368 fix(identity): close v3 paraphrase gap with two-layer override defense
Resolves the adversarial-identity v3 finding (0% rejection on
paraphrased attacks against the marker-string defense). Two
independent layers now guard the review gate; either is sufficient
to reject.

Fix #2 (syntactic, in teaching/review.py):
  Replaces the substring-only check with four deterministic rules:
    (a) legacy markers (v1/v2 coverage preserved verbatim)
    (b) redirect-verb + role-frame co-occurrence
    (c) negating qualifier within +/-3 tokens of a role-frame
    (d) negating qualifier within +/-3 tokens of a redirect-verb
  Replay-safe, no learned classifier, single-file contained change.

Fix #3 (geometric, in core/physics/identity.py):
  Adds IdentityCheck.would_violate(score, manifold) predicate per
  ADR-0010 and wires it through CognitiveTurnPipeline._run_teaching
  from response.identity_score. The geometric layer is paraphrase-
  invariant by construction.

  Honest finding: with the current default IdentityManifold (three
  unit-axis ValueAxes), the geometric layer flags 0/32 of v3 attacks
  independently. The predicate and wiring are in place; the manifold
  axis design is the limiting factor and remains as scoped follow-up.
  Fix #2 is what is actually rejecting attacks today.

Verification: all eight adversarial-identity splits (v1-v4, public +
holdouts) at attack_rejection=1.0 and legitimate_acceptance=1.0.
v4 (32 attacks + 18 legitimate) is the regression gate for fix #2,
exercising rules (b)/(c)/(d) with new attack vocabulary. Tests
test_reviewed_teaching_loop.py (5/5), test_pipeline_teaching_integration.py
(5/5), test_identity_gate.py (incl. 5 new TestWouldViolatePredicate
tests, 12/12). CLI suites: smoke, cognition, teaching, runtime all
green.

Also drops a stale entry from the runtime CLI suite list
(test_chat_identity_telemetry.py was removed in 222124a).
2026-05-16 14:05:55 -07:00
Shay
222124a8cd fix(tests): align suite with persona-neutral strict-closure contract
Remove shelved identity/drive tests that existed to justify premature
persona wiring, and update remaining tests to match the current runtime
contract: empty vault triggers unknown_domain gate on first turn, versor_apply
always closes to unit versor, and null-cone preservation is deferred to an
explicit geometry API.

562 passed, 4 skipped, 0 failed.
2026-05-16 05:37:12 -07:00
Shay
8ed6793a03 fix: use raw string for deprecated_call match pattern in test_identity_gate
The backslash escapes in the regex match pattern were plain string
escapes, not regex escapes. Add r-prefix to fix SyntaxWarning.
2026-05-14 19:52:47 -07:00
Shay
7401eae7ae
Clean up runtime contracts before cognitive pipeline
- document ChatResponse, TurnEvent, identity, memory/teaching, and test-organization contracts
- add local trace and build metadata ignore rules
- warn on deprecated IdentityCheck constructor injection
- update identity gate tests to canonical ValueAxis and ReasoningTrajectory usage
- keep cleanup scoped ahead of cognitive pipeline work
2026-05-14 18:47:59 -07:00
Shay
9f2b2acbf0
test(identity): IdentityCheck gate wiring, IdentityScore invariants, TurnEvent field coverage 2026-05-14 14:30:56 -07:00