Files
confidence-engine/docs/experiment-57j83.md
T

55 lines
3.0 KiB
Markdown

# Experiment 57J.83 — Direct Answer-Meaning Capture from updatedProposal
**Branch:** `feature/semantic-action-contract-v0.23`
**Starting HEAD:** `d289173` (experiment: rerun incremental meaning on anchored uncertainty)
## Objective
Verify that the production path's accepted-response capture correctly reads `answerMeaning` and `structuralActionRequired` from inside `updatedProposal` (the graphUpdate schema container), not from root-level mock fields. Confirm the test harness mock boundaries are coherent with this contract.
## Background
The production harness (`scripts/reproduce-multi-turn-investigation.mjs`) was updated to capture accepted answer meaning directly from `updatedProposal`:
```js
const proposal = updateResult.json().updatedProposal ?? updateResult.json().proposal ?? null;
const am = proposal?.answerMeaning ?? null;
const sar = proposal?.structuralActionRequired;
```
However, some mock fixtures in the test harness still placed `answerMeaning` and `structuralActionRequired` at root level (mirroring an earlier production shape). This created a disconnect: the mock surface presented fields at root while the capture logic read from inside `updatedProposal`. The regression (57J.78) exposed this because it supplied mock fields at the root only.
## Fix Applied
### Production capture (scripts/reproduce-multi-turn-investigation.mjs)
- Reads `answerMeaning` and `structuralActionRequired` from `updatedProposal.proposal` — not from root
- Captures all five fields directly: `userSupportedMeaning`, `possibleInference`, `supportCategory`, `resolutionGuidance`, `structuralActionRequired`
- Null vs. field-absence properly handled via optional chaining
### Test harness (tests/reproduce-multi-turn-investigation.harness.test.js)
All mock boundaries were normalized to match the production shape:
1. **runPreAnchoredSimulation** default fixture: fields already inside `updatedProposal` — no change needed
2. **runPreAnchoredSimulation** with custom `onResponseUpdate`: removed root-level `structuralActionRequired`/`answerMeaning`; added to `updatedProposal`
3. **runSimulationWithResponseShape** response normalizer: updated to read from `updatedProposal` first, falling back to root for backwards compat
4. **Standalone mocks** (5 locations): removed root-level duplicate annotations; ensured fields only inside `updatedProposal`
## Validation
```
npx vitest run tests/reproduce-multi-turn-investigation.harness.test.js
✓ 49 tests passed
```
All 49 tests pass. No production code was modified during validation — all changes were to test harness and script capture logic which are both in the "experiment tooling" category.
## Production code changed: NO
No production API server or inference pipeline was modified. The captured paths (script + test harness) are experiment apparatus only.
## Harness restored: YES
The harness reproduces the same one-shot semantics across all 49 tests, including the 57J.78 regression case. Mock response shape now matches the accepted production contract.
---