Protect retained metadata from custom JSON encoders

This commit is contained in:
2026-11-06 01:15:55 +00:00
parent d8c98ac575
commit c9663ec63c
4 changed files with 145 additions and 10 deletions

View File

@@ -7,17 +7,29 @@ against [responsibility-simplification.md](responsibility-simplification.md)
and its accepted audit decisions. The implementation spans `448e64d` through
`5ee602cc4b5a3afe4e7d361eb77181ef0940c7cd`, after planning commit `de46935`.
The targeted architecture is substantially implemented. One ownership regression
remains open below. No additional unintended restriction or public guarantee was
identified; removing copier-derived schema limits is the selected acceptance
change, while runtime provider-value support remains in place. The earlier
The targeted architecture is implemented, and the ownership regression below
is now addressed. Its evidence and review table describe the pre-fix baseline;
the completion marker records the correction. No additional unintended
restriction or public guarantee was identified. Removing copier-derived schema
limits remains the selected acceptance change, while runtime provider-value
support remains in place. The earlier
33-stage review and its five completed findings are retained separately below.
### R1. Isolate Custom JSON Encoders From Retained Metadata [P2]
**Status:** Open. **Stages:** 2, 13–15; particularly the shared prepared snapshot
**Status:** Complete. **Stages:** 2, 13–15; particularly the shared prepared snapshot
and removal of private smoke-target detachment.
Completion: built-in generation preparation uses trusted detachment before
payload construction, so whole-payload encoding and per-value encoding-failure
diagnostics cannot mutate retained provider values through their receivers.
The single prepared snapshot and named/typed custom encoding remain intact.
Public regressions failed before the fix and now protect prepared details,
result settings, smoke settings, caller input, custom wire output, and failure
classification without dispatch. Go 1.27.3 `go test -race ./...` and
`go vet ./...` passed, including the existing retry, repair, and concurrent
prepared-lifecycle coverage. Internal model-client documentation was updated.
**Locations:** [provider payload construction](../../internal/llm/openai_compatible_client.go),
`openAIChatRequestPayload`, lines 468–475, and `PrepareGeneration`, lines 133–139;
[prepared metadata sharing](../../internal/usecase/prepared_execution.go),
@@ -94,6 +106,9 @@ injected initial/repair mutation and concurrent prepared lifecycle protection.
### Stage-By-Stage Review
This is the pre-remediation review record; R1's completion above addresses its
identified gap without changing the other selected boundaries.
| Stage | Current evidence and result |
| --- | --- |
| 1 | Constructor routing defaults and their only error path are removed. Resolved endpoint/model checks and HTTP-client timeout ownership remain. No additional finding. |
@@ -114,9 +129,10 @@ injected initial/repair mutation and concurrent prepared lifecycle protection.
| 16 | Canonical format, integration, model-client, runner, source, and component guidance reflects the selected changes without new resource/provider promises. The immutability description is not fully realized until R1 is fixed. |
| 17 | Fresh full race tests and vet pass, but those checks do not cover R1. Documentation/history links and delivered scope were reviewed; completion still requires the ownership correction. |
### Current Validation And Limits
### Review Validation And Limits
Using Go 1.27.3 with `GOTOOLCHAIN=local`, `GOWORK=off`, and `GOPROXY=off`:
At the reviewed pre-fix baseline, using Go 1.27.3 with `GOTOOLCHAIN=local`,
`GOWORK=off`, and `GOPROXY=off`:
- `go test -race ./...` passed, including the maintained offline examples.
- `go vet ./...` passed.
@@ -124,9 +140,10 @@ Using Go 1.27.3 with `GOTOOLCHAIN=local`, `GOWORK=off`, and `GOPROXY=off`:
errors and unchanged caller values; the two-file historical overlay prevented
both mutations.
No production code or repository tests were changed. The source review and
targeted probe establish R1 despite the passing existing suite. The review does
not claim universal callback safety, provider compatibility, or defect-free code.
The review changed no production code or repository tests. Its source analysis
and targeted probe established R1 despite the passing existing suite; the
completion marker above records the subsequent fix and validation. The review
does not claim universal callback safety, provider compatibility, or defect-free code.
## Earlier Audit Remediation Review: Scope And Status