Skip to content

feat: bind served shadow recall evidence fields to exact V2/#157 state (#188) - #189

Merged
ezutfen merged 3 commits into
mainfrom
feat/188-v2-evidence-binding
Sep 7, 2026
Merged

feat: bind served shadow recall evidence fields to exact V2/#157 state (#188)#189
ezutfen merged 3 commits into
mainfrom
feat/188-v2-evidence-binding

Conversation

@ezutfen

@ezutfen ezutfen commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Closes #188 (ENG-RECALL-003C — parent #160, epic #153)

Summary

Admitted governed/exploratory shadow items now present the exact risk_aware_shadow_v1 V2/#157 fresh evaluation state that authorized admission — closing the gap where admission.v2.fresh.epistemic_state = "supported" while item.epistemic_state = "unknown" for the same admitted item.

Representative before/after (governed-admitted qualified proposal)

Field Before (#187) After (#188)
admission.v2.fresh.epistemic_state supported supported
epistemic_state (top level) unknown ← mismatch supported
warning_codes ["unreviewed", "evidence_unknown"] ["unreviewed"]
evidence block {source: v2_fresh_evaluation, …, epistemic_state: supported, risk_state: low, retention_state: retain, …}

Warning matrix (test-pinned)

V2 fresh state Served Warning code
epistemic supported mirrored none
epistemic unknown mirrored evidence_unknown
epistemic contested mirrored evidence_contested
epistemic insufficient_evidence mirrored evidence_insufficient
epistemic not_applicable fail closed V2EvidenceContractError
risk high mirrored risk_high
risk unknown mirrored risk_unknown
risk low/medium mirrored none

Lifecycle marks (unreviewed, admission_assessment_stale, admission_legacy_import) remain where independently true (pinned with the canonical state in the stale-#159-binding test).

Proof highlights

  • Identity invariant: unit tests assert every evidence.* == admission.v2.fresh.* field-by-field from the shared binding; DB tests re-verify against the real resolver path (test_served_evidence_state_is_the_exact_v2_fresh_evaluation — supported/unknown/contested/insufficient/high-risk/absent fixtures across both profiles).
  • Projection, not recomputation: evidence built after admission from decision.v2; evaluation core runs exactly once per item per packet, bulk resolver once per packet (monkeypatch counters); standalone resolver query_count equals the packets' reported count; mutable item fields (confidence/trust/importance/counters/age/verification) cannot move evidence.* with the decision held fixed.
  • Read-only: recall logs, exposure counters unchanged under the shadow compare with evidence present.
  • Fail-closed: missing/stale/mismatched/unsupported stay withheld, diagnostic v2 identity intact, no served evidence block.
  • Legacy: byte-for-byte — pre-existing legacy pins pass unchanged plus new additive-key pins.

Tests

  • tests/test_recall_signals.py: +10 unit tests (canonical serialization, warning matrix, local-derivation boundary, fail-closed, no-IO signature proofs).
  • tests/test_recall_profile_semantic.py: evidence matrix integration test (real resolver), no-duplicate-evaluation/IO proof, read-only proof; pre-issue mismatch pins updated to the canonical contract.
  • sdk/engram-client/tests/test_models.py: RecallResponse accepts structured evidence blocks; unknown/null states stay structured, never numeric.

Results

Remaining #160 slices (after this issue)

#157 enrichment on non-V2 paths (startup), signal-aware graph/tunnel expansion, diversity/root-redundancy + conflict-preserving packing, demonstrated-usefulness feedback, semantic Context Ledger receipts (packet is now receipt-ready), dogfood/exposure-concentration evaluation on the shadow surface (incl. keeping the V2 row corpus fresh), fresh #162 certification + default cutover.

#188)

Admitted governed/exploratory items now present the exact risk_aware_shadow_v1
fresh evaluation the admission decision consumed, replacing the item-local
review/conflict/verification epistemic heuristic on V2-bound profiles:

- recall_signals.build_v2_evidence_fields: pure projection of the already-bound
  admission.v2 binding (source, profile/policy identity, decision hash,
  resolution status, epistemic/risk/retention state, effective #157 refs);
  impossible admitted combinations fail closed (V2EvidenceContractError)
- top-level epistemic_state mirrors evidence.epistemic_state exactly
- warning contract: evidence_unknown / evidence_contested /
  evidence_insufficient from the V2 state; risk_high / risk_unknown keep
  allowed high/unknown-risk exploratory items unmistakable; lifecycle marks
  (unreviewed, #159 stale/legacy_import) remain independently true
- no second #157 selection, no second V2 evaluation, no per-item query,
  no provider call: evidence is computed after resolution from the decision
- ranking, budgets, ordering, legacy packet (byte-for-byte), and the
  shadow-only rollout boundary are unchanged
…y items (#188)

The human-readable mirror for risk_high said 'high risk — review required',
which contradicts the exact V2 surface decision on an admitted exploratory
candidate: semantic_exploratory may legitimately return surface_decision=allow
with risk_state=high, served with warning_codes=[risk_high]. The text invented
a review requirement the decision never imposed.

Neutralize the mirror to 'high risk' (the machine-readable risk_high code is
unchanged) and strengthen
test_high_and_unknown_risk_stay_unmistakable_on_admitted_exploratory to prove
the served packet stays internally consistent: surface_decision == allow,
evidence.risk_state == high, risk_high in warning_codes, and no 'review
required' claim in the human-readable warnings.
@ezutfen
ezutfen merged commit f62cf10 into main Sep 7, 2026
8 checks passed
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.

ENG-RECALL-003C — Bind served shadow recall evidence fields to exact V2/#157 state

1 participant