Files
audita/docs/roadmap/remediation.md

103 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Library Adoption Remediation
**Status:** Findings from the completed implementation review; remediation has
not begun.
**Reviewed source:** `338e93a7ebda9a86593069d63f9d5a7fe23ccaf5`
(`Complete library adoption validation and cleanup`).
The review covered Stages 1–10 of the [implementation plan](implementation.md)
against the [feature roadmap](library-upgrades.md), including implementation,
tests, maintained documentation, migration guidance, and release preparation.
The intended architecture is substantially in place. No production correctness
defect was identified in this review; the following test-maintenance and
documentation gaps need correction.
## R1: Remove the Test Fixtures' Implicit YAML Layout Requirement
**Priority:** P2 — test maintainability and unintended constraint.
**Affected code:**
- [Adapter fixture](../../internal/framework/llm/adapter_test.go):
`adapterFixtureWithPrompt`, budget insertion near line 102.
- [Native adapter fixture](../../internal/framework/llm/native_adapter_test.go):
budget insertion near line 98.
- [Subprocess fixture](../../cmd/audita/main_integration_test.go):
budget insertion near line 280.
**Finding:** These new fixture paths copy complete shipped prompt documents and
append `repair_attempts` as raw text with ten leading spaces. This assumes the
prompt's `output` mapping is last and has the current indentation. Equivalent
YAML formatting or mapping-order changes can therefore break adapter and
subprocess tests while the production native loader continues to accept the
prompt. The same fragile operation is duplicated in three places.
This strengthens an incidental source-layout choice into a test requirement.
The selected contract is that fixtures choose explicit prompt-owned repair
budgets; it does not require shipped YAML to retain a particular indentation
or key order.
**Evidence:** A temporary, external probe loaded the shipped glossary prompt
through native PromptKit successfully, then decoded and reserialized it with
the selected YAML library. The equivalent document also loaded successfully.
Appending the fixture's budget line to that equivalent document made native
configuration loading fail. No repository prompt was modified for this probe.
**Recommended change:** Set the selected prompt record's
`output.repair_attempts` structurally using a YAML node or mapping, then render
the complete replacement document. Reuse a small fixture helper where practical
so adapter, native-adapter, and subprocess tests do not maintain independent
text-injection rules. Keep this adaptation in test support; production request
contracts should continue to come directly from prompt definitions.
**Acceptance:** Fixture budgets remain test-controlled and native loading
continues to see the complete intended prompt contract. Equivalent YAML
formatting or key-order changes do not invalidate budget insertion. Retain a
focused regression at the helper boundary without duplicating upstream YAML
or budget-resolution test matrices.
## R2: Align Remaining Documentation with the Removed Schema Registry
**Priority:** P3 — incomplete documentation cleanup.
**Affected documents:**
- [Prompt registry guide](../internal/prompts.md), especially lines 58–68.
- [Feature roadmap](library-upgrades.md), implementation status near its opening.
- [Implementation plan](implementation.md), opening status.
**Finding:** The prompt guide still says `responseschema` retains Audita's
schema-key lookup and that structured calls carry a response-schema key. The
implementation intentionally removed both: `responseschema` now exposes only
the embedded filesystem/asset root, and `structuredoutput.Request` selects a
prompt without a schema field. These statements contradict the central
prompt-owned-contract decision and could lead a future contributor to restore
the retired override path.
The feature roadmap also says implementation has not begun, and the plan's
opening still says ready for implementation despite completion records for
all ten stages. These status statements no longer describe the reviewed source.
**Recommended change:** Remove the obsolete schema-key/lookup descriptions.
Describe the remaining shared schema assets, the selected prompt's output
contract, and Audita's domain decoding and validation. Link to upstream for
native schema behavior. Update the roadmap and plan statuses to reflect that
implementation is complete and review remediation remains outstanding; preserve
their baseline and decision history.
**Acceptance:** Maintained guidance does not claim that production structured
requests carry schema keys or that a schema registry still chooses their
contracts. Roadmap status agrees with the implementation and this review.
No application code, historical release record, or accepted ADR needs to change
to address this finding.
## Review Validation
With Go 1.27.4, the complete `go test -race ./...` suite, `go vet ./...`,
`go mod tidy -diff`, and Linux amd64/arm64 builds passed. All 58 changed Go files
were gofmt clean, and 145 local links in the changed Markdown documents
resolved. The fixture-format probe above confirmed R1 separately from the
passing current suite. This review did not change application code or publish
a release.