core/workbench
Shay 471131cabf feat(b4): engine-side leeway producer — populate LeewayEvidence (Wave M B4)
Clears the long-standing B4 block: the leeway decision was already made on the
serving path (chat/runtime.py::_surface_estimate has a real LicenseDecision +
the ReachPolicy) and then DISCARDED — never threaded to the result, and the
workbench can't import reliability_gate. This wires it through.

Producer (observational, never authorizing):
  - core/cognition/leeway.py: LeewayRecord + build_leeway_record(reach_level,
    license_decision) — duck-typed on the decision, zero new cross-package
    coupling. Maps to: no decision -> "unknown" (STRICT, no latitude); denied
    -> "blocked" (gate consulted, said no); licensed SERVE/PROPOSE widening ->
    the real class / theta / "[approximate]" disclosure. "verified" is never
    emitted (RESERVED state). source_digest content-addresses the decision
    (deterministic, no wall-clock).
  - core/cognition/result.py: additive `leeway: LeewayRecord | None = None` on
    CognitiveTurnResult.
  - core/cognition/pipeline.py: build it at result construction from the data
    the runtime ALREADY exposes (response.reach_level +
    runtime.last_turn_accrual().license). chat/runtime.py is UNTOUCHED.
  - workbench/api.py: _leeway_evidence_from_result maps result.leeway ->
    LeewayEvidence (pure projection; no reliability_gate import — firewall
    intact). The journal already persists it; the B4a UI (Replay / Proposals /
    RightInspector) already renders it — no frontend or schema change needed.

Safety (this touches the serving path, so proven, not asserted):
  - trace_hash is a NAMED-field hash (core/cognition/trace.py); `leeway` is not
    in it -> byte-identical serving. All provenance/trace tests pass.
  - response_governance STRICT stays byte-identical (375 governance/serving/
    provenance tests green, incl. the live-wiring + estimation-lane + ADR-0206
    seam tests).
  - core eval cognition: 13 cases, 100% intent / groundedness / versor closure.
  - replay determinism holds (leeway is in CRITICAL_FIELDS; deterministic).

Tests: engine (build_leeway_record: strict/blocked/SERVE/PROPOSE, no "verified",
deterministic digest) + workbench mapping (field-for-field, honest absence,
invalid-enum clamp) + integration (a real turn now carries an honest leeway
record, not the null "No evidence recorded"). 151 workbench/leeway Python + 68
frontend (leeway/replay/proposals/schemaDrift) green; schema-snapshot unchanged.

Docs: gate cleared (b4-leeway-feasibility-gate.md), residue ledger flipped to
implemented, scope brief is b4-leeway-producer-scope-2026-06-13.md.
2026-06-13 20:22:39 -07:00
..
__init__.py
api.py feat(b4): engine-side leeway producer — populate LeewayEvidence (Wave M B4) 2026-06-13 20:22:39 -07:00
calibration.py
evidence_bundle.py feat(workbench): Wave M D3 — shareable evidence bundles (reproducibility as a deliverable) 2026-06-13 17:26:26 -07:00
field_evidence.py feat(workbench): Wave M C3 field substrate — persist-first field evidence 2026-06-13 16:26:46 -07:00
journal.py feat(workbench): Wave M C3 field substrate — persist-first field evidence 2026-06-13 16:26:46 -07:00
pipeline_record.py feat(workbench): Wave M Phase C legibility — pipeline record, contemplation, identity continuity 2026-06-13 15:44:31 -07:00
readers.py feat(workbench): Wave M C2-b — contemplation as a legible staged process 2026-06-13 16:58:26 -07:00
replay.py feat(workbench): Wave M C3 field substrate — persist-first field evidence 2026-06-13 16:26:46 -07:00
schemas.py feat(workbench): Wave M D1+D2 — guided determinism tour (provider-agnostic) 2026-06-13 19:39:41 -07:00
server.py feat(workbench): Wave M Phase C legibility — pipeline record, contemplation, identity continuity 2026-06-13 15:44:31 -07:00
tour.py feat(workbench): Wave M D1+D2 — guided determinism tour (provider-agnostic) 2026-06-13 19:39:41 -07:00