Files
scriptorium/docs/roadmap/audit-remediation.md

151 lines
7.9 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.
# Audit Remediation Roadmap
Prepared 2026-11-25. Status: planned; implementation has not started.
Reviewed baseline: `e67633b9f48b42c5b0d14782c6e8e1d4c78fcdd5`.
This roadmap captures the target state and scope selected in the accepted
[audit discussion](audit/discussion.md). The [catalog](audit/catalog.md) and
original reports retain the detailed evidence and reproductions.
[implementation.md](implementation.md) owns execution steps and implementation
status. This document does not introduce new runtime contracts.
## Baseline And Target
The baseline retains all audited production and test findings. Application and
tool sources have not changed since the correctness audit. Dependencies remain
those in [go.mod](../../go.mod): PromptKit v0.25.0, ConfigKit v1.4.0,
CommandKit v0.8.0, ckconfig v0.11.0, ckprompt v0.12.0, and ReleaseKit v0.10.0.
No dependency upgrade is selected by this roadmap.
The target is a thin application with corrected HTTP input handling, effective
tests at application-owned boundaries, useful startup diagnostics from the
appropriate owner, and HTTP-specific reporting consolidated within its adapter.
ConfigKit, PromptKit, and CommandKit retain the responsibilities established by
[ADR 0006](../adr/0006-adopt-commandkit-native-operator-interfaces.md) and the
[architecture policy](../policy/architecture.md).
HTTP stays in maintenance mode, suitable only for exposure to trusted hosts on
a trusted network. The rest of the application remains actively developed.
The accepted report relocation makes that boundary clearer without expanding
HTTP reporting or deployment capabilities.
## HTTP Input Handling
Provider parameters reach PromptKit without numeric precision loss, and file
references retain their pathname identity. Strict unknown-field handling,
typed numeric validation, and trailing-token rejection remain unchanged.
Restricted acquisition uses ordinary regular-file semantics: unsupported
non-regular inputs are rejected before opening, opened files are checked, and
cancellation is observed cooperatively during acquisition and before success.
Lexical containment and configured byte limits remain enforced during reading.
Errors retain their identities through existing PromptKit/HTTP mappings.
This does not introduce streaming input support, immediate interruption of
synchronous filesystem operations, abandoned-read goroutines, or a symlink
sandbox. Existing OS-followed symlinks to regular files remain supported.
Ordinary CLI artifact loading remains upstream-owned.
## Effective Behavioral Protection
Tests protect demonstrated failure modes at their application-owned boundaries
rather than incidental representations or error prose:
- Lossless provider values, whitespace-significant file identity, post-start
cancellation, unsupported file types, and independently checked hashes.
- Shared engine admission at actual server composition, with reliable test
cancellation, release, and joining on failure paths.
- Engine-construction failures after successful configuration resolution and
before listening, retaining typed causes and nonzero outcomes.
- Specific rejection of removed flags on otherwise-valid invocations.
- HTTP status/code/precedence, usable messages, and cause privacy without
freezing noncontractual error sentences.
- Distinct cache-accounting fields and their required value/known/complete
members, including zero versus unknown and incomplete-count semantics.
Existing behavior owners are extended or consolidated, preserving meaningful
protection before duplicate cases are removed. No coverage quota, exhaustive
upstream matrix, mandatory mutation-testing platform, or new release gate is
selected.
## HTTP Report Ownership
The terminal collector, HTTP projection, and their focused tests belong within
`internal/adapter/http`; the obsolete `internal/report` package is removed.
Implementation names are private where practical. Package reduction is a
consequence, not the goal.
Existing wire shapes, opt-in and absence semantics, success/error attachment,
terminal-only observation, detached snapshots, unknown/incomplete counts,
request isolation, and response limits remain unchanged. CLI reporting remains
on native upstream results and presentation. Additional accounting fields and
a shared reporting framework are outside this remediation.
## Startup Diagnostics And CLI Maintenance
Application-owned listener failures provide the selected address and a useful
failure category through native CommandKit explanations, preserving the cause
and existing status. Short, genuinely shared application configuration
diagnostic adaptation is consolidated where it improves maintainability;
native evidence selection, headings, bootstrap reporting, and failure precedence
remain intact. Small cleanup does not justify additional abstraction machinery.
PromptKit owns safe structured diagnostics for resource capture and template
compilation; ckprompt owns native presentation. At the selected versions,
capture failures preserve causes but lack the supported structured diagnostic
handoff needed for that improvement. An upstream-ready consumer feature request
and explicit adoption deferral are therefore the local outcome. A later
supported release can enable adoption for both application and native PromptKit
commands. This dependency does not delay other local remediation.
Generic capture explanations remain until upstream support is available. The
application does not parse formatted errors, print arbitrary causes, import
upstream internals, or build a framework-error interpreter. Configuration
inspection retains its existing lifecycle without capturing message resources.
## Deferred Work And Operating Limits
The following remain conditional future work in [future.md](future.md), not
delivery commitments:
- Additional body-read, idle, and response-delivery deadlines.
- Aggregate input/memory controls.
- Standalone HTTP handler decomposition.
- Optional model-mapping simplification if it is not useful alongside the fixes.
- Public upstream artifact-reader reuse that preserves access policy and byte
enforcement during acquisition, independently of the local reader correction.
Existing request, per-file, response, and backend controls remain; they do not
establish an aggregate-memory budget or whole-HTTP-request lifetime guarantee.
The operation budget and shutdown contract remain unchanged. No gateway
requirement or broader supported exposure is introduced. Additional controls
can be reconsidered when actual workloads or operating needs justify them.
Report relocation is accepted local work, not a deferral.
## Scope Coverage
Numbers refer to the [audit catalog](audit/catalog.md).
| Catalog entries | Target disposition |
| --- | --- |
| 1–3, 9 | Correct acquisition, precision, and file identity; independently verify hashes. |
| 4, 7, 11–13 | Strengthen server/test lifetime, startup boundaries, flag rejection, and error assertions. |
| 10, 16 | Consolidate HTTP reports and strengthen accounting protection. |
| 8 | Improve listener explanations; retain an explicit upstream capture-diagnostic dependency. |
| 15 | Simplify genuinely shared CLI diagnostic adaptation where useful. |
| 5, 6 | Document existing limits and defer additional controls. |
| 14 | Defer standalone restructuring; allow a small adjacent extraction when useful. |
| 17 | Allow the nil-aware converter simplification alongside mapping fixes; otherwise defer. |
## Documentation End State
Canonical current-state documentation reflects delivered input behavior,
report ownership, diagnostic handling, trusted-network maintenance scope, and
existing limit boundaries. It preserves upstream ownership and does not imply
stronger cancellation, filesystem, shutdown, or resource guarantees.
`future.md` describes potential future work only. Pending framework-diagnostic
adoption is recorded separately from HTTP-only deferrals and is not represented
as an implemented fix. All seven audit scope decisions are settled; no
significant product decision remains open.